Learn R Programming

refund (version 0.1-1)

peer: Functional Models with Structured Penalties

Description

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

Usage

peer(Y, funcs, pentype='Ridge', L.user=NULL, Q=NULL, phia=10^3, se=FALSE, ...)

Arguments

Y
vector of all outcomes
funcs
matrix containing observed functional predictors as rows. Rows with NA and Inf values will be deleted.
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 ne
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 ign
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 functi
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.

Value

  • a list containing:
  • fitresult of the call to lme
  • fitted.valspredicted outcomes
  • Gammaestimates with standard error for regression function
  • GammaHatestimates of regression function
  • se.Gammastandard error associated with GammaHat
  • AICAIC value of fit (smaller is better)
  • BICBIC value of fit (smaller is better)
  • logLik(restricted) log-likelihood at convergence
  • lambdaestimates of smoothing parameter
  • Nnumber of subjects
  • Knumber of Sampling points in functional predictor
  • sigmaestimated within-group error standard deviation.

Details

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() 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.

References

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.

See Also

lpeer, plot.peer

Examples

Run this code
#------------------------------------------------------------------------
# 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)
K<- 100
W<- PEER.Sim1[,c(3:(K+2))]
Y<- PEER.Sim1[,K+3]

##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)

Run the code above in your browser using DataLab