Description Usage Arguments Details Value References Examples
View source: R/Package_HAC_RAC_SHAC.r
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.
1 2 3 |
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 |
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 |
gam.method |
estimation method when using |
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.
A list of the following components:
Yhat |
matrix whose rows are the estimates through Functional FPCA of the curves in |
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 |
K.hat |
Smoothed covariance matrix of |
sigma2 |
estimated measurement error variance |
[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.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.