Skip to contents

A wrapper to mgcv::gam.vcomp() which returns the smoothing parameters expressed as variance components.

Usage

# S3 method for class 'gamm4'
variance_comp(object, rescale = TRUE, coverage = 0.95, ...)

# S3 method for class 'scam'
variance_comp(object, rescale = TRUE, coverage = 0.95, ...)

variance_comp(object, ...)

# S3 method for class 'gam'
variance_comp(object, rescale = TRUE, coverage = 0.95, ...)

Arguments

object

a model fitted by mgcv::gam(), mgcv::bam(), or gamm4::gamm4(). See gamm4_support for mixed-model variance components.

rescale

logical; for numerical stability reasons the penalty matrices of smooths are rescaled before fitting. If rescale = TRUE, this rescaling is undone, resulting in variance components that are on their original scale. This is needed if comparing with other mixed model software, such as lmer().

coverage

numeric; a value between 0 and 1 indicating the (approximate) coverage of the confidence interval that is returned.

...

arguments passed to other methods

Details

For SCAM fits, .variance is the fitted response scale divided by the smoothing parameter, optionally undoing penalty rescaling. This ratio describes the Gaussian penalty on unrestricted fitting parameters; it is not a Gaussian variance for the transformed smooth coefficients. SCAM's GCV and UBRE fits do not supply the likelihood-based smoothing-parameter covariance needed for confidence limits, so both limit columns are NA.

This function is a wrapper to mgcv::gam.vcomp() which performs three additional services

  • it suppresses the annoying text output that mgcv::gam.vcomp() prints to the terminal,

  • returns the variance of each smooth as well as the standard deviation, and

  • returns the variance components as a tibble.

See also