Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

FPCscoreLSE

Least square estimates of functional principal component scores


Description

Least square estimates (LSE) of functional principal component scores.

Usage

FPCscoreLSE(Lt, Ly, kern, bw, FPC_dis, RegGrid, more = FALSE)

Arguments

Lt

A list of n vectors, where n is the sample size. Each entry contains the observation time in ascending order for each subject.

Ly

A list of n vectors, where n is the sample size. Each entry contains the measurements of each subject at the observation time correspond to Lt.

kern

A character denoting the kernel type; 'epan'(Epanechnikov), 'unif'(Uniform), 'quar'(Quartic), 'gauss'(Gaussian).

bw

A scalar denoting the bandwidth for mean function estimate.

FPC_dis

A nRegGrid by nK matrix containing the eigenfunction estimates at RegGrid, where nRegGrid is the length of RegGrid and nK is the number of FPCs.

RegGrid

A vector of the equally spaced time points in the support interval.

more

Logical; If FALSE, only the estimates of FPC scores are returned. If TRUE, the mean function estimates and the eigenfunction estimates at all observation time points are also returned.

Value

If more = FALSE, a n by nK matrix containing the estimates of the FPC scores is returned, where n is the sample size. If more = TRUE, a list containing the following components is returned:

score

a n by nK matrix containing the estimates of the FPC scores.

meanest_fine

Mean function estimates at all observation time points.

FPC_dis_fine

Eigenfunction estimates at all observation time points.

Examples

# Generate data
n <- 100
interval <- c(0, 10)
lambda_1 <- 9 #the first eigenvalue
lambda_2 <- 1.5 #the second eigenvalue
eigfun <- list()
eigfun[[1]] <- function(x){cos(pi * x/10)/sqrt(5)}
eigfun[[2]] <- function(x){sin(pi * x/10)/sqrt(5)}
score <- cbind(rnorm(n, 0, sqrt(lambda_1)), rnorm(n, 0, sqrt(lambda_2)))
DataNew <- GenDataKL(n, interval = interval, sparse = 3:5,
                     meanfun = function(x){0}, score = score,
                     eigfun = eigfun, sd = sqrt(0.1))
basis <- fda::create.bspline.basis(interval, nbasis = 13, norder = 4,
                              breaks = seq(0, 10, length.out = 11))
Klist <- KFPCA(DataNew$Lt, DataNew$Ly, interval, nK = 2, bw = 1,
               nRegGrid = 51, fdParobj = basis)
# Just an example to explain the use of FPCscoreLSE().
# One can obtain FPC scores estimates for KFPCA method
# by KFPCA() directly. Note that FPCscoreLSE() can also be used
# to estimate FPC scores for methods except KFPCA.
scoreKFPCA <- FPCscoreLSE(DataNew$Lt, DataNew$Ly, kern = "epan",
                          bw = Klist$bwmean, FPC_dis = Klist$FPC_dis,
                          RegGrid = seq(interval[1], interval[2], length.out = 51))

KFPCA

Kendall Functional Principal Component Analysis

v1.0
GPL (>= 3)
Authors
Rou Zhong [aut, cre]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.