library(haven)
baby2.0cor <- read_sav("TheaWulff_Dataset_LR.sav")
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
baby2.0cor <- baby2.0cor %>%
rename(DERS = DERStotmA,
SensComposite = OverallSensComposite,
ITSEA_exter = ITSEAextmD1,
ITSEA_inter = ITSEAintmD1,
ITSEA_dysreg = ITSEAdysmD1,
ITSEA_comp = ITSEAcompmD1)
Correlations Between DERS and the ITSEA Outcomes
# Calculate the correlation and p-value for DERS and ITSEA_exter
cor_test_exter <- cor.test(baby2.0cor$DERS, baby2.0cor$ITSEA_exter, use = "complete.obs")
cor_DERSexter <- cor_test_exter$estimate # Correlation coefficient
p_DERSexter <- cor_test_exter$p.value # p-value
# Calculate the correlation and p-value for DERS and ITSEA_inter
cor_test_inter <- cor.test(baby2.0cor$DERS, baby2.0cor$ITSEA_inter, use = "complete.obs")
cor_DERSinter <- cor_test_inter$estimate
p_DERSinter <- cor_test_inter$p.value
# Calculate the correlation and p-value for DERS and ITSEA_dysreg
cor_test_dysreg <- cor.test(baby2.0cor$DERS, baby2.0cor$ITSEA_dysreg, use = "complete.obs")
cor_DERSdysreg <- cor_test_dysreg$estimate
p_DERSdysreg <- cor_test_dysreg$p.value
# Calculate the correlation and p-value for DERS and ITSEA_comp
cor_test_comp <- cor.test(baby2.0cor$DERS, baby2.0cor$ITSEA_comp, use = "complete.obs")
cor_DERScomp <- cor_test_comp$estimate
p_DERScomp <- cor_test_comp$p.value
# Create a data frame to store the results
DERS_ITSEA_cortable <- data.frame(
Variable_Pair = c("DERS vs ITSEA_exter", "DERS vs ITSEA_inter", "DERS vs ITSEA_dysreg", "DERS vs ITSEA_comp"),
Correlation = c(cor_DERSexter, cor_DERSinter, cor_DERSdysreg, cor_DERScomp),
P_Value = c(p_DERSexter, p_DERSinter, p_DERSdysreg, p_DERScomp)
)
# Print the table with correlation and p-values
print(DERS_ITSEA_cortable)
## Variable_Pair Correlation P_Value
## 1 DERS vs ITSEA_exter 0.176073719 0.007701264
## 2 DERS vs ITSEA_inter 0.159295230 0.007046860
## 3 DERS vs ITSEA_dysreg 0.179524944 0.002226159
## 4 DERS vs ITSEA_comp -0.003097462 0.963648172
Correlations Between DERS and the Sensitivity Composite
cor_test_DERS_SensComp <- cor.test(baby2.0cor$DERS, baby2.0cor$SensComposite, use = "complete.obs")
cor_DERS_SensComp <- cor_test_DERS_SensComp$estimate
p_DERS_SensComp <- cor_test_DERS_SensComp$p.value
# Create a table to store the correlation and p-value
cor_table <- data.frame(
Variable_Pair = "DERS vs SensComposite", # Name of the variable pair
Correlation = cor_DERS_SensComp, # Correlation coefficient
P_Value = p_DERS_SensComp # p-value
)
# Print the table with the correlation and p-value
print(cor_table)
## Variable_Pair Correlation P_Value
## cor DERS vs SensComposite -0.08935819 0.1492009
Sensitivity Composite and ITSEA Outcomes
# Calculate the correlation and p-value for SENS_COMP and ITSEA_exter
cor_sens_exter <- cor.test(baby2.0cor$SensComposite, baby2.0cor$ITSEA_exter, use = "complete.obs")
cor_SENSexter <- cor_sens_exter$estimate # Correlation coefficient
p_SENSexter <- cor_sens_exter$p.value # p-value
cor_sens_inter <- cor.test(baby2.0cor$SensComposite, baby2.0cor$ITSEA_inter, use = "complete.obs")
cor_SENSinter <- cor_sens_inter$estimate
p_SENSinter <- cor_sens_inter$p.value
cor_sens_dysreg <- cor.test(baby2.0cor$SensComposite, baby2.0cor$ITSEA_dysreg, use = "complete.obs")
cor_SENSdysreg <- cor_sens_dysreg$estimate
p_SENSdysreg <- cor_sens_dysreg$p.value
cor_sens_comp <- cor.test(baby2.0cor$SensComposite, baby2.0cor$ITSEA_comp, use = "complete.obs")
cor_SENScomp <- cor_sens_comp$estimate
p_SENScomp <- cor_sens_comp$p.value
# Create a data frame to store the results
SensComp_ITSEA_cortable <- data.frame(
Variable_Pair = c("SensComp vs ITSEA_exter", "SensComp vs ITSEA_inter", "SensComp vs ITSEA_dysreg", "SensComp vs ITSEA_comp"),
Correlation = c(cor_SENSexter, cor_SENSinter, cor_SENSdysreg, cor_SENScomp),
P_Value = c(p_SENSexter, p_SENSinter, p_SENSdysreg, p_SENScomp)
)
# Print the table with correlation and p-values
print(SensComp_ITSEA_cortable)
## Variable_Pair Correlation P_Value
## 1 SensComp vs ITSEA_exter -0.094031468 0.2067283
## 2 SensComp vs ITSEA_inter 0.073173522 0.2722672
## 3 SensComp vs ITSEA_dysreg -0.043527374 0.5122135
## 4 SensComp vs ITSEA_comp 0.007874185 0.9169184