Skip to contents

Extracts the variance-covariance matrices of the parameter estimates from a fitted amerasfit object.

Usage

# S3 method for class 'amerasfit'
vcov(object, methods = c("RC", "ERC", "MCML", "FMA", "BMA"), ...)

Arguments

object

A fitted model object of class amerasfit, as returned by ameras.

methods

Character vector specifying which estimation methods to extract variance-covariance matrices for. One or more of "RC", "ERC", "MCML", "FMA", and "BMA". Defaults to all. Methods that were not run are silently skipped.

...

Additional arguments, currently unused.

Value

If a single method is requested or only one method was run, a named numeric matrix with rows and columns corresponding to model parameters. If multiple methods are requested and multiple methods were run, a named list of such matrices, one per method.

Note that for FMA and BMA the variance-covariance matrix is based on the generated samples rather than a Hessian-based approximation, and may differ in interpretation from the RC, ERC, and MCML variance-covariance matrices. For BMA, the reliability of the variance-covariance matrix depends on MCMC convergence as indicated by Rhat.

See also

ameras for model fitting, coef for extracting coefficients, summary.amerasfit for a summary including standard errors, vcov for the generic function.

Examples

# \donttest{
data("data", package="ameras")
dosevars <- paste0("V", 1:10)

fit <- ameras(Y.binomial ~ dose(all_of(dosevars), model="ERR"),
              data=data, family="binomial", methods=c("RC", "ERC"))
#> Error in resolve_dose_selection(sel_args, data):  In argument: `all_of(dosevars)`.
#> Caused by error:
#> ! object 'dosevars' not found

## Extract vcov for all available methods
vcov(fit)
#> Error: object 'fit' not found

## Extract vcov for a single method, returns a matrix
vcov(fit, methods="RC")
#> Error: object 'fit' not found

## Extract vcov for multiple methods, returns a named list
vcov(fit, methods=c("RC", "ERC"))
#> Error: object 'fit' not found
# }