cor.matrix: cor.matrix

Description Usage Arguments Value See Also Examples

View source: R/cor.matrix.R

Description

Creates a correlation matrix

Usage

1
cor.matrix(variables,with.variables,data=NULL,test=cor.test,...)

Arguments

variables

variables

with.variables

An optional set of variables to correlate with variables. If nothing is specified, all variables in variables are correlated with themselves.

data

A data.frame from which the variables and factor will be selected.

test

A function whose first two arguments are the variables upon which the correlation will be calculated, and whose result is an object of class htest.

...

further arguments for test.

Value

A multi.test object, representing a table of the results of func applied to each of the variables.

See Also

cor.test as.matrix.cor.matrix

Examples

1
2
3
4
5
6
dat<-data.frame(aa=rnorm(100),bb=rnorm(100),cc=rnorm(100),dd=rnorm(100))
dat$aa<-dat$aa+dat$dd
dat$cc<-dat$cc+dat$aa
cor.matrix(dat,test=cor.test)
cor.matrix(d(aa,cc),data=dat,test=cor.test,method="kendall")
cor.matrix(d(aa,cc),d(dd,bb),data=dat,test=cor.test,method="spearman")

Example output

Loading required package: ggplot2
Loading required package: JGR
Loading required package: rJava
Loading required package: JavaGD
OpenJDK 64-Bit Server VM warning: Can't detect primordial thread stack location - find_vma failed

Please type JGR() to launch console. Platform specific launchers (.exe and .app) can also be obtained at http://www.rforge.net/JGR/files/.


Loading required package: car
Loading required package: carData
Loading required package: MASS
Registered S3 methods overwritten by 'lme4':
  method                          from
  cooks.distance.influence.merMod car 
  influence.merMod                car 
  dfbeta.influence.merMod         car 
  dfbetas.influence.merMod        car 


Note Non-JGR console detected:
	Deducer is best used from within JGR (http://jgr.markushelbig.org/).
	To Bring up GUI dialogs, type deducer().


                       Pearson's product-moment correlation                       

          aa                bb                cc               dd              
aa    cor 1                 0.1683            0.8495           0.7639          
        N 100               100               100              100             
      CI*                   (-0.02903,0.3531) (0.7839,0.8964)  (0.6676,0.835)  
   stat**                   1.691 (98)        15.94 (98)       11.72 (98)      
  p-value                   0.0941            0.0000           0.0000          
---------                                                                      
bb    cor 0.1683            1                 0.0399           0.2224          
        N 100               100               100              100             
      CI* (-0.02903,0.3531)                   (-0.1577,0.2345) (0.02722,0.4013)
   stat** 1.691 (98)                          0.3954 (98)      2.259 (98)      
  p-value 0.0941                              0.6934           0.0261          
---------                                                                      
cc    cor 0.8495            0.0399            1                0.6628          
        N 100               100               100              100             
      CI* (0.7839,0.8964)   (-0.1577,0.2345)                   (0.5362,0.7603) 
   stat** 15.94 (98)        0.3954 (98)                        8.763 (98)      
  p-value 0.0000            0.6934                             0.0000          
---------                                                                      
dd    cor 0.7639            0.2224            0.6628           1               
        N 100               100               100              100             
      CI* (0.6676,0.835)    (0.02722,0.4013)  (0.5362,0.7603)                  
   stat** 11.72 (98)        2.259 (98)        8.763 (98)                       
  p-value 0.0000            0.0261            0.0000                           
---------                                                                      
	** t (df)
	 * 95% percent interval

	HA: two.sided 


                          Kendall's rank correlation tau                          

          aa     cc    
aa    cor 1      0.6853
        N 100    100   
   stat**        10.1  
  p-value        0.0000
---------              
cc    cor 0.6853 1     
        N 100    100   
   stat** 10.1         
  p-value 0.0000       
---------              
	** z
	HA: two.sided 


                         Spearman's rank correlation rho                          

          aa     cc     
dd    cor 0.7405 0.668  
        N 100    100    
   stat** 43240  55328  
  p-value 0.0000 0.0000 
---------               
bb    cor 0.1864 0.07485
        N 100    100    
   stat** 135590 154176 
  p-value 0.0635 0.4586 
---------               
	** S
	HA: two.sided 

Deducer documentation built on May 2, 2019, 8:35 a.m.

Related to cor.matrix in Deducer...