These functions are provided for compatibility with older version of the seqHMM package. They will be eventually completely removed.
fit_hmm(
model,
em_step = TRUE,
global_step = FALSE,
local_step = FALSE,
control_em = list(),
control_global = list(),
control_local = list(),
lb,
ub,
threads = 1,
log_space = FALSE,
...
)fit_mhmm(
model,
em_step = TRUE,
global_step = FALSE,
local_step = FALSE,
control_em = list(),
control_global = list(),
control_local = list(),
lb,
ub,
threads = 1,
log_space = FALSE,
...
)
trim_hmm(
model,
maxit = 0,
return_loglik = FALSE,
zerotol = 1e-08,
verbose = TRUE,
...
)
An object of class hmm
or mhmm
.
Logical. Whether or not to use the EM algorithm at the start
of the parameter estimation. The default is TRUE
.
Logical. Whether or not to use global optimization via
nloptr
(possibly after the EM step). The default is FALSE
.
Logical. Whether or not to use local optimization via
nloptr
(possibly after the EM and/or global steps). The default is FALSE
.
Optional list of control parameters for the EM algorithm. Possible arguments are
The maximum number of iterations, the default is 1000.
Note that iteration counter starts with -1 so with maxeval=1
you get already two iterations.
This is for backward compatibility reasons.
The level of printing. Possible values are 0 (prints nothing), 1 (prints information at the start and the end of the algorithm), 2 (prints at every iteration), and for mixture models 3 (print also during optimization of coefficients).
Relative tolerance for convergence defined as \((logLik_new - logLik_old)/(abs(logLik_old) + 0.1)\). The default is 1e-10.
A list containing options for possible EM restarts with the following components:
Number of restarts of the EM algorithm using random initial values. The default is 0, i.e. no restarts.
Logical. Should the original transition probabilities be varied? The default is TRUE
.
Logical. Should the original emission probabilities be varied? The default is TRUE
.
Standard deviation for rnorm
used in randomization. The default is 0.25.
Maximum number of iterations, the default is control_em$maxeval
Level of printing in restarted EM steps. The default is control_em$print_level
.
Relative tolerance for convergence at restarted EM steps. The default is control_em$reltol
.
If the relative change of the final model of the restart phase is larger than the tolerance
for the original EM phase, the final model is re-estimated with the original reltol
and maxeval
at the end of the EM step.
Save the log-likelihood values of the n_optimum
best
models (from all estimated models including the the first EM run.).
The default is min(times + 1, 25)
.
If TRUE
. Use the initial values of the input model as starting
points for the permutations. Otherwise permute the results of the first EM run.
Optional list of additional arguments for
nloptr
argument opts
. The default values are
"NLOPT_GD_MLSL_LDS"
list(algorithm = "NLOPT_LD_LBFGS", ftol_rel = 1e-6, xtol_rel = 1e-4)
10000
(maximum number of iterations in global optimization algorithm.)
60
(maximum time for global optimization. Set to 0 for unlimited time.)
Optional list of additional arguments for
nloptr
argument opts
. The default values are
"NLOPT_LD_LBFGS"
1e-10
1e-8
10000
(maximum number of iterations)
Lower and upper bounds for parameters in Softmax parameterization. The default interval is \([pmin(-25, 2*initialvalues), pmax(25, 2*initialvalues)]\), except for gamma coefficients, where the scale of covariates is taken into account. Note that it might still be a good idea to scale covariates around unit scale. Bounds are used only in the global optimization step.
Number of threads to use in parallel computing. The default is 1.
Make computations using log-space instead of scaling for greater
numerical stability at a cost of decreased computational performance. The default is FALSE
.
Additional arguments to nloptr
.
Number of iterations. After zeroing small values, the model is
refitted, and this is repeated until there is nothing to trim or maxit
iterations are done.
Return the log-likelihood of the trimmed model together with
the model object. The default is FALSE
.
Values smaller than this are trimmed to zero.
Print results of trimming. The default is TRUE
.