bamlss (version 1.1-2)

randomize: Transform Smooth Constructs to Random Effects

Description

The transformer function takes a bamlss.frame object and transforms all smooth.constructs into a random effects representation. Note that this is only possible for smooth terms with a single smoothing variance. The function is based on function smooth2random.

Usage

randomize(x)

Arguments

x

Object returned from function bamlss.frame.

Value

A transformed bamlss.frame. To each smooth.construct model term an element named "Xf", the fixed effects design matrix, and an element "rand$Xr", the random effects design matrix, is added. In addition, for re-transforming parameters elements "trans.U" and "trans.D" are supplied. See also function smooth2random.

Details

The decomposition is achieved by a spectral decomposition of the penalty and design matrix by finding a basis of the null space of the penalty matrix. This feature is used, e.g., for the JAGS sampler function. For more details see also jagam.

References

Fahrmeir L, Kneib T, Lang S, Marx B (2013). Regression - Models, Methods and Applications. Springer-Verlag, Berlin. ISBN 978-3-642-34332-2.

Wood S.N. (2006). Generalized Additive Models: An Introduction with R. Chapman and Hall/CRC.

See Also

bamlss.frame, bamlss, smooth2random.

Examples

Run this code
# NOT RUN {
## Simulate data.
d <- GAMart()

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

## Structure of the "s(x1)" smooth.construct.
str(bf$x$mu$smooth.construct[["s(x1)"]])

## Transform.
bf <- randomize(bf)

## New structure adding fixed
## and random effect matrices.
str(bf$x$mu$smooth.construct[["s(x1)"]])
# }

Run the code above in your browser using DataCamp Workspace