powered by
Performs functional PCA and returns principal component scores for functional data. Uses SVD on centered data.
fdata2pc(fdataobj, ncomp = 2, lambda = 0, norm = TRUE)
A list with components:
Singular values (proportional to sqrt of eigenvalues)
fdata object containing PC loadings
Matrix of PC scores (n x ncomp)
Mean function (numeric vector)
Centered fdata object
The function call
An object of class 'fdata'.
Number of principal components to extract (default 2).
Regularization parameter (default 0, not currently used).
Logical. If TRUE (default), normalize the scores.
t <- seq(0, 1, length.out = 50) X <- matrix(0, 20, 50) for (i in 1:20) X[i, ] <- sin(2*pi*t) + rnorm(50, sd = 0.1) fd <- fdata(X, argvals = t) pc <- fdata2pc(fd, ncomp = 3)
Run the code above in your browser using DataLab