FPCA_trajectory {longke}R Documentation

FPCA_trajectory

Description

Function used to perform functional principal component analysis (FPCA) for a single functional variable

Usage

FPCA_trajectory(data,...)

Arguments

data

A long format data matrix containing 3 columns ordered by time, subject ID, variable where the measurement time of the longitudinal data should be discretized

...

Arguments to be passed to fdapace::FPCA

Value

A list containing two elements

fpca_target

A FPCA object

target_fit

A num.t x num.sub matrix containing the imputated longitudinal trajectories where num.t is the total number of the discrete measurement time and num.sub is the total number of subjects

References

Carroll, C., Gajardo, A., Chen, Y., Dai, X., Fan, J., Hadjipantelis, P. Z., ... & Wang, J. L. (2020). fdapace: Functional data analysis and empirical dynamics. R package version 0.5, 4.

Yao, F., Müller, H. G., & Wang, J. L. (2005). Functional data analysis for sparse longitudinal data. Journal of the American statistical association, 100(470), 577-590.

Examples

t_all = 1:50
data = datagen(ntotal=350,ntest=50,t_all=t_all,t_split=25,seed=1)
data.sample = data$test[,c(1,2,3)]
# In this case, num.t=50 and num.sub=50 since we only used 50 subjects in the testing data
data.FPCA = FPCA_trajectory(data.sample,list(dataType='Sparse',
                error=FALSE, kernel='gauss', verbose=FALSE, nRegGrid=length(t_all)))
data.FPCA$target_fit


[Package longke version 0.1.0 Index]