PACE | R Documentation |
This function calculates a univariate functional principal components
analysis by smoothed covariance based on code from
fpca.sc
in package refund.
PACE( funDataObject, predData = NULL, nbasis = 10, pve = 0.99, npc = NULL, makePD = FALSE, cov.weight.type = "none" )
funDataObject |
An object of class |
predData |
An object of class |
nbasis |
An integer, representing the number of B-spline basis
functions used for estimation of the mean function and bivariate smoothing
of the covariance surface. Defaults to |
pve |
A numeric value between 0 and 1, the proportion of variance
explained: used to choose the number of principal components. Defaults to
|
npc |
An integer, giving a prespecified value for the number of
principal components. Defaults to |
makePD |
Logical: should positive definiteness be enforced for the
covariance surface estimate? Defaults to |
cov.weight.type |
The type of weighting used for the smooth covariance
estimate. Defaults to |
mu |
A |
values |
A vector containing the estimated eigenvalues. |
functions |
A
|
scores |
An matrix of estimated scores for the
observations in |
fit |
A |
npc |
The number of functional
principal components: either the supplied |
sigma2 |
The estimated measurement error variance (cf.
|
estVar |
The estimated smooth variance function of the data. |
This function works only for univariate functional data observed on one-dimensional domains.
funData
,
fpcaBasis
, univDecomp
oldPar <- par(no.readonly = TRUE) # simulate data sim <- simFunData(argvals = seq(-1,1,0.01), M = 5, eFunType = "Poly", eValType = "exponential", N = 100) # calculate univariate FPCA pca <- PACE(sim$simData, npc = 5) # Plot the results par(mfrow = c(1,2)) plot(sim$trueFuns, lwd = 2, main = "Eigenfunctions") # flip estimated functions for correct signs plot(flipFuns(sim$trueFuns,pca$functions), lty = 2, add = TRUE) legend("bottomright", c("True", "Estimate"), lwd = c(2,1), lty = c(1,2)) plot(sim$simData, lwd = 2, main = "Some Observations", obs = 1:7) plot(pca$fit, lty = 2, obs = 1:7, add = TRUE) # estimates are almost equal to true values legend("bottomright", c("True", "Estimate"), lwd = c(2,1), lty = c(1,2)) par(oldPar)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.