Fits, by using an ECM algorithm, parsimonious hidden Markov models to the given four-way data. Parallel computing is implemented and highly recommended for a faster model fitting. The Bayesian information criterion (BIC) is used to select the best fitting model.
HMM.fit(
X,
k = 1:3,
init.par = NULL,
mod.row = "all",
mod.col = "all",
ncores = 1,
verbose = FALSE,
ret.all = FALSE
)An array of dimension p x r x n x t, where p is the number of
variables in the rows of each data matrix, r is the number of variables in the columns of each
data matrix, n is the number of data observations and t is the number of times.
An integer or a vector indicating the number of states of the models.
The initial values for starting the algorithms, as produced by the HMM.init() function.
A character vector indicating the parsimonious structure of the row covariance matrix. Possible values are: "EII", "VII", "EEI", "VEI", "EVI", "VVI", "EEE", "VEE", "EVE", "EEV", "VVE", "VEV", "EVV", "VVV" or "all". When "all" is used, all of the 14 row parsimonious structures are considered.
A character vector indicating the parsimonious structure of the column covariance matrix. Possible values are: "II", "EI", "VI", "EE", "VE", "EV", "VV", or "all". When "all" is used, all of the 7 column parsimonious structures are considered.
A positive integer indicating the number of cores used for running in parallel.
A logical indicating whether the running output should be displayed.
A logical indicating whether to report the results of all the models or only those of the best model according to the BIC.
A list with the following elements:
The results related to the all the fitted models (only when ret.all = TRUE).
The best fitting model according to the BIC.
A quick table showing summary results for the best fitting model according to the BIC.
Provides information on the computational times required to fit all the models for each state.
# NOT RUN {
data(simX)
init <- HMM.init(X = simX, k = 2, nstartR = 1)
res <- HMM.fit(X = simX, k = 2, init.par = init, mod.row = "VII", mod.col = "EE")
# }
Run the code above in your browser using DataLab