Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

variance_comp

Variance components of smooths from smoothness estimates


Description

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

Usage

variance_comp(object, ...)

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

Arguments

object

an R object. Currently only models fitted by mgcv::gam() or mgcv::bam() are supported.

...

arguments passed to other methods

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.

Details

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.


gratia

Graceful 'ggplot'-Based Graphics and Other Functions for GAMs Fitted Using 'mgcv'

v0.6.0
MIT + file LICENSE
Authors
Gavin L. Simpson [aut, cre] (<https://orcid.org/0000-0002-9084-8413>), Henrik Singmann [ctb] (<https://orcid.org/0000-0002-4842-3657>)
Initial release
2021-04-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.