dynr.cook: Cook a dynr model to estimate its free parameters

Description Usage Arguments Details Examples


Cook a dynr model to estimate its free parameters


dynr.cook(dynrModel, conf.level = 0.95, infile, verbose = TRUE,
  weight_flag = FALSE, debug_flag = FALSE)



a dynr model compiled using dynr.model, consisting of recipes for submodels, starting values, parameter names, and C code for each submodel


a cumulative proportion indicating the level of desired confidence intervals for the final parameter estimates (default is .95)


(not required for models specified through the recipe functions) the name of a file that has the C codes for all dynr submodels for those interested in specifying a model directly in C


a flag (TRUE/FALSE) indicating whether more detailed intermediate output during the estimation process should be printed


a flag (TRUE/FALSE) indicating whether the negative log likelihood function should be weighted by the length of the time series for each individual


a flag (TRUE/FALSE) indicating whether users want additional dynr output that can be used for diagnostic purposes


Free parameter estimation uses the SLSQP routine from NLOPT.

The typical items returned in the cooked model are the smoothed latent variable estimates only. The time-varying latent variable means are called eta_smooth_final; the time-varying latent variable (co-)variances are called error_cov_smooth_final; and the time-varying smoothed probability of each regime is called pr_t_given_T.

When debug_flag is TRUE, then additional information is passed into the cooked model. This information can get quite large, so it is not returned unless requested. The information gets large because these items often depend on the regime in addition to time. The updated latent states for each possible regime are in eta_regime_t; the updated latent covariances for each possible regime are in error_cov_regime_t; the latent residual (innovation vector) from each regime to each regime is stored in innov_vec; and the inverse of the updated latent covariance matrix from each regime to each regime is in inverse_residual_cov.


#fitted.model <- dynr.cook(model)

Search within the dynr package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.