lf | R Documentation |
Defines a term \int_{T}\beta(t)X_i(t)dt
for inclusion in an mgcv::gam
-formula (or
{bam}
or {gamm}
or gamm4:::gamm
) as constructed by
{pfr}
, where \beta(t)
is an unknown coefficient
function and X_i(t)
is a functional predictor on the closed interval
T
. See
{smooth.terms}
for a list of basis and penalty options; the
default is thin-plate regression splines, as this is the default option
for [mgcv]{s}
.
lf(
X,
argvals = NULL,
xind = NULL,
integration = c("simpson", "trapezoidal", "riemann"),
L = NULL,
presmooth = NULL,
presmooth.opts = NULL,
...
)
X |
functional predictors, typically expressed as an |
argvals |
indices of evaluation of |
xind |
same as argvals. It will not be supported in the next version of refund. |
integration |
method used for numerical integration. Defaults to |
L |
an optional |
presmooth |
string indicating the method to be used for preprocessing functional predictor prior
to fitting. Options are |
presmooth.opts |
list including options passed to preprocessing method
|
... |
optional arguments for basis and penalization to be passed to
|
a list with the following entries
call |
a |
argvals |
the |
L |
the matrix of weights used for the integration |
xindname |
the name used for the functional predictor variable in the |
tindname |
the name used for |
LXname |
the name used for the |
presmooth |
the |
prep.func |
a function that preprocesses data based on the preprocessing method specified in |
Mathew W. McLean mathew.w.mclean@gmail.com, Fabian Scheipl, and Jonathan Gellar
Goldsmith, J., Bobb, J., Crainiceanu, C., Caffo, B., and Reich, D. (2011). Penalized functional regression. Journal of Computational and Graphical Statistics, 20(4), 830-851.
Goldsmith, J., Crainiceanu, C., Caffo, B., and Reich, D. (2012). Longitudinal penalized functional regression for cognitive outcomes on neuronal tract measurements. Journal of the Royal Statistical Society: Series C, 61(3), 453-469.
{pfr}
, {af}
, mgcv's {smooth.terms}
and {linear.functional.terms}
; {pfr}
for additional examples
data(DTI)
DTI1 <- DTI[DTI$visit==1 & complete.cases(DTI),]
# We can apply various preprocessing options to the DTI data
fit1 <- pfr(pasat ~ lf(cca, k=30), data=DTI1)
fit2 <- pfr(pasat ~ lf(cca, k=30, presmooth="fpca.sc",
presmooth.opts=list(nbasis=8, pve=.975)), data=DTI1)
fit3 <- pfr(pasat ~ lf(cca, k=30, presmooth="fpca.face",
presmooth.opts=list(m=3, npc=9)), data=DTI1)
fit4 <- pfr(pasat ~ lf(cca, k=30, presmooth="fpca.ssvd"), data=DTI1)
fit5 <- pfr(pasat ~ lf(cca, k=30, presmooth="bspline",
presmooth.opts=list(nbasis=8)), data=DTI1)
fit6 <- pfr(pasat ~ lf(cca, k=30, presmooth="interpolate"), data=DTI1)
# All models should result in similar fits
fits <- as.data.frame(lapply(1:6, function(i)
get(paste0("fit",i))$fitted.values))
names(fits) <- c("none", "fpca.sc", "fpca.face", "fpca.ssvd", "bspline", "interpolate")
pairs(fits)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.