Implements functional model with structured penalties (Randolph et al., 2012) with scalar outcome and single functional predictor through mixed model equivalence.

```
peer_old(
Y,
funcs,
argvals = NULL,
pentype = "Ridge",
L.user = NULL,
Q = NULL,
phia = 10^3,
se = FALSE,
...
)
```

Y

vector of all outcomes

funcs

matrix containing observed functional predictors as rows. Rows
with `NA`

and `Inf`

values will be deleted.

argvals

matrix (or vector) of indices of evaluations of \(X_i(t)\); i.e. a matrix with
*i*th row \((t_{i1},.,t_{iJ})\)

pentype

type of penalty. It can be either decomposition based
penalty (`DECOMP`

) or ridge (`RIDGE`

) or second-order difference
penalty (`D2`

) or any user defined penalty (`USER`

). For
decomposition based penalty user need to specify Q matrix in Q argument
(see details). For user defined penalty user need to specify L matrix in L
argument (see details). For Ridge and second-order difference penalty,
specification for arguments L and Q will be ignored. Default is
`RIDGE`

.

L.user

penalty matrix. Need to be specified with
`pentype='USER'`

. Number of columns need to be equal with number of
columns of matrix specified to `funcs`

. Each row represents a
constraint on functional predictor. This argument will be ignored when
value of `pentype`

is other than `USER`

.

Q

Q matrix to derive decomposition based penalty. Need to be
specified with `pentype='DECOMP'`

. Number of columns need to be equal
with number of columns of matrix specified to `funcs`

. Each row
represents a basis function where functional predictor is expected lie
according to prior belief. This argument will be ignored when value of
`pentype`

is other than `DECOMP`

.

phia

Scalar value of a in decomposition based penalty. Need to be
specified with `pentype='DECOMP'`

.

se

logical; calculate standard error when `TRUE`

.

...

additional arguments passed to the `lme`

function.

a list containing:

result of the call to `lme`

predicted outcomes

estimates with standard error for regression function

estimates of regression function

standard error associated with
`GammaHat`

AIC value of fit (smaller is better)

BIC value of fit (smaller is better)

(restricted) log-likelihood at convergence

estimates of smoothing parameter

number of subjects

number of Sampling points in functional predictor

estimated within-group error standard deviation.

If there are any missing or infinite values in `Y`

, and `funcs`

,
the corresponding row (or observation) will be dropped. Neither `Q`

nor `L`

may contain missing or infinite values.

`peer_old()`

fits the following model:

\(y_i=\int {W_i(s)\gamma(s) ds} + \epsilon_i\)

where \(\epsilon_i ~ N(0,\sigma^2)\). For all the observations, predictor function \(W_i(s)\) is evaluated at K sampling points. Here, \(\gamma (s)\) denotes the regression function.

Values of \(y_i\) and \(W_i(s)\)are passed through argument Y and
funcs, respectively. Number of elements or rows in `Y`

and
`funcs`

need to be equal.

The estimate of regression functions \(\gamma(s)\) is obtained as penalized estimated. Following 3 types of penalties can be used:

i. Ridge: \(I_K\)

ii. Second-order difference: [\(d_{i,j}\)] with \(d_{i,i} = d_{i,i+2} = 1, d_{i,i+1} = -2\), otherwise \(d_{i,i} =0\)

iii. Decomposition based penalty: \(bP_Q+a(I-P_Q)\) where \(P_Q= Q^T(QQ^T)^{-1}Q\)

For Decomposition based penalty user need to specify
`pentype='DECOMP'`

and associated Q matrix need to be passed through
`Q`

argument.

Alternatively, user can pass directly penalty matrix through argument L.
For this user need to specify `pentype='USER'`

and associated L matrix
need to be passed through `L`

argument.

Default penalty is Ridge penalty and user needs to specify `RIDGE`

.
For second-order difference penalty, user needs to specify `D2`

.

Kundu, M. G., Harezlak, J., and Randolph, T. W. (2012). Longitudinal functional models with structured penalties (arXiv:1211.4763 [stat.AP]).

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.

`lpeer`

, `plot.peer`

# NOT RUN { # } # NOT RUN { #------------------------------------------------------------------------ # Example 1: Estimation with D2 penalty #------------------------------------------------------------------------ ## Load Data data(DTI) ## Extract values for arguments for peer() from given data cca = DTI$cca[which(DTI$case == 1),] DTI = DTI[which(DTI$case == 1),] ##1.1 Fit the model fit.cca.peer1 = peer(Y=DTI$pasat, funcs = cca, pentype='D2', se=TRUE) plot(fit.cca.peer1) #------------------------------------------------------------------------ # Example 2: Estimation with structured penalty (need structural # information about regression function or predictor function) #------------------------------------------------------------------------ ## Load Data data(PEER.Sim) ## Extract values for arguments for peer() from given data PEER.Sim1<- subset(PEER.Sim, t==0) W<- PEER.Sim1$W Y<- PEER.Sim1$Y ##Load Q matrix containing structural information data(Q) ##2.1 Fit the model Fit1<- peer(Y=Y, funcs=W, pentype='Decomp', Q=Q, se=TRUE) plot(Fit1) # } # NOT RUN { # }