Correlación de Pearson

Correlación de Pearson de las variables a y b

a<- c(5,8,9,16,22,23)
b<- c(2,4,5,7,8,9)
cor(a, b)
## [1] 0.9720022
x=cor.test(a,b)
summary(x)
##             Length Class  Mode     
## statistic   1      -none- numeric  
## parameter   1      -none- numeric  
## p.value     1      -none- numeric  
## estimate    1      -none- numeric  
## null.value  1      -none- numeric  
## alternative 1      -none- character
## method      1      -none- character
## data.name   1      -none- character
## conf.int    2      -none- numeric
x=cor.test(a,b,method="pearson")
summary(x)
##             Length Class  Mode     
## statistic   1      -none- numeric  
## parameter   1      -none- numeric  
## p.value     1      -none- numeric  
## estimate    1      -none- numeric  
## null.value  1      -none- numeric  
## alternative 1      -none- character
## method      1      -none- character
## data.name   1      -none- character
## conf.int    2      -none- numeric
y=cor.test(a,b,method="spearman")
summary(y)
##             Length Class  Mode     
## statistic   1      -none- numeric  
## parameter   0      -none- NULL     
## p.value     1      -none- numeric  
## estimate    1      -none- numeric  
## null.value  1      -none- numeric  
## alternative 1      -none- character
## method      1      -none- character
## data.name   1      -none- character

Correlación de Spearman

Correlación de Spearman de las variables a y b

plot(a)

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.