library(car)
## Loading required package: carData
library(stargazer)
## 
## Please cite as:
##  Hlavac, Marek (2018). stargazer: Well-Formatted Regression and Summary Statistics Tables.
##  R package version 5.2.2. https://CRAN.R-project.org/package=stargazer
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)
library(foreign)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following object is masked from 'package:car':
## 
##     recode
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
brfss2017=read.xport("~/Desktop/DataFolder/brfss.XPT ")
#Marital Status; Are you? (marital status): 1 Married, 2 Divorced, 3 Widowed, 4 Seprarated, 5 Never married, 6 Partner, 9 Refuse
brfss2017$marital<-Recode(brfss2017$MARITAL,recodes="1='b-Married';5='a-Single';2:4='c-D/W/S';6='partner';else=NA",as.factor=T)
#Sexual Orientation; Do you consider yourself to be? (sexual orientation): 1 Straight, 2 Gay, 3 Bisexual, 4 Other, 7 Don't know, 9 Refuse
brfss2017$sxorient<-Recode(brfss2017$SXORIENT,recodes="1='a-Straight';2='b-Gay';3='Bisexual';4:7='Other';else=NA",as.factor=T)
#Income 
brfss2017$income<-Recode(brfss2017$INCOME2,recodes="1:3='<$20k';4:5='$20k<$35k';6='35k<50k';7='50k<75';8='>75k';else=NA",as.factor=T)
#Age
brfss2017$age<-Recode(brfss2017$X_AGE_G, recodes="1='18-24';2='25-34';3='35-44';4='45-54';5='55-64';6='65+';else=NA",as.factor=T)
#Education
brfss2017$educ<-Recode(brfss2017$EDUCA, recodes="1:2='0Prim'; 3='1somehs'; 4='2hsgrad'; 5='3somecol'; 6='4colgrad';9=NA", as.factor=T)
brfss2017$educ<-relevel(brfss2017$educ, ref='0Prim')
#Cholesterol; Have you EVER been told by a doctor that your cholesterol is high? 1 Yes, 2 No, 7 Dont know, 9 Refuse
brfss2017$choles<-Recode(brfss2017$TOLDHI2,recodes="1='Y';2='N';else=NA",as.factor=T)
#Blood Pressure; Are you currently taking medicine for blood Pressure? 1 Yes, 2 No, 7 Dont know, 9 Refuse
brfss2017$blpressure<-Recode(brfss2017$BPMEDS,recodes="1='Y';2='N';else=NA",as.factor=T)
#Health Insurance; Do you have health care coverage? 1 Yes, 2 No, 7 Dont know, 9 Refuse
brfss2017$hlthinsur<-Recode(brfss2017$HLTHPLN1,recodes="1='Y';2='N';else=NA",as.factor=T)
#DR Checkup; Had a doctor checkup with the last...?  1 year, 2 years, 5 years, 5+ years
brfss2017$checkup<-Recode(brfss2017$CHECKUP1,recodes="1='1 year';2='2 years';3='5 years';4='5+ years';else=NA",as.factor=T)
#Live in a Safe Neighborhood; How safe from crime do you consider your neighborhood to be? 1 Extremely Safe, 2 Safe, 3 Unsafe, 4 Extremely Unsafe, 7 Don't know, 9 Refuse
brfss2017$safeneigh<-Recode(brfss2017$HOWSAFE1,recodes="1:2='Safe';3:4='Unsafe';else=NA",as.factor=T)
#Mental Health; How many days during the past 30 days was your mental health not good? 1-30, 88 None, 77 Don't Know, 99 Refuse
brfss2017$menth<-Recode(brfss2017$MENTHLTH,recodes="88=0;77=NA;99=NA")
#Interaction between marital status and sexual orientation
brfss2017$int<-interaction(brfss2017$marital,brfss2017$sxorient)
brfss2017$int<-as.factor(brfss2017$int)
#Interaction between marital status and sexual orientation recoded to gay people only (gay single and gay married)
#brfss2017$int1<-Recode(brfss2017$int,recodes="0.1=0.1;1.1=1.1;else=NA",as.factor=T)
#Interaction between marital status and sexual orientation recoded to married people only (married straight and married gay)
#brfss2017$int2<-Recode(brfss2017$int,recodes="'M.G'='M.G';'M.S'='M.S';else=NA",as.factor=T)
#Homeowner; Do you own or rent your home? 1 Own, 2 Rent, 3 Other, 7 Don't know, 9 Refuse
brfss2017$ownhome<-Recode(brfss2017$RENTHOM1,recodes="1='Y';2:3='N';else=NA",as.factor=T)
#Smoking; Do you now smoke cigarettes every day, some days, or not at all? 1 Everyday, 2 Some days, 3 Not at all, 7 Don't know, 9 Refuse
brfss2017$smoke<-Recode(brfss2017$SMOKDAY2,recodes="1:2='Y';3='N';else=NA",as.factor=T)
#Was there a time in the past 12 months when you needed to see a doctor but could not because of cost? 1 Yes, 2 No, 7 Don't know, 9 Refuse
brfss2017$medcost<-Recode(brfss2017$MEDCOST,recodes="1='Y';2='N';else=NA",as.factor=T)
#During the past 30 days, on the days when you drank, about how many drinks did you drink on the average?
brfss2017$drinks<-Recode(brfss2017$AVEDRNK2,recodes="1:5='1-5';5:10='5-10';10:30='10-30';77=NA;99=NA;else=NA",as.factor=T)
#BMI; Four-categories of Body Mass Index (BMI): 1 Underweight, 2 Normal Weight, 3 Overweight, 4 Obese
brfss2017$bmi<-brfss2017$X_BMI5CAT
#Not good mental health days: 1 (0 days), 2 (1-13 days), 3 (14-30 days), 9 Don't know
brfss2017$badmental<-Recode(brfss2017$X_MENT14D,recodes="1=0;2:3=1;9=NA;else=NA",as.factor=T)
#Race/Ethnicity
brfss2017$black<-Recode(brfss2017$racegr3, recodes="2=1; 9=NA; else=0")
brfss2017$white<-Recode(brfss2017$racegr3, recodes="1=1; 9=NA; else=0")
brfss2017$other<-Recode(brfss2017$racegr3, recodes="3:4=1; 9=NA; else=0")
brfss2017$hispanic<-Recode(brfss2017$racegr3, recodes="5=1; 9=NA; else=0")
#Race/Ethnicity; 1 White, 2 Black, 3 Other, 4 Multiracial, 5 Hispanic, 9 Don't know
brfss2017$race<-Recode(brfss2017$X_RACEGR3, recodes="2='black'; 1='awhite'; 3:4='other';5='hispanic'; else=NA",as.factor=T)
brfss2017$race<-relevel(brfss2017$race, ref='awhite')
#Sex; 1 Male, 2 Female
brfss2017$sex<-Recode(brfss2017$SEX,recodes="1=1;2=0;9=NA;else=NA",as.factor=T)
brfss2017$genh<-Recode(brfss2017$GENHLTH,recodes="1:3='aGood';4:5='Bad';else=NA",as.factor=T)
brfss2017$physh<-Recode(brfss2017$PHYSHLTH,recodes="88=0;77=NA;99=NA",as.factor=T)
brfss2017$menth<-Recode(brfss2017$MENTHLTH,recodes="88=0;77=NA;99=NA",as.factor=T)
brfss2017$emosupport<-Recode(brfss2017$EMTSUPRT,recodes="1:2='a-Yes';3='b-Sometimes';4:5='c-No';else=NA",as.factor=T)
brfss2017$satisfed<-Recode(brfss2017$LSATISFY,recodes="1:2='a-Satisfied';3:4='b-Dissatisfied';else=NA",as.factor=T)
brfss2017$employ<-Recode(brfss2017$EMPLOY1,recodes="1:2='Yes';3:4='No';5:8='other';else=NA",as.factor=T)
brfss2017$personalDR<-Recode(brfss2017$PERSDOC2,recodes="1:2='Yes';3='No';else=NA",as.factor=T)
brfss2017$chol<-Recode(brfss2017$CHOLCHK1,recodes="1='N/2yr+';3:7='N/2yr+';2='Within 1yr';else=NA",as.factor=T)
brfss2017$seatblt<-Recode(brfss2017$SEATBELT,recodes="1='Yes';2:7='Sometimes/No';else=NA",as.factor=T)
brfss2017$flushot<-Recode(brfss2017$FLUSHOT6,recode="1='Yes';2='No';else=NA",as.factor=T)
brfss2017$HIVrisk<-Recode(brfss2017$HIVRISK5,recode="1='HighRisk';2='LowRisk';else=NA",as.factor=T)
brfss2017$money4bills<-Recode(brfss2017$SDHMONEY,recode="1='More';2='Exact';3='No';else=NA",as.factor=T)
#str(brfss2017$int1)
#brfss2017 <- brfss2017[complete.cases(brfss2017), ]
#dplyr::select
brfss2017 <- brfss2017 %>%  
  select(genh,sxorient,marital,badmental,int,sex,age,race,educ,income,smoke,drinks,choles,blpressure,bmi,medcost,hlthinsur,checkup,ownhome,safeneigh,physh,menth,emosupport,satisfed,employ,personalDR,chol,seatblt,flushot,HIVrisk,money4bills,X_STRWT,X_LLCPWT)
