corByColumns | R Documentation |
Correlate each column of 1 matrix with the same column in another matrix
corByColumns(x, y)
corByColumns_mask(x, y, mask)
corStatsByColumns(x, y)
x , y |
Matrices whose values to correlate by column. |
mask |
Logical matrix marking which data points to include. |
The primary use for these functions is to rapidly compute the correlations between two sets of split-half scores stored in matrix columns.
corStatsByColumns
produces the mean correlation of all column-pairs
using the formula mean(covariances) / sqrt(mean(col1variance) * mean(col2variance))
This method is more accurate than cormean()
and was suggested by
prof. John Christie of Dalhousie University.
corByColumns()
and corByColumns_mask()
return
a numeric vector of correlations of each pair of columns.
corStatsByColumns()
returns a list with named items:
cormean: the aggregated correlation coefficient of all column pairs (see Details)
allcors: the correlations of each column pair
xvar: the column variances of matrix x
yvar: the column variances of matrix y
covar: the covariances of each column pair
Sercan Kahveci
m1<-matrix((1:9)+rnorm(9),ncol=3)
m2<-matrix((9:1)+rnorm(9),ncol=3)
corByColumns(m1,m2)
mask<-1-diag(3)
corByColumns_mask(m1,m2,mask)
corStatsByColumns(m1,m2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.