pfr
formulaDefines a term pfr
formula, where
peer(X, argvals = NULL, pentype = "RIDGE", Q = NULL, phia = 10^3,
L = NULL, ...)
functional predictors, typically expressed as an N
by J
matrix,
where N
is the number of columns and J
is the number of
evaluation points. May include missing/sparse functions, which are
indicated by NA
values. Alternatively, can be an object of class
"fd"
; see fd
.
indices of evaluation of X
, i.e. J
vector, or as
an N
by J
matrix. Indices may be unequally spaced. Entering
as a matrix allows for different observations times for each subject. If
NULL
, defaults to an equally-spaced grid between 0 or 1 (or within
X$basis$rangeval
if X
is a fd
object.)
the type of penalty to apply, one of "RIDGE"
, "D"
,
"DECOMP"
, or "USER"
; see Details.
matrix pentype="DECOMP"
; see Details.
scalar pentype="DECOMP"
; see Details.
user-supplied penalty matrix for pentype="USER"
; see
Details.
additional arguments to be passed to lf
(and then
possibly s
). Arguments processed by lf
include, for example,
integration
for specifying the method of numerical integration.
Arguments processed by s
include information related to basis and penalization, such as m
for specifying the order of the difference penalty; See Details.
xt
-argument is not allowed for peer
-terms and will cause
an error.
peer
is a wrapper for lf
, which defines linear
functional predictors for any type of basis. It simply calls lf
with the appropriate options for the peer
basis and penalty construction.
The type of penalty is determined by the pentype
argument. There
are four types of penalties available:
pentype=="RIDGE"
for a ridge penalty, the default
pentype=="D"
for a difference penalty. The order of the
difference penalty may be specified by supplying an m
argument
(default is 2).
pentype=="DECOMP"
for a decomposition-based penalty,
Q
, and the scalar phia
. The number of columns of Q
must be equal to the
length of the data. Each row represents a basis function where the
functional predictor is expected to lie, according to prior belief.
pentype=="USER"
for a user-specified penalty matrix,
supplied by the L
argument.
The original stand-alone implementation by Madan Gopal Kundu is available in
peer_old
.
Randolph, T. W., Harezlak, J, and Feng, Z. (2012). Structured penalties for functional linear models - partially empirical eigenvectors for regression. Electronic Journal of Statistics, 6, 323-353.
Kundu, M. G., Harezlak, J., and Randolph, T. W. (2012). Longitudinal functional models with structured penalties (arXiv:1211.4763 [stat.AP]).
# NOT RUN {
#------------------------------------------------------------------------
# Example 1: Estimation with D2 penalty
#------------------------------------------------------------------------
data(DTI)
DTI = DTI[which(DTI$case == 1),]
fit.D2 = pfr(pasat ~ peer(cca, pentype="D"), data=DTI)
plot(fit.D2)
#------------------------------------------------------------------------
# Example 2: Estimation with structured penalty (need structural
# information about regression function or predictor function)
#------------------------------------------------------------------------
data(PEER.Sim)
data(Q)
PEER.Sim1<- subset(PEER.Sim, t==0)
# Setting k to max possible value
fit.decomp <- pfr(Y ~ peer(W, pentype="Decomp", Q=Q, k=99), data=PEER.Sim1)
plot(fit.decomp)
# }
Run the code above in your browser using DataLab