Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

cca.fd

Functional Canonical Correlation Analysis


Description

Carry out a functional canonical correlation analysis with regularization or roughness penalties on the estimated canonical variables.

Usage

cca.fd(fdobj1, fdobj2=fdobj1, ncan = 2,
       ccafdPar1=fdPar(basisobj1, 2, 1e-10),
       ccafdPar2=ccafdPar1, centerfns=TRUE)

Arguments

fdobj1

a functional data object.

fdobj2

a functional data object. By default this is fdobj1 , in which case the first argument must be a bivariate functional data object.

ncan

the number of canonical variables and weight functions to be computed. The default is 2.

ccafdPar1

a functional parameter object defining the first set of canonical weight functions. The object may contain specifications for a roughness penalty. The default is defined using the same basis as that used for fdobj1 with a slight penalty on its second derivative.

ccafdPar2

a functional parameter object defining the second set of canonical weight functions. The object may contain specifications for a roughness penalty. The default is ccafdParobj1 .

centerfns

if TRUE, the functions are centered prior to analysis. This is the default.

Value

an object of class cca.fd with the 5 slots:

ccwtfd1

a functional data object for the first canonical variate weight function

ccwtfd2

a functional data object for the second canonical variate weight function

cancorr

a vector of canonical correlations

ccavar1

a matrix of scores on the first canonical variable.

ccavar2

a matrix of scores on the second canonical variable.

See Also

Examples

#  Canonical correlation analysis of knee-hip curves

gaittime  <- (1:20)/21
gaitrange <- c(0,1)
gaitbasis <- create.fourier.basis(gaitrange,21)
lambda    <- 10^(-11.5)
harmaccelLfd <- vec2Lfd(c(0, 0, (2*pi)^2, 0))

gaitfdPar <- fdPar(gaitbasis, harmaccelLfd, lambda)
gaitfd <- smooth.basis(gaittime, gait, gaitfdPar)$fd

ccafdPar <- fdPar(gaitfd, harmaccelLfd, 1e-8)
ccafd0    <- cca.fd(gaitfd[,1], gaitfd[,2], ncan=3, ccafdPar, ccafdPar)
#  display the canonical correlations
round(ccafd0$ccacorr[1:6],3)
#  compute a VARIMAX rotation of the canonical variables
ccafd <- varmx.cca.fd(ccafd0)
#  plot the canonical weight functions
plot.cca.fd(ccafd)

fda

Functional Data Analysis

v5.1.9
GPL (>= 2)
Authors
J. O. Ramsay <ramsay@psych.mcgill.ca> [aut,cre], Spencer Graves <spencer.graves@effectivedefense.org> [ctb], Giles Hooker <gjh27@cornell.edu> [ctb]
Initial release
2020-12-16

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.