Skip to content

how to compute uncentered (pearson correlation) correlation efficiently

2 messages · Ng Stanley, David Winsemius

#
"Ng Stanley" <stanleyngkl at gmail.com> wrote::
Do you mean cor()?
No documentation for 'corr' in specified packages and libraries:
you could try 'help.search("corr")'

I do not think that cor() will complain when you send it rows rather than 
columns.

r25 <- matrix(rnorm(25),ncol=5)
q25 <- matrix(rnorm(25),ncol=5)
[,1]       [,2]       [,3]       [,4]       [,5]
[1,]  0.9075305  0.1768761  0.9946014 -2.1863247 -1.4031437
[2,] -0.6675117  0.5282182 -0.2522370 -0.3905784 -1.7219424
[3,]  0.7975418 -0.1992466  0.8884690  2.4123639 -0.9834216
[4,]  0.4027469  1.7962510 -0.1084113  0.7382887  0.2165000
[5,] -1.3969290  1.3095061  0.8976753  0.5161417 -2.0408553
[1] 0.4221951
[1] -0.4903181