apollo_varcov: Calculates varcov matrix of an Apollo model

Description Usage Arguments Details Value

View source: R/apollo_varcov.R


Calculates the Hessian, varcov matrix and s.e. of an Apollo model as defined buy its likelihood function and apollo_inputs list of settings. Performs automatic scaling for increased numeric stability.


apollo_varcov(apollo_beta, apollo_fixed, varcov_settings)



Named numeric vector. Names and values of parameters at which to calculate the covariance matrix. Values _must not be scaled_, and they must include any fixed parameter.


Character vector. Names of fixed parameters.


List of settings defining the behaviour of this function. It must contain at least one of teh following: apollo_logLike, apollo_grad or apollo_inputs.

  • hessianRoutine: Character. Name of routine used to calculate the Hessian. Valid values are "analytic", "numDeriv", "maxLik" or "none" to avoid estimating the Hessian and covariance matrix.

  • scaleBeta: Logical. If TRUE (default), parameters are scaled by their own value before calculating the Hessian to increase numerical stability. However, the output is de-scaled, so they are in the same scale as the apollo_beta argument.

  • numDeriv_settings: List. Additional arguments to the Richardson method used by numDeriv to calculate the Hessian. See argument method.args in grad for more details.

  • apollo_logLike: Function to calculate the loglikelihood of the model, as returned by apollo_makeLogLike.

  • apollo_grad: Function to calculate the gradient of the model, as returned by apollo_makeGrad.

  • apollo_probabilities: Function. Likelihood function of the model. Must receive three arguments:

    • apollo_beta: Named numeric vector.

    • apollo_inputs: List of settings.

    • functionality: Character.

  • apollo_inputs: List of inputs to estimate a model, as returned by apollo_validateInputs.


It calculates the Hessian, variance-covariance, and standard errors at apollo_beta values of an estimated model. At least one of the following settings must be provided (ordered by speed): apollo_grad, apollo_logLike, or (apollo_probabilities and apollo_inputs). If more than one is provided, then the priority is: apollo_grad, apollo_logLike, (apollo_probabilities and apollo_inputs).


List with the following elements

apollo documentation built on July 31, 2021, 5:08 p.m.