Learn R Programming

glmSTARMA (version 1.0.0)

vcov.dglmstarma: Variance-Covariance Matrix for glmstarma and dglmstarma objects

Description

Computes the variance-covariance matrix for glmstarma and dglmstarma objects.

Usage

# S3 method for dglmstarma
vcov(object, return_value = c("mean", "dispersion", "both"))

# S3 method for glmstarma vcov(object)

Value

For glmstarma objects, the function returns the variance-covariance matrix of the mean model coefficients. For dglmstarma objects, the function return depends on the return_value argument:

mean

Variance-covariance matrix for the mean model coefficients.

dispersion

Variance-covariance matrix for the dispersion model coefficients.

both

A list containing both variance-covariance matrices.

Arguments

object

An object of class glmstarma or dglmstarma for which the variance-covariance matrix is to be computed.

return_value

A character string specifying which variance-covariance matrix to return. Options are "mean", "dispersion", or "both". Default is "mean".

Details

The variance-covariance matrix is computed using a sandwich estimator approach, which accounts for potential misspecification of the model. The sandwich variance estimation is defined as \(V = G^{-1} H G^{-1}\), where \(G\) is the expected information matrix and \(H\) is the empirical covariance matrix of the score functions. In case of dglmstarma objects, separated variance-covariance matrices are computed for the mean and dispersion models because of the alternating estimation procedure.

See Also

vcov, glmstarma, dglmstarma

Examples

Run this code
# \donttest{
dat <- load_data("chickenpox", directory = tempdir())
chickenpox <- dat$chickenpox
population_hungary <- dat$population_hungary
W_hungary <- dat$W_hungary

model_autoregressive <- list(past_obs = rep(1, 7))
fit <- glmstarma(chickenpox, model_autoregressive, W_hungary, family = vpoisson("log"),
                 covariates = list(population = population_hungary))
vcov(fit)

mean_model <- list(past_obs = rep(1, 7))
dispersion_model <- list(past_obs = 1)
fit2 <- dglmstarma(chickenpox, mean_model, dispersion_model, mean_family = vquasipoisson("log"),
                   dispersion_link = "log",
                   wlist = W_hungary, 
                   mean_covariates = list(population = population_hungary))
vcov(fit2)
vcov(fit2, return_value = "dispersion")
vcov(fit2, return_value = "both")
# }

Run the code above in your browser using DataLab