uni.fpca: Functional Principle Component Analysis with Corpula

Description Usage Arguments Details Value References Examples

View source: R/Package_HAC_RAC_SHAC.r

Description

uni.fpca is used to do regular FPCA for univariate data with given covariance matrix. The sample covariance matrix will be used if covariance matrix is not given.

Usage

1
2
3
uni.fpca(Y, Kendall = NULL, Y.pred = NULL, 
         nbasis.mean = 10, nbasis = 10, pve = 0.99, npc = NULL, 
         center = TRUE, gam.method = "REML")

Arguments

Y

matrix for the fully observed curves; each row corresponds to one subject

Kendall

given covariance matrix for Y (raw matrix up to smoothing); typically obtained using Kendall's Tau approach. See 'Details'

Y.pred

partically observed curves to be predicted; default is null indicating no predication on new data set

nbasis.mean

number of basis functions to smooth the mean

nbasis

number of basis functions for each direction to smooth the covariance matrix

pve

threshold of the percentage of variance explained to select number of principal components

npc

prespecified value for the number of principal components to be included in the expansion (if given, this overrides 'pve').

center

if TRUE, we center the curves; otherwise, do not center the curves and assume the curves have mean 0 already

gam.method

estimation method when using gam

Details

This function is build in the spirit of the function fpca.sc in the package refund, but here the corpula plays a role. The covariance matrix Kendall is typically estimated before the application of this function, for instance, via Kendall's Tau approach. It is highly recommended that the Knedall's Tau covariance matris should be provided here since it is more stable.

Value

A list of the following components:

Yhat

matrix whose rows are the estimates through Functional FPCA of the curves in Y

scores

matrix of estimated principal component scores

mu

estimated mean function

efunctions

matrix of estimated eigenfunctions of the functional covariance operator, i.e., the FPC basis functions

evalues

estimated eigenvalues of the covariance operator, i.e., variances of FPC scores

npc

number of FPCs: either the supplied npc, or the minimum number of basis functions needed to explain proportion pve of the variance in the observed curves

K.tilde

Smoothed covariance matrix of Y after removing white noises

K.hat

Smoothed covariance matrix of Y

sigma2

estimated measurement error variance

References

[1]. Yao, F., Mueller, H.-G., and Wang, J.-L. (2005). Functional data analysis for sparse longitudinal data. Journal of the American Statistical Association, 100(470):577-590.

[2]. Goldsmith, J., Greven, S., and Crainiceanu, C. (2013). Corrected confidence bands for functional data using principal components. Biometrics, 69(1), 41-51.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
data(data.simulation)
fpca <- uni.fpca(Y = DST$obs, Y.pred=DSV$obs)

# visualize the data and predicted surface
par(mfrow = c(1,2))
persp(DSV$cp, DSV$tp, DSV$obs, theta=60, phi=15,
      ticktype = "detailed", col="lightblue", 
      xlab = "covariate", ylab = "time",
      zlab="data", main="data surface (partically observed)")
persp(DSV$cp, DSV$tp, fpca$Yhat, theta=60, phi=15,
      ticktype = "detailed", col="lightblue", 
      xlab = "covariate", ylab = "time",
      zlab="data", main="predicted surface via univariate FPCA")

# predication error
mean(((fpca$Yhat - DSV$obs.full)[!is.na(DSV$obs)])^2)

cSFM documentation built on May 29, 2017, 6:10 p.m.

Related to uni.fpca in cSFM...