`pfr`

formulaDefines a term \(\int_{T}\beta(t)X_i(t)dt\) for inclusion in a
`pfr`

formula, where \(\beta(t)\) is estimated with
structured penalties (Randolph et al., 2012).

```
peer(
X,
argvals = NULL,
pentype = "RIDGE",
Q = NULL,
phia = 10^3,
L = NULL,
...
)
```

X

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`

.

argvals

indices of evaluation of `X`

, i.e. \((t_{i1},.,t_{iJ})\) for
subject \(i\). May be entered as either a length-`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.)

pentype

the type of penalty to apply, one of `"RIDGE"`

, `"D"`

,
`"DECOMP"`

, or `"USER"`

; see Details.

Q

matrix \(Q\) used for `pentype="DECOMP"`

; see Details.

phia

scalar \(a\) used for `pentype="DECOMP"`

; see Details.

L

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, \(bP_Q + a(I-P_Q)\), where \(P_Q = Q^t(QQ^t)^{-1}Q\). The \(Q\) matrix must be specified by`Q`

, and the scalar \(a\) by`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 { # } # 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) # } # NOT RUN { # }