Greetings,
I have found a way to calculate correlations < cor() > - but p-values are missing.
I have also found a way to test correlations < cor.mtest > - but r-values are missing.
I have also found a way to plot correlations which indicate significant correlations - but no p-values. Any help in getting a complete set of information would be greatly appreciated!
Cheers,
Jason
# Reprex correlations
# modified: "17/04/2019"
library(ggplot2)
library(ez)
library(corrplot)
#> corrplot 0.84 loaded
options(na.action = na.exclude)
library(PerformanceAnalytics)
library(tidyverse)
library(here)
here() # THIS SETS THE WORKING DIRECTORY TO THE LOCATION OF THIS FILE
dr_here(show_reason = FALSE)
# RAW DATA ON GITHUB
data <- read.csv(url('https://raw.githubusercontent.com/BrainStormCenter/ASQ_pilot/master/ASQ_pilot_raw_2019_04_17.csv'), header = TRUE)
# FILTER OUT SUBJECT WHERE Groups3=other
# LOOK FOR A WAY TO AVOID LOSING THIS SUBJECT ENTIRELY
data2 <- filter(data, Groups3 != "other")
# CREATING A SMALLER DATASET OF ALL SUBJECTS OF 3 VARIABLES
vars_keep <- select(data2, asq_light, asq_heavy,max.temp)
# CORELATIONS
"Pearson"
#> [1] "Pearson"
cor(vars_keep, use = "complete.obs", method = "pearson")
#> asq_light asq_heavy max.temp
#> asq_light 1.00000000 0.3636925 0.05498907
#> asq_heavy 0.36369251 1.0000000 0.19284421
#> max.temp 0.05498907 0.1928442 1.00000000
cor(vars_keep, use = "pairwise.complete", method = "pearson")
#> asq_light asq_heavy max.temp
#> asq_light 1.00000000 0.4290929 0.03524822
#> asq_heavy 0.42909294 1.0000000 0.19284421
#> max.temp 0.03524822 0.1928442 1.00000000
# WHICH CORRELATION VALUES GO WITH THE P-VALUES FROM THE TEST BELOW?
# WHICH METHOD DOES THIS USE?
cor.mtest(vars_keep)
#> $p
#> [,1] [,2] [,3]
#> [1,] 0.000000e+00 7.143542e-05 0.7753652
#> [2,] 7.143542e-05 0.000000e+00 0.1583621
#> [3,] 7.753652e-01 1.583621e-01 0.0000000
#>
#> $lowCI
#> [,1] [,2] [,3]
#> [1,] 1.0000000 0.2311706 -0.2048988
#> [2,] 0.2311706 1.0000000 -0.0763596
#> [3,] -0.2048988 -0.0763596 1.0000000
#>
#> $uppCI
#> [,1] [,2] [,3]
#> [1,] 1.0000000 0.5929108 0.2713925
#> [2,] 0.5929108 1.0000000 0.4358432
#> [3,] 0.2713925 0.4358432 1.0000000
# WHERE ARE THE P-VALUES FOR THE GRAPHS BELOW
chart.Correlation(vars_keep, histogram = TRUE, method = "pearson")
cor_plot2 <- ezCor(
data = vars_keep[,c(1:3)],
r_size_lims = c(8,8),
test_alpha = .05,
label_size = 3
)
print(cor_plot2)
Created on 2019-04-18 by the reprex package (v0.2.1)