fccaGen(xL,yVec,type=c('dir','cor','a','all'),method=c('basis', 'gq','raw'),GCV=TRUE,control=list())
xL
can be a matrix. If there is only scalar variables, xL
can be a vector or a matrix. If there are more than one functional variables, or there are mixed functional and scalar variables, xL
should be a list. If xL
is a list, each item of the list should correspond to one variable.
type='corr'
or type='all'
type='a'
or type='all'
type='dir'
type='all'
.type='all'
.type='all'
.type='all'
.type='all'
.type='all'
.type='all'
.type='all'
.type
in the function. 'dir' means that the function only returns the direction coefficients like the one in the traditional Canonical correlation analysis. 'cor' means that the function only returns the correlation coefficients. 'a' means that the function only returns the normalized direction coefficients. With this normalization, the direction coefficients are equivalent to the coefficients from a linear regression with response variable yVec
and covariates xL
. 'all' means that the function returns all three outcomes mentioned above. The argument control
is a list. It changes when different representative methods are used for the functional coefficients. If (type=='basis'), the list contains the following items:
seq(0,1,len=max(sapply(xL,ncol),na.rm = T))
. Do NOT change the starting and ending point of the sequence.
If (type=='gq'), the list contains the following items:
seq(-1,1,len=max(sapply(xL,ncol),na.rm = T))
. Do NOT change the starting and ending point of the sequence.
If (type=='raw'), the list contains the following items:
seq(0,1,len=max(sapply(xL,ncol),na.rm = T))
. Do NOT change the starting and ending point of the sequence.
The function is designed to be able to handle the situation when different functional variables have different number of discrete data points and the discrete data points could be non-evenly spaced. This would require a list of t
to input in the argument. However, this is not fully tested at the moment. For convenient, especially when we have a large number of functional variables, a universal setting of t
is recommended.
library(flars)
## Generate some data.
dataL=data_generation(seed = 1,uncorr = TRUE,nVar = 8,nsamples = 120,
var_type = 'm',cor_type = 1)
## If there is only one functional variable
# out1=fccaGen(dataL$x[1], dataL$y, type='all', method='basis')
## If there are only a few scalar variables
# x=matrix(rnorm(3*length(dataL$y)),ncol=3)
# out2=fccaGen(x, dataL$y, type='all', method='basis')
## If there are mixed scalar and functional variables
# out3=fccaGen(dataL$x, dataL$y, type='all', method='basis')
Run the code above in your browser using DataLab