Cook a dynr model to estimate its free parameters

1 2 |

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

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

`infile` |
(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 |

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

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

`debug_flag` |
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`

.

1 | ```
#fitted.model <- dynr.cook(model)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ 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.