library(haven)
Data<-read_xpt("C:/Users/adolp/Desktop/Statistics 2/BRFSS/LLCP2019.XPT")
head(Data, n=10)
## # A tibble: 10 x 342
## `_STATE` FMONTH IDATE IMONTH IDAY IYEAR DISPCODE SEQNO `_PSU` CTELENM1
## <dbl> <dbl> <chr> <chr> <chr> <chr> <dbl> <chr> <dbl> <dbl>
## 1 1 1 0118~ 01 18 2019 1100 2019~ 2.02e9 1
## 2 1 1 0113~ 01 13 2019 1100 2019~ 2.02e9 1
## 3 1 1 0118~ 01 18 2019 1100 2019~ 2.02e9 1
## 4 1 1 0118~ 01 18 2019 1200 2019~ 2.02e9 1
## 5 1 1 0104~ 01 04 2019 1100 2019~ 2.02e9 1
## 6 1 1 0118~ 01 18 2019 1200 2019~ 2.02e9 1
## 7 1 1 0104~ 01 04 2019 1100 2019~ 2.02e9 1
## 8 1 1 0123~ 01 23 2019 1100 2019~ 2.02e9 1
## 9 1 1 0124~ 01 24 2019 1100 2019~ 2.02e9 1
## 10 1 1 0113~ 01 13 2019 1100 2019~ 2.02e9 1
## # ... with 332 more variables: PVTRESD1 <dbl>, COLGHOUS <dbl>, STATERE1 <dbl>,
## # CELPHONE <dbl>, LADULT1 <dbl>, COLGSEX <dbl>, NUMADULT <dbl>,
## # LANDSEX <dbl>, NUMMEN <dbl>, NUMWOMEN <dbl>, RESPSLCT <dbl>,
## # SAFETIME <dbl>, CTELNUM1 <dbl>, CELLFON5 <dbl>, CADULT1 <dbl>,
## # CELLSEX <dbl>, PVTRESD3 <dbl>, CCLGHOUS <dbl>, CSTATE1 <dbl>,
## # LANDLINE <dbl>, HHADULT <dbl>, SEXVAR <dbl>, GENHLTH <dbl>, PHYSHLTH <dbl>,
## # MENTHLTH <dbl>, POORHLTH <dbl>, HLTHPLN1 <dbl>, PERSDOC2 <dbl>,
## # MEDCOST <dbl>, CHECKUP1 <dbl>, BPHIGH4 <dbl>, BPMEDS <dbl>, CHOLCHK2 <dbl>,
## # TOLDHI2 <dbl>, CHOLMED2 <dbl>, CVDINFR4 <dbl>, CVDCRHD4 <dbl>,
## # CVDSTRK3 <dbl>, ASTHMA3 <dbl>, ASTHNOW <dbl>, CHCSCNCR <dbl>,
## # CHCOCNCR <dbl>, CHCCOPD2 <dbl>, ADDEPEV3 <dbl>, CHCKDNY2 <dbl>,
## # DIABETE4 <dbl>, DIABAGE3 <dbl>, HAVARTH4 <dbl>, ARTHEXER <dbl>,
## # ARTHEDU <dbl>, LMTJOIN3 <dbl>, ARTHDIS2 <dbl>, JOINPAI2 <dbl>,
## # MARITAL <dbl>, EDUCA <dbl>, RENTHOM1 <dbl>, NUMHHOL3 <dbl>, NUMPHON3 <dbl>,
## # CPDEMO1B <dbl>, VETERAN3 <dbl>, EMPLOY1 <dbl>, CHILDREN <dbl>,
## # INCOME2 <dbl>, WEIGHT2 <dbl>, HEIGHT3 <dbl>, PREGNANT <dbl>, DEAF <dbl>,
## # BLIND <dbl>, DECIDE <dbl>, DIFFWALK <dbl>, DIFFDRES <dbl>, DIFFALON <dbl>,
## # SMOKE100 <dbl>, SMOKDAY2 <dbl>, STOPSMK2 <dbl>, LASTSMK2 <dbl>,
## # USENOW3 <dbl>, ALCDAY5 <dbl>, AVEDRNK3 <dbl>, DRNK3GE5 <dbl>,
## # MAXDRNKS <dbl>, EXERANY2 <dbl>, EXRACT11 <dbl>, EXEROFT1 <dbl>,
## # EXERHMM1 <dbl>, EXRACT21 <dbl>, EXEROFT2 <dbl>, EXERHMM2 <dbl>,
## # STRENGTH <dbl>, FRUIT2 <dbl>, FRUITJU2 <dbl>, FVGREEN1 <dbl>,
## # FRENCHF1 <dbl>, POTATOE1 <dbl>, VEGETAB2 <dbl>, FLUSHOT7 <dbl>,
## # FLSHTMY3 <dbl>, TETANUS1 <dbl>, PNEUVAC4 <dbl>, HIVTST7 <dbl>, ...
SubData<-names(Data)
newnames<-tolower(gsub(pattern = "_",replacement = "",x = SubData))
names(Data)<-newnames
library(car)
## Loading required package: carData
Data$Alc<-Recode(Data$acedrink, recodes ="7:9=NA; 1=1;2=0")
Data$Alc<-Recode(Data$Alc, recodes ="7:9=NA; 1='Yes';0='No'")
Data$Dep<-Recode(Data$acedeprs, recodes ="7:9=NA; 1=1;2=0")
Data$Dep<-Recode(Data$Dep, recodes ="7:9=NA; 1='Yes';0='No'")
Data$Mhlth<-Recode(Data$ment14d, recodes ="7:9=NA; 1=0;2=1;3=1")
Data$Mhlth<-Recode(Data$Mhlth, recodes ="7:9=NA; 1='Yes';0='No'")
IV 1: Did you live with anyone who was a problem drinker or alcoholic? (coded 1 = 1, 2 = 0)
IV 2: Did you live with anyone who was depressed, mentally ill, or suicidal? (coded 1 = 1, 2 = 0)
DV: Mental Health Status(recoded into binary outcome, 1 = 0, 2 & 3 = 1)
RQ: Do growing up in a household with a problem drinker or alcoholic or live with anyone who was depressed, mentally ill, or suicidal affect the current mental health status? Both variables are anticipated to be associated with Mental Health Status, with respondents who grew up with anyone who was depressed, mentally ill, or suicidal indicating more current mental health status.
library(tableone)
library(survey)
## Loading required package: grid
## Loading required package: Matrix
## Loading required package: survival
##
## Attaching package: 'survey'
## The following object is masked from 'package:graphics':
##
## dotchart
library(questionr)
options(survey.lonely.psu = "adjust")
des<-svydesign(ids=~1, strata=~ststr, weights=~llcpwt, data = Data)
t1<-CreateTableOne(vars = c("Alc", "Dep"), strata = "Mhlth", test = T, data = Data)
print(t1,format="p")
## Stratified by Mhlth
## No Yes p test
## n 267337 142152
## Alc = Yes (%) 18.8 32.0 <0.001
## Dep = Yes (%) 9.9 28.8 <0.001
st1<-svyCreateTableOne(vars = c("Alc", "Dep"), strata = "Mhlth", test = T, data = des)
print(st1,format="p")
## Stratified by Mhlth
## No Yes p test
## n 152807504.9 94290865.3
## Alc = Yes (%) 19.2 33.2 <0.001
## Dep = Yes (%) 11.1 31.8 <0.001
Results: The descriptive results using survey design was not substantially different than the descriptive results of not using a survey design. In regard to the research question, growing up in a household with a problem drinker or alcoholic accounted for more respondents indicating “Yes” to current mental health status compared to respondents who grew up with anyone who was depressed, mentally ill, or suicidal.