smooth.construct: Constructor Functions for Smooth Terms in BAMLSS

View source: R/BAMLSS.R

smooth.constructR Documentation

Constructor Functions for Smooth Terms in BAMLSS

Description

The generic function is only a copy of smooth.construct adding a ... argument. For objects of class "bamlss.frame" and "bamlss" the method extracts all smooth model terms, see function bamlss.frame for details on the setup of BAMLSS.

Usage

## Function as in package mgcv
## but with additional dots argument.
smooth.construct(object, data, knots, ...)

## For 'bamlss.frame's.
## S3 method for class 'bamlss.frame'
smooth.construct(object, data = NULL, knots = NULL,
  model = NULL, drop = TRUE, ...)

## S3 method for class 'bamlss.formula'
smooth.construct(object, data = NULL, knots = NULL,
  model = NULL, drop = TRUE, ...)

## S3 method for class 'bamlss.terms'
smooth.construct(object, data = NULL, knots = NULL,
  model = NULL, drop = TRUE, ...)

Arguments

object

Either a smooth specification object, or object of class "bamlss", "bamlss.frame", "bamlss.formula" or "bamlss.terms". For smooth specification objects, see function smooth.construct.

data

A data frame or list, see also see function smooth.construct.

knots

See function smooth.construct.

model

Character, specifies for which model parameter the smooth constructs should be created.

drop

If there is only one model parameter the returned named list is simplified.

...

Arguments passed to the smooth term constructor functions.

Value

For smooth specification objects see function see smooth.construct. For objects of class "bamlss.frame" or "bamlss" the list of smooth constructs, see function bamlss.frame for more details.

See Also

bamlss.frame, bamlss.formula, bamlss, smooth.construct.

Examples

## Generate some data.
d <- GAMart()

## Create a "bamlss.frame".
bf <- bamlss.frame(num ~ s(x1) + s(x2), data = d)

## Extract the smooth construct.
sc <- smooth.construct(bf)
str(sc)

## Also possible with formulas.
f <- bamlss.formula(list(
  num ~ s(x1) + te(lon,lat),
  sigma ~ s(x2)
), family = "gaussian")

sc <- smooth.construct(f, data = d)
str(sc)

bamlss documentation built on Oct. 11, 2024, 5:07 p.m.