Another correlation function?!
A table
A Plot
A print
Options
Fun with p-hacking
Credits
Another correlation function?!
Yes, the correlation function from the psycho package.
devtools::install_github(&quot;neuropsychology/psycho.R&quot;) # Install the newest version
library(psycho)
library(tidyverse)
cor % correlation()
This function automatically select numeric variables and run a correlation analysis. It returns a psychobject.
A table
We can then extract a formatted table that can be saved and pasted into reports and manuscripts by using the summary function.
summary(cor)
# write.csv(summary(cor), &quot;myformattedcortable.csv&quot;)
 
Age
Life_Satisfaction
Concealing
Adjusting
Age
 
 
 
 
Life_Satisfaction
0.03
 
 
 
Concealing
-0.05
-0.06
 
 
Adjusting
0.03
0.36***
0.22***
 
Tolerating
0.03
0.15***
0.07
0.29***
A Plot
It integrates a plot done with ggcorplot.
plot(cor)
A print
It also includes a pairwise correlation printing method.
print(cor)
Pearson Full correlation (p value correction: holm):
- Age / Life_Satisfaction: Results of the Pearson correlation showed a non significant and weak negative association between Age and Life_Satisfaction (r(1249) = 0.030, p __ .1).
- Age / Concealing: Results of the Pearson correlation showed a non significant and weak positive association between Age and Concealing (r(1249) = -0.050, p __ .1).
- Life_Satisfaction / Concealing: Results of the Pearson correlation showed a non significant and weak positive association between Life_Satisfaction and Concealing (r(1249) = -0.063, p __ .1).
- Age / Adjusting: Results of the Pearson correlation showed a non significant and weak negative association between Age and Adjusting (r(1249) = 0.027, p __ .1).
- Life_Satisfaction / Adjusting: Results of the Pearson correlation showed a significant and moderate negative association between Life_Satisfaction and Adjusting (r(1249) = 0.36, p __ .001***).
- Concealing / Adjusting: Results of the Pearson correlation showed a significant and weak negative association between Concealing and Adjusting (r(1249) = 0.22, p __ .001***).
- Age / Tolerating: Results of the Pearson correlation showed a non significant and weak negative association between Age and Tolerating (r(1249) = 0.031, p __ .1).
- Life_Satisfaction / Tolerating: Results of the Pearson correlation showed a significant and weak negative association between Life_Satisfaction and Tolerating (r(1249) = 0.15, p __ .001***).
- Concealing / Tolerating: Results of the Pearson correlation showed a non significant and weak negative association between Concealing and Tolerating (r(1249) = 0.074, p = 0.05°).
- Adjusting / Tolerating: Results of the Pearson correlation showed a significant and weak negative association between Adjusting and Tolerating (r(1249) = 0.29, p __ .001***).
Options
You can also cutomize the type (pearson, spearman or kendall), the p value correction method (holm (default), bonferroni, fdr, none…) and run partial, semi-partial or glasso correlations.
psycho::affective %__% correlation(method = &quot;pearson&quot;, adjust=&quot;bonferroni&quot;, type=&quot;partial&quot;) %__% summary()
 
Age
Life_Satisfaction
Concealing
Adjusting
Age
 
 
 
 
Life_Satisfaction
0.01
 
 
 
Concealing
-0.06
-0.16***
 
 
Adjusting
0.02
0.36***
0.25***
 
Tolerating
0.02
0.06
0.02
0.24***
Fun with p-hacking
In order to prevent people for running many uncorrected correlation tests (promoting p-hacking and result-fishing), we included the i_am_cheating parameter. If FALSE (default), the function will help you finding interesting results!
df_with_11_vars