brfss2017 <- brfss2017 %>% 
  subset(sxorient=='b-Gay')
table(brfss2017$sxorient)
## 
## a-Straight      b-Gay   Bisexual      Other 
##          0       3167          0          0
#Create a survey design
brfss2017%>%
  filter(complete.cases(.))
##     genh sxorient   marital badmental             int sex   age   race
## 1  aGood    b-Gay  a-Single         0  a-Single.b-Gay   1 45-54 awhite
## 2  aGood    b-Gay   c-D/W/S         0   c-D/W/S.b-Gay   1 55-64 awhite
## 3  aGood    b-Gay   c-D/W/S         0   c-D/W/S.b-Gay   0   65+ awhite
## 4  aGood    b-Gay  a-Single         0  a-Single.b-Gay   1 55-64 awhite
## 5  aGood    b-Gay b-Married         0 b-Married.b-Gay   0   65+ awhite
## 6  aGood    b-Gay  a-Single         0  a-Single.b-Gay   0   65+ awhite
## 7  aGood    b-Gay b-Married         0 b-Married.b-Gay   1   65+ awhite
## 8  aGood    b-Gay   c-D/W/S         0   c-D/W/S.b-Gay   1   65+ awhite
## 9  aGood    b-Gay  a-Single         0  a-Single.b-Gay   1 55-64 awhite
## 10 aGood    b-Gay  a-Single         0  a-Single.b-Gay   1   65+ awhite
## 11 aGood    b-Gay   c-D/W/S         1   c-D/W/S.b-Gay   0   65+ awhite
## 12 aGood    b-Gay  a-Single         0  a-Single.b-Gay   0 35-44 awhite
## 13 aGood    b-Gay  a-Single         0  a-Single.b-Gay   1 35-44 awhite
## 14 aGood    b-Gay  a-Single         0  a-Single.b-Gay   0   65+ awhite
## 15 aGood    b-Gay b-Married         0 b-Married.b-Gay   1 55-64 awhite
## 16 aGood    b-Gay  a-Single         1  a-Single.b-Gay   1 55-64 awhite
## 17   Bad    b-Gay   c-D/W/S         1   c-D/W/S.b-Gay   0 45-54 awhite
## 18 aGood    b-Gay   c-D/W/S         0   c-D/W/S.b-Gay   1   65+ awhite
## 19   Bad    b-Gay  a-Single         1  a-Single.b-Gay   0 55-64 awhite
## 20 aGood    b-Gay  a-Single         1  a-Single.b-Gay   1 25-34 awhite
## 21 aGood    b-Gay   partner         0   partner.b-Gay   1   65+ awhite
## 22 aGood    b-Gay b-Married         0 b-Married.b-Gay   0 45-54 awhite
## 23 aGood    b-Gay b-Married         0 b-Married.b-Gay   0 55-64 awhite
## 24 aGood    b-Gay   c-D/W/S         0   c-D/W/S.b-Gay   1   65+ awhite
## 25   Bad    b-Gay  a-Single         0  a-Single.b-Gay   1 55-64 awhite
## 26 aGood    b-Gay  a-Single         1  a-Single.b-Gay   1 55-64 awhite
## 27 aGood    b-Gay  a-Single         1  a-Single.b-Gay   0 25-34 awhite
## 28 aGood    b-Gay b-Married         1 b-Married.b-Gay   1 25-34 awhite
## 29 aGood    b-Gay   partner         0   partner.b-Gay   0 55-64 awhite
## 30 aGood    b-Gay   c-D/W/S         0   c-D/W/S.b-Gay   1 55-64 awhite
## 31 aGood    b-Gay b-Married         1 b-Married.b-Gay   0 35-44  other
##        educ    income smoke drinks choles blpressure bmi medcost hlthinsur
## 1  4colgrad      >75k     N    1-5      N          Y   4       N         Y
## 2  4colgrad      >75k     N    1-5      Y          Y   4       N         Y
## 3  4colgrad      >75k     N    1-5      Y          Y   4       N         Y
## 4  4colgrad      >75k     N    1-5      N          Y   4       N         Y
## 5   2hsgrad $20k<$35k     N    1-5      Y          Y   4       N         Y
## 6  4colgrad    50k<75     N    1-5      N          Y   4       N         Y
## 7  4colgrad      >75k     N    1-5      Y          Y   3       N         Y
## 8  3somecol $20k<$35k     N    1-5      N          Y   3       N         Y
## 9  4colgrad      >75k     N    1-5      N          Y   2       N         Y
## 10 4colgrad $20k<$35k     N    1-5      N          N   2       N         Y
## 11 3somecol     <$20k     N    1-5      N          Y   3       N         Y
## 12 4colgrad   35k<50k     Y    1-5      Y          N   4       Y         Y
## 13 4colgrad      >75k     N    1-5      N          Y   3       N         Y
## 14 3somecol     <$20k     Y    1-5      Y          Y   1       N         Y
## 15 4colgrad      >75k     N    1-5      Y          Y   3       N         Y
## 16  1somehs     <$20k     Y    1-5      Y          Y   4       N         Y
## 17 3somecol     <$20k     N    1-5      N          Y   4       N         Y
## 18 4colgrad   35k<50k     Y    1-5      N          Y   2       N         Y
## 19    0Prim     <$20k     Y    1-5      Y          Y   1       N         Y
## 20 4colgrad    50k<75     Y   5-10      Y          N   4       N         N
## 21 3somecol $20k<$35k     Y    1-5      N          Y   3       N         Y
## 22 4colgrad      >75k     N    1-5      N          N   4       N         Y
## 23 4colgrad    50k<75     N    1-5      N          Y   4       N         Y
## 24  1somehs   35k<50k     N    1-5      Y          Y   4       N         Y
## 25 4colgrad     <$20k     Y    1-5      Y          Y   4       N         Y
## 26  2hsgrad     <$20k     N    1-5      N          Y   4       N         Y
## 27 4colgrad      >75k     N    1-5      N          N   2       N         Y
## 28 3somecol $20k<$35k     N    1-5      N          N   3       N         Y
## 29 4colgrad      >75k     N    1-5      Y          Y   2       N         Y
## 30 3somecol     <$20k     N    1-5      Y          Y   4       N         Y
## 31 3somecol      >75k     Y    1-5      N          Y   4       Y         Y
##     checkup ownhome safeneigh physh menth  emosupport       satisfed
## 1   2 years       Y      Safe     0     0       a-Yes    a-Satisfied
## 2    1 year       Y      Safe     0     0       a-Yes    a-Satisfied
## 3    1 year       Y      Safe     0     0       a-Yes    a-Satisfied
## 4    1 year       Y      Safe     0     0       a-Yes    a-Satisfied
## 5    1 year       Y      Safe     0     0       a-Yes    a-Satisfied
## 6    1 year       Y      Safe     7     0       a-Yes    a-Satisfied
## 7    1 year       Y      Safe     0     0       a-Yes    a-Satisfied
## 8    1 year       Y      Safe     0     0 b-Sometimes    a-Satisfied
## 9    1 year       Y      Safe    30     0       a-Yes    a-Satisfied
## 10   1 year       Y      Safe     0     0 b-Sometimes    a-Satisfied
## 11  2 years       Y      Safe     0     2        c-No    a-Satisfied
## 12  5 years       Y      Safe     5     0       a-Yes    a-Satisfied
## 13   1 year       N      Safe     5     0       a-Yes    a-Satisfied
## 14  2 years       Y      Safe     0     0        c-No    a-Satisfied
## 15   1 year       Y      Safe     0     0       a-Yes    a-Satisfied
## 16   1 year       N      Safe    30    30        c-No b-Dissatisfied
## 17   1 year       Y      Safe    28    15 b-Sometimes    a-Satisfied
## 18   1 year       Y      Safe     0     0 b-Sometimes b-Dissatisfied
## 19   1 year       N      Safe    20    10       a-Yes    a-Satisfied
## 20   1 year       N      Safe     2     1       a-Yes    a-Satisfied
## 21   1 year       N      Safe     5     0        c-No    a-Satisfied
## 22   1 year       Y      Safe     0     0       a-Yes    a-Satisfied
## 23   1 year       Y      Safe     0     0       a-Yes    a-Satisfied
## 24   1 year       Y      Safe    10     0       a-Yes    a-Satisfied
## 25   1 year       N      Safe     7     0       a-Yes    a-Satisfied
## 26   1 year       Y      Safe     3     7       a-Yes    a-Satisfied
## 27   1 year       Y      Safe     0     5       a-Yes    a-Satisfied
## 28 5+ years       N      Safe     1     1       a-Yes    a-Satisfied
## 29   1 year       Y      Safe     0     0       a-Yes    a-Satisfied
## 30   1 year       Y    Unsafe     2     0       a-Yes    a-Satisfied
## 31   1 year       N      Safe     0     7       a-Yes    a-Satisfied
##    employ personalDR       chol      seatblt flushot  HIVrisk money4bills
## 1     Yes        Yes     N/2yr+          Yes      No  LowRisk        More
## 2     Yes        Yes Within 1yr          Yes     Yes HighRisk       Exact
## 3     Yes        Yes Within 1yr          Yes      No  LowRisk        More
## 4   other        Yes Within 1yr          Yes     Yes  LowRisk        More
## 5   other        Yes Within 1yr          Yes     Yes  LowRisk       Exact
## 6   other        Yes Within 1yr          Yes     Yes  LowRisk        More
## 7   other        Yes Within 1yr          Yes      No  LowRisk        More
## 8   other        Yes Within 1yr          Yes      No  LowRisk       Exact
## 9   other        Yes Within 1yr          Yes      No  LowRisk        More
## 10    Yes        Yes Within 1yr          Yes     Yes HighRisk          No
## 11    Yes         No     N/2yr+          Yes     Yes  LowRisk       Exact
## 12    Yes         No     N/2yr+          Yes      No  LowRisk       Exact
## 13    Yes        Yes Within 1yr          Yes      No HighRisk        More
## 14  other        Yes     N/2yr+          Yes      No  LowRisk        More
## 15    Yes        Yes Within 1yr          Yes     Yes  LowRisk        More
## 16     No        Yes Within 1yr          Yes     Yes  LowRisk          No
## 17  other        Yes Within 1yr          Yes     Yes  LowRisk          No
## 18  other        Yes Within 1yr          Yes      No  LowRisk       Exact
## 19  other        Yes Within 1yr          Yes     Yes  LowRisk          No
## 20    Yes        Yes Within 1yr          Yes      No HighRisk       Exact
## 21  other        Yes Within 1yr          Yes     Yes  LowRisk       Exact
## 22    Yes        Yes Within 1yr          Yes     Yes  LowRisk       Exact
## 23  other        Yes Within 1yr          Yes     Yes  LowRisk        More
## 24  other        Yes Within 1yr Sometimes/No      No HighRisk        More
## 25  other        Yes Within 1yr          Yes      No  LowRisk       Exact
## 26    Yes        Yes     N/2yr+ Sometimes/No      No  LowRisk        More
## 27    Yes        Yes Within 1yr          Yes      No HighRisk        More
## 28    Yes         No     N/2yr+          Yes      No HighRisk       Exact
## 29  other        Yes Within 1yr          Yes      No  LowRisk        More
## 30  other        Yes Within 1yr          Yes      No  LowRisk       Exact
## 31    Yes        Yes Within 1yr          Yes      No  LowRisk        More
##      X_STRWT   X_LLCPWT
## 1   21.74020  538.30762
## 2   21.74020   95.06265
## 3   13.30360   53.45304
## 4   22.82476   79.98952
## 5   21.74020  287.86580
## 6   21.74020   64.76206
## 7   13.14636   98.82987
## 8   21.74020  137.28997
## 9   13.14636   56.78258
## 10  67.43929  230.58637
## 11  67.43929  522.52499
## 12  67.43929  469.54269
## 13  67.43929  261.12408
## 14  67.43929  516.14330
## 15  67.43929  214.49235
## 16  67.43929  589.95251
## 17  67.43929  730.02556
## 18  67.43929  249.68454
## 19  27.94482  199.01761
## 20  27.94482  113.94125
## 21  11.58969   36.81910
## 22  27.94482   93.95368
## 23  27.94482   83.59105
## 24  12.37312  122.76381
## 25  97.75916  168.77126
## 26  39.23976  157.68665
## 27 126.24787  585.74339
## 28 494.53985 2133.25829
## 29 154.35401  363.37455
## 30 349.16801 2386.52211
## 31 154.35401  384.96429
options(survey.lonely.psu = "adjust")
des<-svydesign(ids = ~1,strata=~X_STRWT,weights = ~X_LLCPWT,data = brfss2017)
table(brfss2017$genh)
## 
## aGood   Bad 
##  2569   595
#MODEL ONE
#General Health by Marital Status
fit.logit1<-svyglm(genh~marital,design=des,family=binomial)
## Warning in eval(family$initialize): non-integer #successes in a binomial
## glm!
summary(fit.logit1)
## 
## Call:
## svyglm(formula = genh ~ marital, design = des, family = binomial)
## 
## Survey design:
## svydesign(ids = ~1, strata = ~X_STRWT, weights = ~X_LLCPWT, data = brfss2017)
## 
## Coefficients:
##                  Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      -1.76399    0.11489 -15.354  < 2e-16 ***
## maritalb-Married -0.09431    0.23311  -0.405 0.685827    
## maritalc-D/W/S    0.86897    0.23562   3.688 0.000231 ***
## maritalpartner    0.19801    0.27475   0.721 0.471164    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1.003631)
## 
## Number of Fisher Scoring iterations: 4
#MODEL TWO - includes biological demographic variables
#General Health by marital status and sex, age, race
fit.logit2<-svyglm(genh~marital+sex+age+race,design=des,family=binomial)
## Warning in eval(family$initialize): non-integer #successes in a binomial
## glm!
summary(fit.logit2)
## 
## Call:
## svyglm(formula = genh ~ marital + sex + age + race, design = des, 
##     family = binomial)
## 
## Survey design:
## svydesign(ids = ~1, strata = ~X_STRWT, weights = ~X_LLCPWT, data = brfss2017)
## 
## Coefficients:
##                  Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      -2.08866    0.26918  -7.759 1.24e-14 ***
## maritalb-Married -0.47988    0.27255  -1.761 0.078413 .  
## maritalc-D/W/S    0.40622    0.26122   1.555 0.120057    
## maritalpartner   -0.01209    0.30836  -0.039 0.968716    
## sex1             -0.45024    0.18392  -2.448 0.014434 *  
## age25-34          0.52009    0.33479   1.553 0.120435    
## age35-44          0.80618    0.37225   2.166 0.030431 *  
## age45-54          0.92709    0.35536   2.609 0.009138 ** 
## age55-64          1.01325    0.33699   3.007 0.002667 ** 
## age65+            1.22290    0.34903   3.504 0.000467 ***
## raceblack         0.06559    0.25640   0.256 0.798104    
## racehispanic      0.23475    0.27767   0.845 0.397946    
## raceother        -0.32375    0.29244  -1.107 0.268384    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1.010438)
## 
## Number of Fisher Scoring iterations: 4
regTermTest(fit.logit2, test.terms = ~sex+age+race, method="Wald", df = NULL)
## Wald test for sex age race
##  in svyglm(formula = genh ~ marital + sex + age + race, design = des, 
##     family = binomial)
## F =  2.728861  on  9  and  2461  df: p= 0.0036133
####MODEL THREE - includes biological demographic variables and social demographic variables 
#General Health by Marital Status plus sex, age, race, plus educ, income
fit.logit3<-svyglm(genh~marital+sex+age+race+educ+income,design=des,family=binomial)
## Warning in eval(family$initialize): non-integer #successes in a binomial
## glm!
summary(fit.logit3)
## 
## Call:
## svyglm(formula = genh ~ marital + sex + age + race + educ + income, 
##     design = des, family = binomial)
## 
## Survey design:
## svydesign(ids = ~1, strata = ~X_STRWT, weights = ~X_LLCPWT, data = brfss2017)
## 
## Coefficients:
##                  Estimate Std. Error t value Pr(>|t|)    
## (Intercept)       -1.0479     1.0319  -1.016 0.309955    
## maritalb-Married   0.1036     0.2974   0.348 0.727609    
## maritalc-D/W/S     0.2963     0.2967   0.999 0.318074    
## maritalpartner     0.2714     0.3246   0.836 0.403167    
## sex1              -0.4393     0.1937  -2.268 0.023450 *  
## age25-34           0.5866     0.3824   1.534 0.125173    
## age35-44           0.9393     0.4097   2.293 0.021948 *  
## age45-54           1.2165     0.3856   3.155 0.001626 ** 
## age55-64           1.2605     0.3674   3.431 0.000613 ***
## age65+             1.2612     0.3970   3.177 0.001510 ** 
## raceblack         -0.5118     0.2887  -1.773 0.076383 .  
## racehispanic      -0.1761     0.3163  -0.557 0.577682    
## raceother         -0.4417     0.3387  -1.304 0.192401    
## educ1somehs        0.0633     1.0286   0.062 0.950938    
## educ2hsgrad       -0.2050     0.9777  -0.210 0.833946    
## educ3somecol      -0.3705     0.9853  -0.376 0.706963    
## educ4colgrad      -0.5396     1.0004  -0.539 0.589691    
## income>75k        -2.1150     0.3442  -6.144 9.54e-10 ***
## income$20k<$35k   -0.7819     0.2663  -2.936 0.003359 ** 
## income35k<50k     -0.6766     0.3089  -2.190 0.028629 *  
## income50k<75      -1.1454     0.3058  -3.746 0.000185 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1.012634)
## 
## Number of Fisher Scoring iterations: 5
regTermTest(fit.logit3, test.terms = ~sex+age+race+educ+income, method="Wald", df = NULL)
## Wald test for sex age race educ income
##  in svyglm(formula = genh ~ marital + sex + age + race + educ + income, 
##     design = des, family = binomial)
## F =  4.904605  on  17  and  2183  df: p= 1.6174e-10
#MODEL FOUR -includes biological and social demographic variables plus marriage behavior benefit variables
fit.logit4<-svyglm(genh~marital+sex+age+race+educ+income+smoke+drinks+bmi,design=des,family=binomial)
## Warning in eval(family$initialize): non-integer #successes in a binomial
## glm!
summary(fit.logit4)
## 
## Call:
## svyglm(formula = genh ~ marital + sex + age + race + educ + income + 
##     smoke + drinks + bmi, design = des, family = binomial)
## 
## Survey design:
## svydesign(ids = ~1, strata = ~X_STRWT, weights = ~X_LLCPWT, data = brfss2017)
## 
## Coefficients:
##                  Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      -1.09019    1.69540  -0.643 0.520511    
## maritalb-Married -0.37293    0.45732  -0.815 0.415201    
## maritalc-D/W/S    0.53286    0.51027   1.044 0.296876    
## maritalpartner    0.25934    0.47837   0.542 0.587973    
## sex1             -0.44957    0.37925  -1.185 0.236428    
## age25-34          0.73967    0.74645   0.991 0.322215    
## age35-44          0.49478    0.82676   0.598 0.549810    
## age45-54          1.63604    0.78452   2.085 0.037553 *  
## age55-64          0.89379    0.76199   1.173 0.241379    
## age65+            1.65724    0.80671   2.054 0.040478 *  
## raceblack        -0.70918    0.60365  -1.175 0.240641    
## racehispanic      0.29432    0.58306   0.505 0.613942    
## raceother        -0.57160    0.53258  -1.073 0.283689    
## educ1somehs      -1.26233    1.50372  -0.839 0.401617    
## educ2hsgrad      -1.12342    1.34913  -0.833 0.405423    
## educ3somecol     -1.17521    1.31509  -0.894 0.371958    
## educ4colgrad     -0.93540    1.34326  -0.696 0.486534    
## income>75k       -2.04647    0.59591  -3.434 0.000645 ***
## income$20k<$35k  -0.13749    0.50576  -0.272 0.785848    
## income35k<50k    -0.54114    0.62158  -0.871 0.384405    
## income50k<75     -1.19088    0.58038  -2.052 0.040716 *  
## smokeY            0.44289    0.37968   1.166 0.243989    
## drinks10-30      -0.36645    0.86829  -0.422 0.673188    
## drinks5-10        0.26220    0.48599   0.540 0.589769    
## bmi               0.07803    0.21592   0.361 0.717968    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1.11061)
## 
## Number of Fisher Scoring iterations: 5
regTermTest(fit.logit4, test.terms = ~sex+age+race+educ+income+smoke+drinks+bmi, method="Wald", df = NULL)
## Wald test for sex age race educ income smoke drinks bmi
##  in svyglm(formula = genh ~ marital + sex + age + race + educ + income + 
##     smoke + drinks + bmi, design = des, family = binomial)
## F =  2.82611  on  21  and  487  df: p= 3.4977e-05
#MODEL FIVE - includes biological and social demographic variables plus marriage behavior benefit variables marriage benefit medical variables
fit.logit5<-svyglm(genh~marital+sex+age+race+educ+income+smoke+drinks+bmi+medcost+hlthinsur+checkup,design=des,family=binomial)
## Warning in eval(family$initialize): non-integer #successes in a binomial
## glm!
summary(fit.logit5)
## 
## Call:
## svyglm(formula = genh ~ marital + sex + age + race + educ + income + 
##     smoke + drinks + bmi + medcost + hlthinsur + checkup, design = des, 
##     family = binomial)
## 
## Survey design:
## svydesign(ids = ~1, strata = ~X_STRWT, weights = ~X_LLCPWT, data = brfss2017)
## 
## Coefficients:
##                  Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      -3.24857    1.63455  -1.987 0.047445 *  
## maritalb-Married -0.13397    0.43818  -0.306 0.759937    
## maritalc-D/W/S    0.67140    0.51602   1.301 0.193847    
## maritalpartner    0.03095    0.50205   0.062 0.950864    
## sex1             -0.28874    0.34022  -0.849 0.396485    
## age25-34          1.15696    0.74390   1.555 0.120548    
## age35-44          0.68900    0.79211   0.870 0.384828    
## age45-54          2.06463    0.78729   2.622 0.009009 ** 
## age55-64          1.38682    0.77907   1.780 0.075695 .  
## age65+            2.46466    0.84363   2.921 0.003649 ** 
## raceblack        -0.66682    0.67638  -0.986 0.324703    
## racehispanic      0.05070    0.53994   0.094 0.925222    
## raceother         0.09799    0.56782   0.173 0.863062    
## educ1somehs      -1.32517    1.58826  -0.834 0.404498    
## educ2hsgrad      -0.70928    1.20755  -0.587 0.557235    
## educ3somecol     -0.52006    1.19919  -0.434 0.664719    
## educ4colgrad     -0.53345    1.23004  -0.434 0.664714    
## income>75k       -2.39273    0.66967  -3.573 0.000389 ***
## income$20k<$35k  -0.60036    0.55689  -1.078 0.281546    
## income35k<50k    -1.19463    0.57432  -2.080 0.038053 *  
## income50k<75     -1.35534    0.64492  -2.102 0.036115 *  
## smokeY            0.68895    0.37570   1.834 0.067310 .  
## drinks10-30       0.07147    0.84985   0.084 0.933012    
## drinks5-10        0.19304    0.53533   0.361 0.718563    
## bmi               0.04824    0.20627   0.234 0.815183    
## medcostY          1.86801    0.46969   3.977 8.06e-05 ***
## hlthinsurY        1.14366    0.66443   1.721 0.085853 .  
## checkup2 years   -1.25231    0.56869  -2.202 0.028137 *  
## checkup5 years   -0.65965    0.63665  -1.036 0.300672    
## checkup5+ years   0.44459    0.60820   0.731 0.465145    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 0.9953725)
## 
## Number of Fisher Scoring iterations: 6
regTermTest(fit.logit5, test.terms = ~sex+age+race+educ+income+smoke+drinks+bmi+medcost+hlthinsur+checkup, method="Wald", df = NULL)
## Wald test for sex age race educ income smoke drinks bmi medcost hlthinsur checkup
##  in svyglm(formula = genh ~ marital + sex + age + race + educ + income + 
##     smoke + drinks + bmi + medcost + hlthinsur + checkup, design = des, 
##     family = binomial)
## F =  3.340716  on  26  and  477  df: p= 1.1173e-07
#MODEL SIX - includes biological and social demographic variables plus marriage behavior, medical, and social benefit variables
fit.logit6<-svyglm(genh~marital+sex+age+race+educ+income+smoke+drinks+bmi+medcost+hlthinsur+checkup+ownhome+safeneigh,design=des,family=binomial)
## Warning in eval(family$initialize): non-integer #successes in a binomial
## glm!
summary(fit.logit6)
## 
## Call:
## svyglm(formula = genh ~ marital + sex + age + race + educ + income + 
##     smoke + drinks + bmi + medcost + hlthinsur + checkup + ownhome + 
##     safeneigh, design = des, family = binomial)
## 
## Survey design:
## svydesign(ids = ~1, strata = ~X_STRWT, weights = ~X_LLCPWT, data = brfss2017)
## 
## Coefficients:
##                  Estimate Std. Error t value Pr(>|t|)    
## (Intercept)       3.57516    4.50679   0.793 0.429353    
## maritalb-Married -2.57658    0.86902  -2.965 0.003726 ** 
## maritalc-D/W/S    0.78224    0.96944   0.807 0.421497    
## maritalpartner   -1.50125    0.93981  -1.597 0.113098    
## sex1             -1.81042    0.61458  -2.946 0.003946 ** 
## age25-34          0.63990    1.58806   0.403 0.687784    
## age35-44         -3.28065    2.01465  -1.628 0.106355    
## age45-54          2.53663    1.47103   1.724 0.087499 .  
## age55-64          1.07662    1.70687   0.631 0.529530    
## age65+            3.63355    1.65046   2.202 0.029825 *  
## raceblack        -3.13185    1.44631  -2.165 0.032557 *  
## racehispanic      0.17554    1.17695   0.149 0.881716    
## raceother         3.06107    1.25008   2.449 0.015947 *  
## educ1somehs      -7.19155    4.05792  -1.772 0.079177 .  
## educ2hsgrad      -5.10949    3.58191  -1.426 0.156617    
## educ3somecol     -5.13069    3.69867  -1.387 0.168245    
## educ4colgrad     -6.09217    3.80900  -1.599 0.112650    
## income>75k       -0.81916    1.06054  -0.772 0.441567    
## income$20k<$35k   0.01275    0.91843   0.014 0.988953    
## income35k<50k    -1.57516    1.01629  -1.550 0.124090    
## income50k<75      0.09722    1.08261   0.090 0.928610    
## smokeY           -0.38653    0.62550  -0.618 0.537904    
## drinks10-30       2.57456    1.25531   2.051 0.042693 *  
## drinks5-10       -0.69588    1.03353  -0.673 0.502190    
## bmi               0.10430    0.39970   0.261 0.794630    
## medcostY          3.12381    0.87010   3.590 0.000499 ***
## hlthinsurY        0.84812    1.25612   0.675 0.501000    
## checkup2 years   -1.59237    0.97526  -1.633 0.105431    
## checkup5 years   -3.49687    1.73770  -2.012 0.046671 *  
## checkup5+ years  -0.49521    0.86452  -0.573 0.567957    
## ownhomeY         -1.04495    0.82067  -1.273 0.205647    
## safeneighUnsafe   0.25143    0.89546   0.281 0.779418    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 3.107481)
## 
## Number of Fisher Scoring iterations: 7
regTermTest(fit.logit6, test.terms = ~sex+age+race+educ+income+smoke+drinks+bmi+medcost+hlthinsur+checkup+ownhome+safeneigh, method="Wald", df = NULL)
## Wald test for sex age race educ income smoke drinks bmi medcost hlthinsur checkup ownhome safeneigh
##  in svyglm(formula = genh ~ marital + sex + age + race + educ + income + 
##     smoke + drinks + bmi + medcost + hlthinsur + checkup + ownhome + 
##     safeneigh, design = des, family = binomial)
## F =  2.095336  on  28  and  108  df: p= 0.0036576
stargazer(fit.logit1, fit.logit2, fit.logit3,fit.logit4,fit.logit5,fit.logit6,type = "html", style="demography", covariate.labels =c("Married","D/W/S","partner","Male","25-34","35-44","45-54","55-64","65+","Black","Hisp","Other","someHS","HSgrad","someCol","Colgrad","75+","20-35","35-50","50-75","smokeY","drinks10-30","drinks5-10","bmi","medcostY","hlthinsY","CU2","CU5","CU5+","ownhome","safeneighUnsaf"), ci = T )
genh
Model 1 Model 2 Model 3 Model 4 Model 5 Model 6
Married -0.094 -0.480 0.104 -0.373 -0.134 -2.577**
(-0.551, 0.363) (-1.014, 0.054) (-0.479, 0.686) (-1.269, 0.523) (-0.993, 0.725) (-4.280, -0.873)
D/W/S 0.869*** 0.406 0.296 0.533 0.671 0.782
(0.407, 1.331) (-0.106, 0.918) (-0.285, 0.878) (-0.467, 1.533) (-0.340, 1.683) (-1.118, 2.682)
partner 0.198 -0.012 0.271 0.259 0.031 -1.501
(-0.340, 0.737) (-0.616, 0.592) (-0.365, 0.908) (-0.678, 1.197) (-0.953, 1.015) (-3.343, 0.341)
Male -0.450* -0.439* -0.450 -0.289 -1.810**
(-0.811, -0.090) (-0.819, -0.060) (-1.193, 0.294) (-0.956, 0.378) (-3.015, -0.606)
25-34 0.520 0.587 0.740 1.157 0.640
(-0.136, 1.176) (-0.163, 1.336) (-0.723, 2.203) (-0.301, 2.615) (-2.473, 3.752)
35-44 0.806* 0.939* 0.495 0.689 -3.281
(0.077, 1.536) (0.136, 1.742) (-1.126, 2.115) (-0.864, 2.242) (-7.229, 0.668)
45-54 0.927** 1.217** 1.636* 2.065** 2.537
(0.231, 1.624) (0.461, 1.972) (0.098, 3.174) (0.522, 3.608) (-0.347, 5.420)
55-64 1.013** 1.260*** 0.894 1.387 1.077
(0.353, 1.674) (0.540, 1.981) (-0.600, 2.387) (-0.140, 2.914) (-2.269, 4.422)
65+ 1.223*** 1.261** 1.657* 2.465** 3.634*
(0.539, 1.907) (0.483, 2.039) (0.076, 3.238) (0.811, 4.118) (0.399, 6.868)
Black 0.066 -0.512 -0.709 -0.667 -3.132*
(-0.437, 0.568) (-1.078, 0.054) (-1.892, 0.474) (-1.992, 0.659) (-5.967, -0.297)
Hisp 0.235 -0.176 0.294 0.051 0.176
(-0.309, 0.779) (-0.796, 0.444) (-0.848, 1.437) (-1.008, 1.109) (-2.131, 2.482)
Other -0.324 -0.442 -0.572 0.098 3.061*
(-0.897, 0.249) (-1.106, 0.222) (-1.615, 0.472) (-1.015, 1.211) (0.611, 5.511)
someHS 0.063 -1.262 -1.325 -7.192
(-1.953, 2.079) (-4.210, 1.685) (-4.438, 1.788) (-15.145, 0.762)
HSgrad -0.205 -1.123 -0.709 -5.109
(-2.121, 1.711) (-3.768, 1.521) (-3.076, 1.657) (-12.130, 1.911)
someCol -0.370 -1.175 -0.520 -5.131
(-2.302, 1.561) (-3.753, 1.402) (-2.870, 1.830) (-12.380, 2.119)
Colgrad -0.540 -0.935 -0.533 -6.092
(-2.500, 1.421) (-3.568, 1.697) (-2.944, 1.877) (-13.558, 1.373)
75+ -2.115*** -2.046*** -2.393*** -0.819
(-2.790, -1.440) (-3.214, -0.879) (-3.705, -1.080) (-2.898, 1.259)
20-35 -0.782** -0.137 -0.600 0.013
(-1.304, -0.260) (-1.129, 0.854) (-1.692, 0.491) (-1.787, 1.813)
35-50 -0.677* -0.541 -1.195* -1.575
(-1.282, -0.071) (-1.759, 0.677) (-2.320, -0.069) (-3.567, 0.417)
50-75 -1.145*** -1.191* -1.355* 0.097
(-1.745, -0.546) (-2.328, -0.053) (-2.619, -0.091) (-2.025, 2.219)
smokeY 0.443 0.689 -0.387
(-0.301, 1.187) (-0.047, 1.425) (-1.612, 0.839)
drinks10-30 -0.366 0.071 2.575*
(-2.068, 1.335) (-1.594, 1.737) (0.114, 5.035)
drinks5-10 0.262 0.193 -0.696
(-0.690, 1.215) (-0.856, 1.242) (-2.722, 1.330)
bmi 0.078 0.048 0.104
(-0.345, 0.501) (-0.356, 0.453) (-0.679, 0.888)
medcostY 1.868*** 3.124***
(0.947, 2.789) (1.418, 4.829)
hlthinsY 1.144 0.848
(-0.159, 2.446) (-1.614, 3.310)
CU2 -1.252* -1.592
(-2.367, -0.138) (-3.504, 0.319)
CU5 -0.660 -3.497*
(-1.907, 0.588) (-6.903, -0.091)
CU5+ 0.445 -0.495
(-0.747, 1.637) (-2.190, 1.199)
ownhome -1.045
(-2.653, 0.564)
safeneighUnsaf 0.251
(-1.504, 2.006)
Constant -1.764*** -2.089*** -1.048 -1.090 -3.249* 3.575
(-1.989, -1.539) (-2.616, -1.561) (-3.070, 0.974) (-4.413, 2.233) (-6.452, -0.045) (-5.258, 12.408)
N 3,143 3,100 2,811 889 881 258
Log Likelihood -1,268.652 -1,222.661 -974.462 -293.681 -258.416 -40.791
AIC 2,545.304 2,471.323 1,990.924 637.362 576.833 145.581
p < .05; p < .01; p < .001
car::vif(fit.logit6)
##                 GVIF Df GVIF^(1/(2*Df))
## marital    21.514784  3        1.667719
## sex         2.199551  1        1.483088
## age       540.611020  5        1.876240
## race       20.224544  3        1.650618
## educ       42.315357  4        1.597027
## income     42.912141  4        1.599825
## smoke       2.364973  1        1.537847
## drinks      9.860776  2        1.772057
## bmi         3.000467  1        1.732186
## medcost     4.652115  1        2.156876
## hlthinsur   5.177888  1        2.275497
## checkup    11.534037  3        1.503131
## ownhome     5.499614  1        2.345126
## safeneigh   2.463188  1        1.569455