Learn R Programming

fdapace (version 0.6.0)

FOptDes: Optimal Designs for Functional and Longitudinal Data for Trajectory Recovery or Scalar Response Prediction

Description

Optimal Designs for Functional and Longitudinal Data for Trajectory Recovery or Scalar Response Prediction

Usage

FOptDes(
  Ly,
  Lt,
  Resp,
  p = 3,
  optns = list(),
  isRegression = !missing(Resp),
  isSequential = FALSE,
  RidgeCand = NULL
)

Value

A list containing the following fields:

OptDes

The vector of optimal design points of the regular time grid of the observed data.

R2

Coefficient of determination. (Check the paper for details.)

R2adj

Adjusted coefficient of determination.

OptRidge

The selected ridge parameter.

Arguments

Ly

A list of n vectors containing the observed values for each individual. Missing values specified by NAs are supported for dense case (dataType='dense').

Lt

A list of n vectors containing the observation time points for each individual corresponding to y. Each vector should be sorted in ascending order.

Resp

A vector of response values, keep void for trajectory recovery, only necessary for scalar response prediction task.

p

A fixed positive integer indicating the number of optimal design points requested, with default: 3.

optns

A list of options control parameters specified by list(name=value) for FPCA, with default: list().

isRegression

A logical argument, indicating the purpose of the optimal designs: TRUE for scalar response prediction, FALSE for trajectory recovery, with default value !missing(Resp).

isSequential

A logical argument, indicating whether to use the sequential optimization procedure for faster computation, recommended for relatively large p (default: FALSE).

RidgeCand

A vector of positive numbers as ridge penalty candidates for regularization. The final value is selected via cross validation. If only 1 ridge parameter is specified, CV procedure is skipped.

Details

To select a proper RidgeCand, check with the returned optimal ridge parameter. If the selected parameter is the maximum/minimum values in the candidates, it is possible that the selected one is too small/big.

References

Ji, H., Müller, H.G. (2017) "Optimal Designs for Longitudinal and Functional Data" Journal of the Royal Statistical Society: Series B 79, 859-876.

Examples

Run this code
set.seed(1)
n <- 50
pts <- seq(0, 1, by=0.05)
sampWiener <- Wiener(n, pts)
sampWiener <- MakeFPCAInputs(IDs = rep(1:n, each=length(pts)), 
                             tVec = rep(pts, times = n), 
                             yVec = t(sampWiener))
res <- FOptDes(Ly=sampWiener$Ly, Lt=sampWiener$Lt, p=2,
               isSequential=FALSE, RidgeCand = seq(0.02,0.2,0.02))

Run the code above in your browser using DataLab