library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.2.1     ✔ readr     2.2.0
## ✔ forcats   1.0.1     ✔ stringr   1.6.0
## ✔ ggplot2   4.0.3     ✔ tibble    3.3.1
## ✔ lubridate 1.9.5     ✔ tidyr     1.3.2
## ✔ purrr     1.2.2     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(readxl)
load("NSDUH_2023.Rdata")
cordata<-data%>%select(IRMARIT,CABINGFLG,AGE3)
cor(cordata)
##               IRMARIT   CABINGFLG        AGE3
## IRMARIT    1.00000000 -0.03150225 -0.59119049
## CABINGFLG -0.03150225  1.00000000  0.02717092
## AGE3      -0.59119049  0.02717092  1.00000000
pairs(~IRMARIT+CABINGFLG+AGE3,data=cordata)

cor.test(cordata$AGE3,cordata$IRMARIT,method = "pearson")
## 
##  Pearson's product-moment correlation
## 
## data:  cordata$AGE3 and cordata$IRMARIT
## t = -174.55, df = 56703, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.5965186 -0.5858103
## sample estimates:
##        cor 
## -0.5911905
cor.test(cordata$IRMARIT,cordata$AGE3,method="spearman")
## Warning in cor.test.default(cordata$IRMARIT, cordata$AGE3, method =
## "spearman"): cannot compute exact p-value with ties
## 
##  Spearman's rank correlation rho
## 
## data:  cordata$IRMARIT and cordata$AGE3
## S = 5.2757e+13, p-value < 2.2e-16
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
##        rho 
## -0.7360566
cor.test(cordata$AGE3,cordata$IRMARIT,method="kendall")
## 
##  Kendall's rank correlation tau
## 
## data:  cordata$AGE3 and cordata$IRMARIT
## z = -184.64, p-value < 2.2e-16
## alternative hypothesis: true tau is not equal to 0
## sample estimates:
##      tau 
## -0.62239
cor.test(cordata$CABINGFLG,cordata$IRMARIT,method = "pearson")
## 
##  Pearson's product-moment correlation
## 
## data:  cordata$CABINGFLG and cordata$IRMARIT
## t = -7.5052, df = 56703, p-value = 6.225e-14
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.03972269 -0.02327754
## sample estimates:
##         cor 
## -0.03150225
cor.test(cordata$IRMARIT,cordata$CABINGFLG,method="spearman")
## Warning in cor.test.default(cordata$IRMARIT, cordata$CABINGFLG, method =
## "spearman"): cannot compute exact p-value with ties
## 
##  Spearman's rank correlation rho
## 
## data:  cordata$IRMARIT and cordata$CABINGFLG
## S = 3.2767e+13, p-value < 2.2e-16
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
##         rho 
## -0.07826129
cor.test(cordata$CABINGFLG,cordata$IRMARIT,method="kendall")
## 
##  Kendall's rank correlation tau
## 
## data:  cordata$CABINGFLG and cordata$IRMARIT
## z = -18.638, p-value < 2.2e-16
## alternative hypothesis: true tau is not equal to 0
## sample estimates:
##         tau 
## -0.07298602

I ran commands mulitple ways on these variables to determine if there were any relationships. There seems to be a negative relatonship with the AGE3 and IRMARIT variable. However, I am still uncertain on when it is appropriate to use each test.