Last chance! 50% off unlimited learning
Sale ends in
CCorA(Y, X, stand.Y=FALSE, stand.X=FALSE, permutations = 0, ...)## S3 method for class 'CCorA':
biplot(x, plot.type="ov", xlabs, plot.axes = 1:2, int=0.5,
col.Y="red", col.X="blue", cex=c(0.7,0.9), ...)
matrix
or data.frame
).matrix
or data.frame
).Y
be standardized?X
be standardized?how
, or the
number of permutations required, or a permutation matrix where each
row gives the permuted indices.CCoaR
result object."objects"
, "variables"
, "ov"
(separate graphs for objects and variables), or "biplots"
. Any
unambiguous subseNULL
uses row numbers instead, and NA
suppresses plotting row names
completely.int=0.5
. With int=0
,
no inner circle is plotted.cex=c(0.7,0.9)
.biplot.CCorA
passes graphical arguments to biplot
and biplot.default
. CCorA
returns a list containing the following elements:Y
and X
.RDA.Rsquares
adjusted for n
and the number
of explanatory variables.how
.Y
that are maximally
correlated to linear combinations of the variables of X
. The
analysis estimates the relationships and displays them in graphs.
Pillai's trace statistic is computed and tested parametrically (F-test);
a permutation test is also available. Algorithmic note --
The blunt approach would be to read the two matrices, compute the
covariance matrices, then the matrix
S12 %*% inv(S22) %*% t(S12) %*% inv(S11)
.
Its trace is Pillai's trace statistic.
This approach may fail, however, when there is heavy multicollinearity
in very sparse data matrices. The safe approach is to replace all data
matrices by their PCA object scores.
The function can produce different types of plots depending on the option
chosen:
"objects"
produces two plots of the objects, one in the space
of Y, the second in the space of X;
"variables"
produces two plots of the variables, one of the variables
of Y in the space of Y, the second of the variables of X in the space of X;
"ov"
produces four plots, two of the objects and two of the variables;
"biplots"
produces two biplots, one for the first matrix (Y) and
one for second matrix (X) solutions. For biplots, the function passes all arguments
to biplot.default
; consult its help page for configuring biplots.
# Example using two mite groups. The mite data are available in vegan
data(mite)
# Two mite species associations (Legendre 2005, Fig. 4)
group.1 <- c(1,2,4:8,10:15,17,19:22,24,26:30)
group.2 <- c(3,9,16,18,23,25,31:35)
# Separate Hellinger transformations of the two groups of species
mite.hel.1 <- decostand(mite[,group.1], "hel")
mite.hel.2 <- decostand(mite[,group.2], "hel")
rownames(mite.hel.1) = paste("S",1:nrow(mite),sep="")
rownames(mite.hel.2) = paste("S",1:nrow(mite),sep="")
out <- CCorA(mite.hel.1, mite.hel.2)
out
biplot(out, "ob") # Two plots of objects
biplot(out, "v", cex=c(0.7,0.6)) # Two plots of variables
biplot(out, "ov", cex=c(0.7,0.6)) # Four plots (2 for objects, 2 for variables)
biplot(out, "b", cex=c(0.7,0.6)) # Two biplots
biplot(out, xlabs = NA, plot.axes = c(3,5)) # Plot axes 3, 5. No object names
biplot(out, plot.type="biplots", xlabs = NULL) # Replace object names by numbers
# Example using random numbers. No significant relationship is expected
mat1 <- matrix(rnorm(60),20,3)
mat2 <- matrix(rnorm(100),20,5)
out2 = CCorA(mat1, mat2, permutations=99)
out2
biplot(out2, "b")
Run the code above in your browser using DataLab