v_s {vglmer}R Documentation

Create splines for use in vglmer

Description

This function estimates splines in vglmer, similar to s(...) in mgcv albeit with many fewer options than mgcv. It allows for truncated (linear) splines or O'Sullivan splines. Please see vglmer for more discussion and examples.

Usage

v_s(
  ...,
  type = "tpf",
  knots = NULL,
  by = NA,
  by_re = TRUE,
  force_vector = FALSE,
  outer_okay = FALSE
)

Arguments

...

Variable name, e.g. v_s(x)

type

Default ("tpf") uses truncated linear splines for the basis. The other option ("o") uses O'Sullivan splines (Wand and Ormerod 2008).

knots

Default (NULL) uses K=min(N/4,35) knots evenly spaced at quantiles of the covariate x. A single number specifies a specific number of knots; a vector can set custom locations for knots.

by

A categorical or factor covariate to interact the spline with; for example, v_s(x, by = g).

by_re

Default (TRUE) regularizes the interactions between the categorical factor and the covariate. See "Details" in vglmer for more discussion.

force_vector

Force that argument to knots is treated as vector. This is usually not needed unless knots is a single integer that should be treated as a single knot (vs. the number of knots).

outer_okay

Default (FALSE) does not permit values in x to exceed the outer knots.

Value

This function returns a list of class of vglmer_spline that is passed to unexported functions. It contains the arguments noted above where ... is parsed into an argument called term.

References

Wand, Matt P. and Ormerod, John T. 2008. "On Semiparametric Regression with O'Sullivan Penalized Splines". Australian & New Zealand Journal of Statistics. 50(2): 179-198.

Wood, Simon N. 2017. Generalized Additive Models: An Introduction with R. Chapman and Hall/CRC.


[Package vglmer version 1.0.3 Index]