View source: R/estimate_mnhmm.R
estimate_mnhmm | R Documentation |
Function estimate_mnhmm
estimates a mixture version of
non-homogeneous hidden Markov model (MNHMM) where initial, transition,
emission, and mixture probabilities can depend on covariates. See
estimate_nhmm()
for further details.
estimate_mnhmm(
n_states,
n_clusters,
emission_formula,
initial_formula = ~1,
transition_formula = ~1,
cluster_formula = ~1,
data,
time,
id,
lambda = 0,
prior_obs = "fixed",
state_names = NULL,
cluster_names = NULL,
inits = "random",
init_sd = 2,
restarts = 0L,
method = "EM-DNM",
bound = Inf,
control_restart = list(),
control_mstep = list(),
...
)
n_states |
An integer > 1 defining the number of hidden states. |
n_clusters |
A positive integer defining the number of clusters (mixtures). |
emission_formula |
of class |
initial_formula |
of class |
transition_formula |
of class |
cluster_formula |
of class |
data |
A data frame containing the variables used in the model formulas. |
time |
Name of the time index variable in |
id |
Name of the id variable in |
lambda |
Penalization factor |
prior_obs |
Either |
state_names |
A vector of optional labels for the hidden states. If this
is |
cluster_names |
A vector of optional labels for the clusters. If this
is |
inits |
If |
init_sd |
Standard deviation of the normal distribution used to generate
random initial values. Default is |
restarts |
Number of times to run optimization using random starting values (in addition to the final run). Default is 0. |
method |
Optimization method used. Option |
bound |
Positive value defining the hard lower and upper bounds for the
working parameters |
control_restart |
Controls for restart steps, see details. |
control_mstep |
Controls for M-step of EM algorithm, see details. |
... |
Additional arguments to |
Object of class mnhmm
.
estimate_nhmm()
for further details.
data("mvad", package = "TraMineR")
d <- reshape(mvad, direction = "long", varying = list(15:86),
v.names = "activity")
## Not run:
set.seed(1)
fit <- estimate_mnhmm(n_states = 3, n_clusters = 2,
data = d, time = "time", id = "id",
cluster_formula = ~ male + catholic + gcse5eq + Grammar +
funemp + fmpr + livboth + Belfast +
N.Eastern + Southern + S.Eastern + Western,
emission_formula = activity ~ male + catholic + gcse5eq,
initial_formula = ~ 1,
transition_formula = ~ male + gcse5eq
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.