Last data update: 2014.03.03

R: Functional Principal Component Analysis
fpcaR Documentation

Functional Principal Component Analysis

Description

Compute the functional PCA from a set of curves.

Usage

fpca( x, nbasisInit, propVar = 0.9, reconstruct = FALSE, 
      varName = NULL, verbose = FALSE)

Arguments

x

The set of curves.

nbasisInit

The number of initial spline coefficients.

propVar

The proportion of explained variance.

reconstruct

Should the data be reconstruct after dimension reduction ?

varName

The name of the current functional variable.

verbose

Should the details be printed.

Details

The Functional PCA is performed in two steps. First we express each discretized curves as a linear combination of ‘nbasisInit’ spline basis functions. Then a multivariate PCA is computed on the spline coefficients. The final number of principal components is chosen such that the proportion of explained variance is larger than ‘propVar’.

Value

A list with two components:

design

The matrix of the principal components ;

smoothData

The reconstructed data if ‘reconstruct == TRUE’.

Author(s)

Baptiste Gregorutti

References

Ramsay, J. O., and Silverman, B. W. (2006), Functional Data Analysis, 2nd ed., Springer, New York.

See Also

hardThresholding

Examples

  data(toyRegFD)
  x <- toyRegFD$FDlist[[1]]
  PCs <- fpca(x=x, nbasisInit=32, propVar=.9, reconstruct=TRUE)
  plot(x[1,])
  lines(PCs$smoothData[1,], col=2)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(RFgroove)
Loading required package: randomForest
randomForest 4.6-12
Type rfNews() to see new features/changes/bug fixes.
Loading required package: wmtsa
Loading required package: fda
Loading required package: splines
Loading required package: Matrix

Attaching package: 'fda'

The following object is masked from 'package:graphics':

    matplot

> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/RFgroove/fpca.Rd_%03d_medium.png", width=480, height=480)
> ### Name: fpca
> ### Title: Functional Principal Component Analysis
> ### Aliases: fpca
> 
> ### ** Examples
> 
>   data(toyRegFD)
>   x <- toyRegFD$FDlist[[1]]
>   PCs <- fpca(x=x, nbasisInit=32, propVar=.9, reconstruct=TRUE)
>   plot(x[1,])
>   lines(PCs$smoothData[1,], col=2)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>