Version: | 0.2 |
Date: | 2022-01-28 |
Title: | A Canonical Correlation Analysis with Inferential Guaranties |
Author: | Livio Finos |
Maintainer: | livio finos <livio.finos@unipd.it> |
Description: | It performs Canonical Correlation Analysis and provides inferential guaranties on the correlation components. The p-values are computed following the resampling method developed in Winkler, A. M., Renaud, O., Smith, S. M., & Nichols, T. E. (2020). Permutation inference for canonical correlation analysis. NeuroImage, <doi:10.1016/j.neuroimage.2020.117065>. Furthermore, it provides plotting tools to visualize the results. |
Encoding: | UTF-8 |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
RoxygenNote: | 7.1.2 |
Imports: | methods, stats, ggplot2, plyr |
NeedsCompilation: | no |
Packaged: | 2022-01-28 07:56:02 UTC; livio |
Repository: | CRAN |
Date/Publication: | 2022-01-28 08:10:02 UTC |
A Canonical Correlation Analysis with Inferential Guaranties
Description
It performs Canonical Correlation Analysis and provides inferential guaranties on the correlation components. The p-values are computed following the resampling method developed in Winkler, A. M., Renaud, O., Smith, S. M., & Nichols, T. E. (2020). Permutation inference for canonical correlation analysis. NeuroImage, <doi:10.1016/j.neuroimage.2020.117065>. Furthermore, it provides plotting tools to visualize the results.
Author(s)
Livio Finos
Examples
set.seed(1)
X=matrix(rnorm(500),100,5)
Y=matrix(rnorm(700),100,7)
Z=matrix(rnorm(200),100,2)
mod=cc(X,Y,Z)
mod
ccbiplot(mod)
mod=cc_inference(mod, B = 100, numb_cc = 3)
mod
Methods for acca objects
Description
Methods for acca
objects.
The following are methods to extract and manipulate relevant information from
a acca
object.
Usage
## S3 method for class 'acca'
print(x, ...)
## S3 method for class 'acca'
summary(object, ...)
Arguments
x |
an |
... |
additional arguments to be passed |
object |
an |
cc
Description
Very similar cancor()
of package stats
, but 1) it allows for X and Y to be rank deficient, 2) it allows for categorical variables and 3) it allows for covariates, 4) more (see below).
Usage
cc(X, Y, Zx = NULL, Zy = Zx, numb_cc = NULL, fill.na = FALSE)
Arguments
X |
See |
Y |
See |
Zx |
( |
Zy |
( |
numb_cc |
number of (pairs of) canonical correlations to be extracted |
fill.na |
replace |
Value
It returns an acca
object. This object contains the same list as returned by cc
, while it also contains prop_expl_var
which is a list
reporting the proportion of explained (total) variance of X
and Y
by each component (i.e. mode).
L=matrix(rnorm(10),10,1) X=matrix(rnorm(50),10,5) Y=matrix(rnorm(70),10,7) Z=matrix(rnorm(20),10,2)
X[,1]=X[,1]+2*L Y[,1]=Y[,1]+2*L mod=cc(X,Y,Z) mod
ccbiplot(mod)
cc_inference
Description
For each pairs of components, it computes p-values to test the null hypothesis of no correlation between components. The p-values are computed following the resampling method developed in Winkler, A. M., Renaud, O., Smith, S. M., & Nichols, T. E. (2020). Permutation inference for canonical correlation analysis. NeuroImage, 220, 117065. https://doi.org/10.1016/j.neuroimage.2020.117065.
Usage
cc_inference(
mod,
B = 100,
alpha_max = 0.5,
numb_cc = NULL,
resamp_type = "sign-flip",
light = FALSE
)
Arguments
mod |
an |
B |
( |
alpha_max |
stop if p-value > alpha_max ( |
numb_cc |
stop after computing p-values for the first |
resamp_type |
|
light |
If |
Value
It returns an acca
object (see cc
) with p-values for each pair of the numb_cc
components.
Examples
set.seed(1)
X=matrix(rnorm(500),100,5)
Y=matrix(rnorm(700),100,7)
Z=matrix(rnorm(200),100,2)
mod=cc(X,Y,Z)
mod
ccbiplot(mod)
mod=cc_inference(mod, B = 100, numb_cc = 3)
mod
ccbiplot
Description
The function adapts the ggbiplot::ggbiplot()
function to an acca
-object.
Usage
ccbiplot(
pcobj,
choices = 1:2,
scale = 1,
pc.biplot = TRUE,
obs.scale = 1 - scale,
var.scale = scale,
groups = NULL,
shapes = NULL,
ellipse = FALSE,
ellipse.prob = 0.68,
labels = NULL,
labels.size = 3,
alpha = 1,
var.axes = TRUE,
circle = FALSE,
circle.prob = 0.69,
varname.size = 3,
varname.adjust = 1.5,
varname.abbrev = FALSE,
arrows.color = NULL,
...
)
Arguments
pcobj |
an object returned by acca:cc() |
choices |
which PCs to plot |
scale |
covariance biplot (scale = 1), form biplot (scale = 0). When scale = 1, the inner product between the variables approximates the covariance and the distance between the points approximates the Mahalanobis distance. |
pc.biplot |
for compatibility with biplot.princomp() |
obs.scale |
scale factor to apply to observations |
var.scale |
scale factor to apply to variables |
groups |
optional factor variable indicating the groups that the observations belong to. If provided the points will be colored according to groups |
shapes |
which shapes to use when plotting observations |
ellipse |
draw a normal data ellipse for each group? |
ellipse.prob |
size of the ellipse in Normal probability |
labels |
optional vector of labels for the observations |
labels.size |
size of the text used for the labels |
alpha |
alpha transparency value for the points (0 = transparent, 1 = opaque) |
var.axes |
draw arrows for the variables? |
circle |
draw a correlation circle? |
circle.prob |
size of the circle in qchisq(circle.prob, df = 2) |
varname.size |
size of the text for variable names |
varname.adjust |
adjustment factor the placement of the variable names, >= 1 means farther from the arrow |
varname.abbrev |
whether or not to abbreviate the variable names |
arrows.color |
color of the arrows |
... |
not used yet |
Value
It returns a ggplot
object.