Data:
data
## anxiety stress depression happiness gender ssri
## 1 1.31 2.01 2.51 4.02 male no
## 2 2.72 3.45 1.77 3.66 female no
## 3 3.18 1.99 3.34 5.23 female no
## 4 4.21 3.25 5.83 6.37 male <NA>
## 5 5.55 4.27 9.01 7.83 female yes
## 6 NA 6.80 7.74 1.18 female yes
# default output is just the (Pearson) correlation matrix
correlate( data )
##
## CORRELATIONS
## ============
## - correlation type: pearson
## - correlations shown only when both variables are numeric
##
## anxiety stress depression happiness gender ssri
## anxiety . 0.784 0.906 0.924 . .
## stress 0.784 . 0.693 -0.453 . .
## depression 0.906 0.693 . 0.247 . .
## happiness 0.924 -0.453 0.247 . . .
## gender . . . . . .
## ssri . . . . . .
# other types of correlation:
correlate( data, corr.method="spearman" )
##
## CORRELATIONS
## ============
## - correlation type: spearman
## - correlations shown only when both variables are numeric
##
## anxiety stress depression happiness gender ssri
## anxiety . 0.500 0.900 0.900 . .
## stress 0.500 . 0.543 -0.257 . .
## depression 0.900 0.543 . 0.429 . .
## happiness 0.900 -0.257 0.429 . . .
## gender . . . . . .
## ssri . . . . . .
# the same examples, with Holm-corrected p-values
correlate( data, test=TRUE )
##
## CORRELATIONS
## ============
## - correlation type: pearson
## - correlations shown only when both variables are numeric
##
## anxiety stress depression happiness gender ssri
## anxiety . 0.784 0.906 0.924 . .
## stress 0.784 . 0.693 -0.453 . .
## depression 0.906 0.693 . 0.247 . .
## happiness 0.924 -0.453 0.247 . . .
## gender . . . . . .
## ssri . . . . . .
##
## ---
## Signif. codes: . = p < .1, * = p<.05, ** = p<.01, *** = p<.001
##
##
## p-VALUES
## ========
## - total number of tests run: 6
## - correction for multiple testing: holm
##
## anxiety stress depression happiness gender ssri
## anxiety . 0.467 0.171 0.150 . .
## stress 0.467 . 0.467 0.733 . .
## depression 0.171 0.467 . 0.733 . .
## happiness 0.150 0.733 0.733 . . .
## gender . . . . . .
## ssri . . . . . .
##
##
## SAMPLE SIZES
## ============
##
## anxiety stress depression happiness gender ssri
## anxiety 5 5 5 5 5 4
## stress 5 6 6 6 6 5
## depression 5 6 6 6 6 5
## happiness 5 6 6 6 6 5
## gender 5 6 6 6 6 5
## ssri 4 5 5 5 5 5
# 2 subsets to be correlated:
nervous <- data[,c("anxiety","stress")]
happy <- data[,c("happiness","depression","ssri")]
correlate( nervous, happy )
##
## CORRELATIONS
## ============
## - correlation type: pearson
## - correlations shown only when both variables are numeric
##
## happiness depression ssri
## anxiety 0.924 0.906 .
## stress -0.453 0.693 .
```