Joint Covariance Matrix for gamlss2 Models

Description

Computes coefficient covariance from the joint penalized information of a fitted gamlss2 model.

Usage

## S3 method for class 'gamlss2'
vcov(object,
  type = c("vcov", "cor", "se", "coef"), full = FALSE,
  method = c("joint", "working", "numeric"), ...)

Arguments

object A fitted gamlss2 model.
type The covariance matrix, correlation matrix, standard errors, or corresponding coefficient vector to return.
full Logical. If FALSE, return ordinary linear coefficients. Their covariance is still extracted from the complete joint inverse. If TRUE, include supported smooth coefficients.
method Information calculation. “joint” uses the raw joint observed information, “working” uses the final family working curvature with zero cross-parameter blocks, and “numeric” uses a slow coefficient-dimensional numerical Hessian for validation.
Control arguments passed to the numerical Hessian when method = “numeric”.

Details

The default covariance is the inverse of \(H + P\), where \(H\) is the joint likelihood information for every supported distributional predictor and \(P\) is the complete penalty at the fitted smoothing and regularization parameters. Thus it retains covariance among linear and smooth terms and among distributional parameters. Prior observation weights and offsets in the final linear predictors are included.

The result is conditional on the fitted smoothing parameters. It does not include smoothing-parameter or model-selection uncertainty.

Special terms that have no verifiable coefficient-linear design are rejected explicitly. Objects fitted with light = TRUE do not retain the final predictors and must be refitted for joint covariance. Aliased or numerically unidentified coefficient variances are returned as NA; no arbitrary inferential ridge is added.

The ordinary summary() and effect-result paths use the covariance stored with each fitted model term by default, which is substantially faster for large models. Use summary(object, method = “joint”) or results(object, method = “joint”) to request the complete joint information. Simulation-based predict() calls always use the complete joint covariance. No consumer silently substitutes method = “working” when observed joint information is indefinite.

Value

A matrix for type = “vcov” or “cor”; a named numeric vector for type = “se” or “coef”.

See Also

gamlss2, predict.gamlss2

Examples

library("gamlss2")

data("cars", package = "datasets")
m <- gamlss2(dist ~ s(speed) | s(speed), data = cars, family = NO)

## linear-coefficient covariance,
## marginalized over smooth coefficients.
vcov(m)

## complete linear and smooth covariance
V <- vcov(m, full = TRUE)
head(diag(V))