Learn R Programming

fda.usc (version 0.9.4)

pc.cor: Correlation for functional data by Principal Component Analysis

Description

Compute correlation principal components of functional data and scalar response y.

Usage

pc.cor(out,y=NULL,l=NULL,draw=TRUE,...)

Arguments

out
If out is fregre.pc object is calculated correlations between principal components and scalar response y. If out are functional data the principal components are calculated by pc.svd.fdata
y
Scalar Response
l
Vector of index of principal comoponents.
draw
=TRUE draw correlations.
...
Further arguments passed to or from other methods.

Value

  • If draw=TRUE are drawn the correlations between the principal components and response y. If ask=TRUE, draw each graph in a window, waiting to confirm the change of page with a click of the mouse or pressing ENTER. If ask=FALSE draw graphs in one window.
  • corReturn correlation between each principal component selected by l and scalar response y.

References

Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988). The New S Language. Wadsworth & Brooks/Cole. Venables, W. N. and B. D. Ripley (2002). Modern Applied Statistics with S. Springer-Verlag.

See Also

See Also as pc.fdata and cor

Examples

Run this code
library(e1071)
n=500
t=seq(0,1,len=101)
beta=t*sin(2*pi*t)^2 # beta con 2 colinas
x=matrix(NA,ncol=101,nrow=n)
y=numeric(n)
for(i in 1:n){
	x[i, ]=rwiener(1,101)*3+rnorm(101,sd=0.1)
	y[i]=mean(x[i,]*beta)+ rnorm(1,sd=0.1)
}
x<-fdata(x)
# Correlation
pc.cor(x,y,c(1,4,5.8),ask=TRUE)

Run the code above in your browser using DataLab