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

model.matrix.bamlss.frame

Construct/Extract BAMLSS Design Matrices


Description

The function creates design (or model) matrices for BAMLSS, i.e., for each parameter of a bamlss.family object.

Usage

## S3 method for class 'bamlss.frame'
model.matrix(object, data = NULL, model = NULL,
  drop = TRUE, scale.x = FALSE, ...)

## S3 method for class 'bamlss.formula'
model.matrix(object, data = NULL, model = NULL,
  drop = TRUE, scale.x = FALSE, ...)

## S3 method for class 'bamlss.terms'
model.matrix(object, data = NULL, model = NULL,
  drop = TRUE, scale.x = FALSE, ...)

Arguments

object

A bamlss.frame, bamlss.formula or terms.bamlss object.

data

A data frame or list.

model

Character or integer, specifies the model for which design matrices should be returned.

drop

If model matrices for only one model are returned, the list structure is dropped.

scale.x

Logical, should the model matrices of the linear parts be scaled?

...

Not used.

Value

Depending on the type of model a named list of model matrices or a single model matrix.

See Also

Examples

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

## Model formula.
f <- list(
  num ~ x1 + x2 + id,
  sigma ~ x3 + fac + lon + lat
)

## Create a "bamlss.frame".
bf <- bamlss.frame(f, data = d)

## Get the model matrices.
X <- model.matrix(bf)
head(X$sigma)

## Same with "bamlss.formula".
X <- model.matrix(bamlss.formula(f), data = d)
head(X$sigma)

bamlss

Bayesian Additive Models for Location, Scale, and Shape (and Beyond)

v1.1-3
GPL-2 | GPL-3
Authors
Nikolaus Umlauf [aut, cre] (<https://orcid.org/0000-0003-2160-9803>), Nadja Klein [aut] (<https://orcid.org/0000-0002-5072-5347>), Achim Zeileis [aut] (<https://orcid.org/0000-0003-0918-3766>), Meike Koehler [ctb], Thorsten Simon [aut] (<https://orcid.org/0000-0002-3778-7738>), Stanislaus Stadlmann [ctb]
Initial release
2021-01-25

We don't support your browser anymore

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