apollo_mixEM {apollo}R Documentation

Uses EM for models with continuous random coefficients

Description

Uses the EM algorithm for estimating a model with continuous random coefficients.

Usage

apollo_mixEM(
  apollo_beta,
  apollo_fixed,
  apollo_probabilities,
  apollo_inputs,
  mixEM_settings = NA,
  estimate_settings = NA
)

Arguments

apollo_beta

Named numeric vector. Names and values for parameters. These need to be provided in the following order. With K random parameters, K means for the underlying Normals, followed by the elements of the lower triangle of the Cholesky matrix, by row.

apollo_fixed

Character vector. Names (as defined in apollo_beta) of parameters whose value should not change during estimation.

apollo_probabilities

Function. Returns probabilities of the model to be estimated. Must receive three arguments:

  • apollo_beta: Named numeric vector. Names and values of model parameters.

  • apollo_inputs: List containing options of the model. See apollo_validateInputs.

  • functionality: Character. Can be either "components", "conditionals", "estimate" (default), "gradient", "output", "prediction", "preprocess", "raw", "report", "shares_LL", "validate" or "zero_LL".

apollo_inputs

List grouping most common inputs. Created by function apollo_validateInputs.

mixEM_settings

List. Contains settings for this function. User input is required for all settings except those with a default or marked as optional.

  • EMmaxIterations: Numeric. Maximum number of iterations of the EM algorithm before stopping. Default is 100.

  • postEM: Numeric scalar. Determines the tasks performed by this function after the EM algorithm has converged. Can take values 0, 1 or 2 only. If value is 0, only the EM algorithm will be performed, and the results will be a model object without a covariance matrix (i.e. estimates only). If value is 1, after the EM algorithm, the covariance matrix of the model will be calculated as well, and the result will be a model object with a covariance matrix. If value is 2, after the EM algorithm, the estimated parameter values will be used as starting value for a maximum likelihood estimation process, which will render a model object with a covariance matrix. Performing maximum likelihood estimation after the EM algorithm is useful, as there may be room for further improvement. Default is 2.

  • silent: Boolean. If TRUE, no information is printed to the console during estimation. Default is FALSE.

  • stoppingCriterion: Numeric. Convergence criterion. The EM process will stop when improvements in the log-likelihood fall below this value. Default is 10^-5.

  • transforms: List. Optional argument, with one entry per parameter, showing the inverse transform to return from beta to the underlying Normal. E.g. if the first parameter is specified as negative logormal inside apollo_randCoeff, then the entry in transforms should be transforms[[1]]=function(x) log(-x)

estimate_settings

List. Options controlling the estimation process within each EM iteration. See apollo_estimate for details.

Details

This function uses the EM algorithm for estimating a model with continuous random coefficients. It is only suitable for models where all parameters are random, with a full covariance matrix. All random parameters need to be based on underlying Normals with a full covariance matrix, but any transform thereof can be used.

Value

model object


[Package apollo version 0.3.2 Index]