# Small example based on subset of PBC data
data(pbc_subset)
# Estimate MFPC basis and attach to data
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)
Run the code above in your browser using DataLab