KFPCA {KFPCA}R Documentation

Kendall Functional Principal Component Analysis (KFPCA) for sparse design

Description

KFPCA for non-Gaussian functional data with sparse design or longitudinal data.

Usage

KFPCA(
  Lt,
  Ly,
  interval,
  dataType = "Sparse",
  nK,
  kern = "epan",
  bw,
  kernK = "epan",
  bwK = "GCV",
  kernmean = "epan",
  bwmean = "GCV",
  nRegGrid,
  fdParobj,
  more = TRUE
)

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.

interval

A vector of length two denoting the supporting interval.

dataType

A character denoting the data type; 'Sparse'-default, 'Dense'.

nK

An integer denoting the number of FPCs.

kern

A character denoting the kernel type for the Nadaraya-Watson estimators; 'epan'(Epanechnikov)-default, 'unif'(Uniform), 'quar'(Quartic), 'gauss'(Gaussian).

bw

A scalar denoting the bandwidth for the Nadaraya-Watson estimators.

kernK

A character denoting the kernel type for the estimation of the Kendall's tau function; 'epan'(Epanechnikov)-default, 'unif'(Uniform), 'quar'(Quartic), 'gauss'(Gaussian).

bwK

The bandwidth for the estimation of the Kendall's tau function. If is.numeric(bwK) == T, bwK is exactly the bandwidth. If bwK == "GCV", the bandwidth is chosen by GCV. (default: "GCV")

kernmean

A character denoting the kernel type for the estimation of the mean function; 'epan'(Epanechnikov)-default, 'unif'(Uniform), 'quar'(Quartic), 'gauss'(Gaussian).

bwmean

The bandwidth for the estimation of the mean function. If is.numeric(bwmean) == T, bwmean is exactly the bandwidth. If bwmean == "GCV", the bandwidth is chosen by GCV. (default: "GCV")

nRegGrid

An integer denoting the number of equally spaced time points in the supporting interval. The eigenfunctions and mean function are estimated at these equally spaced time points.

fdParobj

A functional parameter object for the smoothing of the eigenfunctions. For more detail, see smooth.basis.

more

Logical; If FALSE, estimates of FPC scores and predictions of trajectories are not returned.

Value

A list containing the following components:

ObsGrid

A vector containing all observation time points in ascending order.

RegGrid

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

bwmean

A scalar denoting the bandwidth for the mean function estimate.

kernmean

A character denoting the kernel type for the estimation of the mean function

bwK

A scalar denoting the bandwidth for the Kendall's tau function estimate.

kernK

A character denoting the kernel type for the estimation of the Kendall's tau function

mean

A vector of length nRegGrid denoting the mean function estimate.

KendFun

A nRegGrid by nRegGrid matrix denoting the Kendall's tau function estimate.

FPC_dis

A nRegGrid by nK matrix containing the eigenfunction estimates at RegGrid.

FPC_smooth

A functional data object for the eigenfunction estimates.

score

A n by nK matrix containing the estimates of the FPC scores, where n is the sample size. The results are returned when more = TRUE.

X_fd

A functional data object for the prediction of trajectories. The results are returned when more = TRUE.

Xest_ind

A list containing the prediction of each trajectory at their own observation time points. The results are returned when more = TRUE.

Lt

The input 'Lt'.

Ly

The input 'Ly'.

CompTime

A scalar denoting the computation time.

References

Rou Zhong, Shishi Liu, Haocheng Li, Jingxiao Zhang (2021). "Robust Functional Principal Component Analysis for Non-Gaussian Longitudinal Data." Journal of Multivariate Analysis, https://doi.org/10.1016/j.jmva.2021.104864.

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 = 6:8, regular = FALSE,
                     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))
# KFPCA
Klist <- KFPCA(DataNew$Lt, DataNew$Ly, interval, nK = 2, bw = 1,
               nRegGrid = 51, fdParobj = basis)
plot(Klist$FPC_smooth)

[Package KFPCA version 2.0 Index]