Top to bottom wrapper function: Simulate from a specified autoregressive HMM, fit a specified autoregressive HMM to the resulting data and return the output. Optionally: Also return the decoded states using the Viterbi algorithm. Optionally: Also plot the resulting densities of the weighted state-dependent distributions using state-stationary values.
Usage
ar_simulation(
model_sim,
model_fit,
N_sim,
N_fit,
n_samples,
Gamma_sim,
delta_sim,
param_sim,
autocor_sim = 0,
estimate_states = TRUE,
plot_it = TRUE,
mllk = mllk,
lambda = 0
)
Arguments
- model_sim
Form of simulated data in a list: First entry is vector containing abbreviated names (in R-jargon) of the distributions the data should be sampled from. Second entry is vector of degree of autoregression for each distribution (one value for each state), 0 = no autoregression
- model_fit
Form of fitted data in a list: First entry is vector containing abbreviated names (in R-jargon) of the distributions (one value for each state) to be considered in the likelihood computation. Second entry is vector of degree of autoregression for each distribution, 0 = no autoregression
- N_sim
Number of states of the HMM used for data generation.
- N_fit
Number of states of the HMM used for fitting the data.
- n_samples
Number of samples to be generated.
- Gamma_sim
Full transition probability matrix of simulated data.
- delta_sim
Initial distribution of simulated data.
- param_sim
Parameter vector for parameters of the simulated data. In a vector form, and in the order that is customary: e.g. for a gamma HMM c(\(\mu_1,\mu_2,\sigma_1,\sigma_2\)). The order of distributions has to be the same as in model_sim.
- autocor_sim
List of list of parameters for the autocorrelation coefficients. Has to match p, in the order \(\phi_{t-p},\dots,\phi_{t-1}\) where \(\phi\) is the vector of autocorrelation coefficients for one specific time lag (one value for each state). 0, if no autocorrelation. Has to respect the order specified in
model_sim
.- estimate_states
Bool, determines if states are estimated and returned using Viterbi.
- plot_it
Bool, determines if resulting densities are plotted.
- mllk
Optional, choice of negative log likelihood function (e.g. penalized).
- lambda
Optional, choice of complexity penalty (\(\ge 0\)).