# pca.fd: Functional Principal Components Analysis In fda: Functional Data Analysis

 pca.fd R Documentation

## Functional Principal Components Analysis

### Description

Functional Principal components analysis aims to display types of variation across a sample of functions. Principal components analysis is an exploratory data analysis that tends to be an early part of many projects. These modes of variation are called \$principal components\$ or \$harmonics.\$ This function computes these harmonics, the eigenvalues that indicate how important each mode of variation, and harmonic scores for individual functions. If the functions are multivariate, these harmonics are combined into a composite function that summarizes joint variation among the several functions that make up a multivariate functional observation.

### Usage

``````pca.fd(fdobj, nharm = 2, harmfdPar=fdPar(fdobj),
centerfns = TRUE)
``````

### Arguments

 `fdobj` a functional data object. `nharm` the number of harmonics or principal components to compute. `harmfdPar` a functional parameter object that defines the harmonic or principal component functions to be estimated. `centerfns` a logical value: if TRUE, subtract the mean function from each function before computing principal components.

### Value

an object of class "pca.fd" with these named entries:

 `harmonics` a functional data object for the harmonics or eigenfunctions `values` the complete set of eigenvalues `scores` s matrix of scores on the principal components or harmonics `varprop` a vector giving the proportion of variance explained by each eigenfunction `meanfd` a functional data object giving the mean function

### References

Ramsay, James O., Hooker, Giles, and Graves, Spencer (2009), Functional data analysis with R and Matlab, Springer, New York.

Ramsay, James O., and Silverman, Bernard W. (2005), Functional Data Analysis, 2nd ed., Springer, New York.

Ramsay, James O., and Silverman, Bernard W. (2002), Applied Functional Data Analysis, Springer, New York.

`cca.fd`, `pda.fd`

### Examples

``````oldpar <- par(no.readonly=TRUE)
#  carry out a PCA of temperature
#  penalize harmonic acceleration, use varimax rotation

daybasis65 <- create.fourier.basis(c(0, 365), nbasis=65, period=365)
nbasis <-65
harmaccelLfd <- vec2Lfd(c(0,(2*pi/365)^2,0), c(0, 365))
harmfdPar    <- fdPar(fd(matrix(0,nbasis,1), daybasis65), harmaccelLfd,
lambda=1e5)
daybasis65, fdnames=list("Day", "Station", "Deg C"))\$fd

daytemppcaobj <- pca.fd(daytempfd, nharm=4, harmfdPar)
daytemppcaVarmx <- varmx.pca.fd(daytemppcaobj)
#  plot harmonics
op <- par(mfrow=c(2,2))
plot.pca.fd(daytemppcaobj, cex.main=0.9)

plot.pca.fd(daytemppcaVarmx, cex.main=0.9)
par(op)

plot(daytemppcaobj\$harmonics)
plot(daytemppcaVarmx\$harmonics)
par(oldpar)
``````

fda documentation built on May 29, 2024, 11:26 a.m.