Learn R Programming

MJMbamlss (version 0.1.0)

smooth.construct.unc_pcre.smooth.spec: mgcv-style constructor for PC-basis functional random effects (no constraint)

Description

Sets up design matrix for functional random effects based on the PC scores of the covariance operator of the random effect process. Note that there is no constraint on the smoother. See smooth.construct.re.smooth.spec for more details on mgcv-style smoother specification and smooth.construct.pcre.smooth.spec for the corresponding refund implementation.

Usage

# S3 method for unc_pcre.smooth.spec
smooth.construct(object, data, knots, ...)

Value

An object of class "random.effect". See smooth.construct

for the elements that this object will contain.

Arguments

object

a smooth specification object, see smooth.construct

data

see smooth.construct.

knots

see smooth.construct.

...

see smooth.construct.

Author

Alexander Volkmann; adapted from 'pcre' constructor by F. Scheipl (adapted from 're' constructor by S.N. Wood).

Details

This is an internal function as the corresponding smooth object and its predict method is primarily used within the bamlss call.

Examples

Run this code
data(pbc_subset)
mfpca <- preproc_MFPCA(pbc_subset, uni_mean = paste0(
  "logy ~ 1 + sex + drug + s(obstime, k = 5, bs = 'ps') + ",
  "s(age, k = 5, bs = 'ps')"),
  pve_uni = 0.99, nbasis = 5, weights = TRUE, save_uniFPCA = TRUE)
pbc_subset <- attach_wfpc(mfpca, pbc_subset, n = 2)
mfpca_list <- list(
  list(functions = funData::extractObs(mfpca$functions, 1),
       values = mfpca$values[1]),
  list(functions = funData::extractObs(mfpca$functions, 2),
       values = mfpca$values[2]))
sm <- smoothCon(s(id, fpc.1, bs = "unc_pcre",
      xt = list("mfpc" = mfpca_list[[1]], scale = "FALSE")), pbc_subset)

Run the code above in your browser using DataLab