fccaXX: Canonical correlation analysis between two groups of mixed...

Description Usage Arguments Details Value Examples

Description

This function carries out the canonical correlation analysis between two groups of mixed functional and scalar variables. Three different representing methods can be used for the functional coefficients. The tuning parameters should be specified in the arguments control1 and control2 for the two groups xL1 and xL2, respectively.

Usage

1
2
fccaXX(xL1,xL2,centre=TRUE,method=c('basis','gq','raw'),control1=list(),
       control2=list(),tol=1e-7)

Arguments

xL1

The mixed scalar and functional variables. For any number and any type of variables, xL1 should be a list. Each item of the list should correspond to one variable.

xL2

Same as xL1.

centre

Logic argument. Default is TRUE, which means the variables do need to be centred.

method

The representative methods for the functional coefficients. The method could be one of the 'basis', 'gq' and 'raw' for basis function expression, Gaussian quadrature and representative data points, respectively.

control1

List of elements that controls the details of the functional coefficients for xL1. See details for more information. See the argument control in function fccaGen for details.

control2

Similar to control1.

tol

The threshold to decide whether the correlation is to small to be non-zero.

Details

This function uses Moore-Penrose generalized inverse in the calculation to avoid sigular problem.

Value

corr

All the non-zero canonical correlation.

coef1

The corresponding coefficients (weights) for the xL1.

coef2

The corresponding coefficients (weights) for the xL2.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# library(flars)
# library(fda)
## Generate some data sets.
# dataL1=data_generation(seed = 1,uncorr = FALSE,nVar = 8,nsamples = 120,
#       var_type = 'm',cor_type = 1)
# dataL1=dataL1$x

# dataL2=data_generation(seed = 2,uncorr = FALSE,nVar = 8,nsamples = 120,
#       var_type = 'm',cor_type = 1)
# dataL2=dataL2$x

## cross validation
# outCV=fccaXXcv(xL1 = dataL1[1:2], xL2 = dataL2[1:2], method = 'basis'
#      ,alpha = 10^seq(-6,0,len=5))

# cvCor=outCV$cor  
# calculate the correlation
# out=fccaXX(dataL1, dataL2, method = 'basis',control1 = list(pen1=
#      outCV$alpha[which.max(cvCor)]),control2 = list(pen1=
#      outCV$alpha[which.max(cvCor)]))

flars documentation built on May 2, 2019, 7:25 a.m.