Fit an autoregressive HMM with within-state autoregression to data
using a specified function to compute the negative
log-likelihood. This function gets by default minimized using the function optim
.
It returns the estimated parameters of the fitted model. The distributional assumptions for the HMM
can be specified using the parameter dist
.
Usage
fit_arp_model(
mllk,
data,
theta.star,
N,
p_auto,
dists,
opt_fun = "optim",
scale_kappa = 1,
zero_inf = FALSE,
lambda = 0
)
Arguments
- mllk
Negative log-likelihood function that should be minimized.
- data
Data that should be fitted using the HMM.
- theta.star
Unconstrained parameter vector (has to be provided in suitable form). Attention: -Inf values (resulting e.g. from supplying autocorrelation = 0) are not possible for the optimization function.
- N
Number of states.
- p_auto
Vector of degree of autoregression for each distribution, 0 = no autoregression, one value for every state of every variable.
- dists
Vector containing abbreviated names (in R-jargon) of the distributions to be considered in the likelihood computation.
- opt_fun
string - Function that should be used for optimization (default: optim, one of ['optim', 'nlm', 'genoud']).
- scale_kappa
Default 1, Scaling factor for kappa to avoid numerical issues in optimization for large kappa in the von Mises distribution.
- zero_inf
Default FALSE, indicates if the gamma distributed variables should incorporate zero-inflation.
- lambda
Default 0, complexity penalty for lasso regularization of autoregression coefficients.