randomize | R Documentation |
The transformer function takes a bamlss.frame
object and transforms all
smooth.construct
s 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
.
trans_random(x)
randomize(x)
x |
Object returned from function |
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
.
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
.
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.
bamlss.frame
, bamlss
, smooth2random
.
## 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)"]])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.