fpc {refund} | R Documentation |
Construct a FPC regression term
Description
Constructs a functional principal component regression (Reiss and Ogden,
2007, 2010) term for inclusion in an mgcv::gam
-formula (or
bam
or gamm
or gamm4:::gamm
) as
constructed by pfr
. Currently only one-dimensional functions
are allowed.
Usage
fpc(
X,
argvals = NULL,
method = c("svd", "fpca.sc", "fpca.face", "fpca.ssvd"),
ncomp = NULL,
pve = 0.99,
penalize = (method == "svd"),
bs = "ps",
k = 40,
...
)
Arguments
X |
functional predictors, typically expressed as an |
argvals |
indices of evaluation of |
method |
the method used for finding principal components. The default
is an unconstrained SVD of the |
ncomp |
number of principal components. if |
pve |
proportion of variance explained; used to choose the number of principal components |
penalize |
if |
bs |
two letter character string indicating the |
k |
the dimension of the pre-smoothing basis |
... |
additional options to be passed to |
Details
fpc
is a wrapper for lf
, which defines linear
functional predictors for any type of basis for inclusion in a pfr
formula. fpc
simply calls lf
with the appropriate options for
the fpc
basis and penalty construction.
This function implements both the FPCR-R and FPCR-C methods of Reiss and Ogden (2007). Both methods consist of the following steps:
project
X
onto a spline basisB
perform a principal components decomposition of
XB
use those PC's as the basis in fitting a (generalized) functional linear model
This implementation provides options for each of these steps. The basis
for in step 1 can be specified using the arguments bs
and k
,
as well as other options via ...
; see s
for
these options. The type of PC-decomposition is specified with method
.
And the FLM can be fit either penalized or unpenalized via penalize
.
The default is FPCR-R, which uses a b-spline basis, an unconstrained
principal components decomposition using svd
, and the FLM
fit with a second-order difference penalty. FPCR-C can be selected by
using a different option for method
, indicating a constrained
("functional") PC decomposition, and by default an unpenalized fit of the
FLM.
FPCR-R is also implemented in fpcr
; here we implement the
method for inclusion in a pfr
formula.
Value
The result of a call to lf
.
NOTE
Unlike fpcr
, fpc
within a pfr
formula does
not automatically decorrelate the functional predictors from additional
scalar covariates.
Author(s)
Jonathan Gellar JGellar@mathematica-mpr.com, Phil Reiss phil.reiss@nyumc.org, Lan Huo lan.huo@nyumc.org, and Lei Huang huangracer@gmail.com
References
Reiss, P. T. (2006). Regression with signals and images as predictors. Ph.D. dissertation, Department of Biostatistics, Columbia University. Available at http://works.bepress.com/phil_reiss/11/.
Reiss, P. T., and Ogden, R. T. (2007). Functional principal component regression and functional partial least squares. Journal of the American Statistical Association, 102, 984-996.
Reiss, P. T., and Ogden, R. T. (2010). Functional generalized linear models with images as predictors. Biometrics, 66, 61-69.
See Also
lf
, smooth.construct.fpc.smooth.spec
Examples
data(gasoline)
par(mfrow=c(3,1))
# Fit PFCR_R
gasmod1 <- pfr(octane ~ fpc(NIR, ncomp=30), data=gasoline)
plot(gasmod1, rug=FALSE)
est1 <- coef(gasmod1)
# Fit FPCR_C with fpca.sc
gasmod2 <- pfr(octane ~ fpc(NIR, method="fpca.sc", ncomp=6), data=gasoline)
plot(gasmod2, se=FALSE)
est2 <- coef(gasmod2)
# Fit penalized model with fpca.face
gasmod3 <- pfr(octane ~ fpc(NIR, method="fpca.face", penalize=TRUE), data=gasoline)
plot(gasmod3, rug=FALSE)
est3 <- coef(gasmod3)
par(mfrow=c(1,1))
ylm <- range(est1$value)*1.35
plot(value ~ X.argvals, type="l", data=est1, ylim=ylm)
lines(value ~ X.argvals, col=2, data=est2)
lines(value ~ X.argvals, col=3, data=est3)