Skip to contents

Extract basis dimension of a smooth

Usage

basis_size(object, ...)

# S3 method for mgcv.smooth
basis_size(object, ...)

# S3 method for gam
basis_size(object, ...)

# S3 method for gamm
basis_size(object, ...)

Arguments

object

A fitted GAM(M). Currently mgcv::gam() (and anything that inherits from the "gam" class, e.g. mgcv::bam()) and mgcv::gamm() are supported.

...

Arguments passed to other methods.

Examples

load_mgcv()

df <- data_sim("eg1", n = 200, seed = 1)
m <- bam(y ~ s(x0) + s(x1) + s(x2) + s(x3), data = df)

basis_size(m)
#> s(x0) s(x1) s(x2) s(x3) 
#>     9     9     9     9