R/SubsetFPCA.R

Defines functions SubsetFPCA

### subset the FPCA object with a specified number of components K
### and return the subsetted fpcaObj

SubsetFPCA <- function(fpcaObj, K){
  fpcaObj$lambda <- fpcaObj$lambda[1:K]
  fpcaObj$phi <- fpcaObj$phi[,1:K, drop=FALSE]
  fpcaObj$xiEst <- fpcaObj$xiEst[,1:K, drop=FALSE]
  fpcaObj$FVE <- fpcaObj$cumFVE[K]
  fpcaObj$cumFVE <- fpcaObj$cumFVE[1:K]
  return(fpcaObj)
}

Try the fdapace package in your browser

Any scripts or data that you put into this service are public.

fdapace documentation built on Aug. 16, 2022, 5:10 p.m.