Read Manipulated Survey Data

y2003=read.csv("D:/Jose/y2003.csv")
y2004=read.csv("D:/Jose/y2004.csv")
y2005=read.csv("D:/Jose/y2005.csv")
y2006=read.csv("D:/Jose/y2006.csv")
y2007=read.csv("D:/Jose/y2007.csv")
y2008=read.csv("D:/Jose/y2008.csv")
y2009=read.csv("D:/Jose/y2009.csv")
y2010=read.csv("D:/Jose/y2010.csv")
y2011=read.csv("D:/Jose/y2011.csv")
y2012=read.csv("D:/Jose/y2012.csv")
y2013=read.csv("D:/Jose/y2013.csv")
y2014=read.csv("D:/Jose/y2014.csv")
y2015=read.csv("D:/Jose/y2015.csv")
y2016=read.csv("D:/Jose/y2016.csv")
y2017=read.csv("D:/Jose/y2017.csv")
y2018=read.csv("D:/Jose/y2018.csv")
y2019=read.csv("D:/Jose/y2019.csv")


y2003$Age[y2003$Age==0]=1

Apply Survey Weights and Design

# Set options for allowing a single observation per stratum
options(survey.lonely.psu = "adjust")

makesurvey=function(surveydata){
  mysurvey <- svydesign(
  id=~1,
  strata = ~Stratum,
  weights = ~Weights,
  data = surveydata)
  return(mysurvey)
}

#Build complex weighted survey lists

svy2003=makesurvey(y2003)
svy2004=makesurvey(y2004)
svy2005=makesurvey(y2005)
svy2006=makesurvey(y2006)
svy2007=makesurvey(y2007)
svy2008=makesurvey(y2008)
svy2009=makesurvey(y2009)
svy2010=makesurvey(y2010)
svy2011=makesurvey(y2011)
svy2012=makesurvey(y2012)
svy2013=makesurvey(y2013)
svy2014=makesurvey(y2014)
svy2015=makesurvey(y2015)
svy2016=makesurvey(y2016)
svy2017=makesurvey(y2017)
svy2018=makesurvey(y2018)
svy2019=makesurvey(y2019)

Plot Function

myplot=function(mydf,q){
  mynames=c("Overweight+Obese","Heart Disease", "Stroke", 
            "Skin Cancer", "Cancer", 
            "COPD", "Arthritis", 
            "Mental Health", "Kidney Disease", 
            "Diabetes")  
  mydf$Year=round(mydf$Year,0)
  z=ggplot(mydf, aes (x=Year))+
    geom_line(aes(y=Veteran, col="Vet"))+
    geom_line(aes(y=NonVeteran, col="Non-Vet"))+
    geom_smooth(aes(y=Veteran, col="Vet"), size=.2)+
    geom_smooth(aes(y=NonVeteran, col="Non-Vet"), size=.2)+
    scale_fill_continuous(name = "Veteran", labels = c("Vet", "NonVet"))+
    ylab("Proportion")+
    xlab("")+
    xlim(2003,2019)+
    theme(legend.title = element_blank())+
    theme(legend.text = element_text(size = 6))+
    theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))+
    ggtitle(mynames[q])+ 
    theme(plot.title = element_text(size=11))+
    theme(axis.text=element_text(size=6),
        axis.title=element_text(size=6,face="bold"))+
    theme(legend.key.size = unit(.5, "cm"))+
    theme(legend.key.width = unit(0.2,"cm")) 
    
  return(z)
}

Table Overweight + Obese

We build age-adjusted tables below to calculate proportions for vet and non-vet populations.

myf=function(svy){

myvet=ageadjust.direct(count=svytable(BMI~Veteran+Age, svy)[2,],
                       pop=svytable(~Veteran+Age, svy)[2,], 
                       stdpop=svytable(BMI~Age, svy),
                       conf.level=.95
                       )
mynonvet=ageadjust.direct(count=svytable(BMI~Veteran+Age, svy)[1,],
                       pop=svytable(~Veteran+Age, svy)[1,], 
                       stdpop=svytable(BMI~Age, svy),
                       conf.level=.95
                       )
z=rbind(myvet,mynonvet)
return(z[,1])
}

a1=myf(svy2003)
a2=myf(svy2004)
a3=myf(svy2005)
a4=myf(svy2006)
a5=myf(svy2007)
a6=myf(svy2008)
a7=myf(svy2009)
a8=myf(svy2010)
a9=myf(svy2011)
a10=myf(svy2012)
a11=myf(svy2013)
a12=myf(svy2014)
a13=myf(svy2015)
a14=myf(svy2016)
a15=myf(svy2017)
a16=myf(svy2018)
a17=myf(svy2019)

myval=rbind(a1,a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16,a17)


mydf=as.data.frame(cbind(seq(2003,2019),myval))
colnames(mydf)=c("Year", "Veteran", "NonVeteran")
plot0=myplot(mydf, 1)
plot0
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

Table Heart Disease

library(grid)
library(gridExtra)
library(ggplot2)

myf=function(svy){
myvet=ageadjust.direct(count=svytable(HeartDisease~Veteran+Age, svy)[2,],
                       pop=svytable(~Veteran+Age, svy)[2,], 
                       stdpop=svytable(HeartDisease~Age, svy),
                       conf.level=.95
                       )
mynonvet=ageadjust.direct(count=svytable(HeartDisease~Veteran+Age, svy)[1,],
                       pop=svytable(~Veteran+Age, svy)[,1], 
                       stdpop=svytable(HeartDisease~Age, svy),
                       conf.level=.95
                       )
z=rbind(myvet,mynonvet)
return(z[,1])
}

a1=myf(svy2003)
a2=myf(svy2004)
a3=myf(svy2005)
a4=myf(svy2006)
a5=myf(svy2007)
a6=myf(svy2008)
a7=myf(svy2009)
a8=myf(svy2010)
a9=myf(svy2011)
a10=myf(svy2012)
a11=myf(svy2013)
a12=myf(svy2014)
a13=myf(svy2015)
a14=myf(svy2016)
a15=myf(svy2017)
a16=myf(svy2018)
a17=myf(svy2019)

myval=rbind(a1,a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17)


mydf=as.data.frame(cbind(seq(2003,2019),myval))
colnames(mydf)=c("Year", "Veteran", "NonVeteran")
plot1=myplot(mydf, 2)
plot1
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

Table Stroke

myf=function(svy){
myvet=ageadjust.direct(count=svytable(Stroke~Veteran+Age, svy)[2,],
                       pop=svytable(~Veteran+Age, svy)[2,], 
                       stdpop=svytable(Stroke~Age, svy),
                       conf.level=.95
                       )
mynonvet=ageadjust.direct(count=svytable(Stroke~Veteran+Age, svy)[1,],
                       pop=svytable(~Veteran+Age, svy)[1,], 
                       stdpop=svytable(Stroke~Age, svy),
                       conf.level=.95
                       )
z=rbind(myvet,mynonvet)
return(z[,1])
}

a1=myf(svy2003)
a2=myf(svy2004)
a3=myf(svy2005)
a4=myf(svy2006)
a5=myf(svy2007)
a6=myf(svy2008)
a7=myf(svy2009)
a8=myf(svy2010)
a9=myf(svy2011)
a10=myf(svy2012)
a11=myf(svy2013)
a12=myf(svy2014)
a13=myf(svy2015)
a14=myf(svy2016)
a15=myf(svy2017)
a16=myf(svy2018)
a17=myf(svy2019)

myval=rbind(a1,a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17)
mydf=as.data.frame(cbind(seq(2003,2019),myval))
colnames(mydf)=c("Year", "Veteran", "NonVeteran")
plot2=myplot(mydf, 3)
plot2
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

Table Skin Cancer

myf=function(svy){
  
myvet=ageadjust.direct(count=svytable(SkinCancer~Veteran+Age, svy)[2,],
                       pop=svytable(~Veteran+Age, svy)[2,], 
                       stdpop=svytable(SkinCancer~Age, svy),
                       conf.level=.95
                       )
mynonvet=ageadjust.direct(count=svytable(SkinCancer~Veteran+Age, svy)[1,],
                       pop=svytable(~Veteran+Age, svy)[1,], 
                       stdpop=svytable(SkinCancer~Age, svy),
                       conf.level=.95
                       )
z=rbind(myvet,mynonvet)
return(z[,1])
}

#a1=myf(svy2003)
#a2=myf(svy2004)
#a3=myf(svy2005)
#a4=myf(svy2006)
#a5=myf(svy2007)
#a6=myf(svy2008)
#a7=myf(svy2009)
a8=myf(svy2010)
a9=myf(svy2011)
a10=myf(svy2012)
a11=myf(svy2013)
a12=myf(svy2014)
a13=myf(svy2015)
a14=myf(svy2016)
a15=myf(svy2017)
a16=myf(svy2018)
a17=myf(svy2019)

myval=rbind(a8, a9, a10, a11, a12, a13, a14, a15, a16, a17)
mydf=as.data.frame(cbind(seq(2010,2019),myval))
colnames(mydf)=c("Year", "Veteran", "NonVeteran")
plot3=myplot(mydf, 4)
plot3
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

Table Cancer

myf=function(svy){
  
myvet=ageadjust.direct(count=svytable(Cancer~Veteran+Age, svy)[2,],
                       pop=svytable(~Veteran+Age, svy)[2,], 
                       stdpop=svytable(Cancer~Age, svy),
                       conf.level=.95
                       )
mynonvet=ageadjust.direct(count=svytable(Cancer~Veteran+Age, svy)[1,],
                       pop=svytable(~Veteran+Age, svy)[1,], 
                       stdpop=svytable(Cancer~Age, svy),
                       conf.level=.95
                       )
z=rbind(myvet,mynonvet)
return(z[,1])
}

#a1=myf(svy2003)
#a2=myf(svy2004)
#a3=myf(svy2005)
#a4=myf(svy2006)
#a5=myf(svy2007)
#a6=myf(svy2008)
#a7=myf(svy2009)
a8=myf(svy2010)
a9=myf(svy2011)
a10=myf(svy2012)
a11=myf(svy2013)
a12=myf(svy2014)
a13=myf(svy2015)
a14=myf(svy2016)
a15=myf(svy2017)
a16=myf(svy2018)
a17=myf(svy2019)

myval=rbind(a8, a9, a10, a11, a12, a13, a14, a15, a16, a17)
mydf=as.data.frame(cbind(seq(2010,2019),myval))
colnames(mydf)=c("Year", "Veteran", "NonVeteran")
plot4=myplot(mydf, 5)
plot4
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

Table COPD

myf=function(svy){
  
myvet=ageadjust.direct(count=svytable(COPD~Veteran+Age, svy)[2,],
                       pop=svytable(~Veteran+Age, svy)[2,], 
                       stdpop=svytable(COPD~Age, svy),
                       conf.level=.95
                       )
mynonvet=ageadjust.direct(count=svytable(COPD~Veteran+Age, svy)[1,],
                       pop=svytable(~Veteran+Age, svy)[1,], 
                       stdpop=svytable(COPD~Age, svy),
                       conf.level=.95
                       )
z=rbind(myvet,mynonvet)
return(z[,1])
}

#a1=myf(svy2003)
#a2=myf(svy2004)
#a3=myf(svy2005)
#a4=myf(svy2006)
#a5=myf(svy2007)
#a6=myf(svy2008)
#a7=myf(svy2009)
a8=myf(svy2010)
a9=myf(svy2011)
a10=myf(svy2012)
a11=myf(svy2013)
a12=myf(svy2014)
a13=myf(svy2015)
a14=myf(svy2016)
a15=myf(svy2017)
a16=myf(svy2018)
a17=myf(svy2019)

myval=rbind(a8, a9, a10, a11, a12, a13, a14, a15, a16, a17)
mydf=as.data.frame(cbind(seq(2010,2019),myval))
colnames(mydf)=c("Year", "Veteran", "NonVeteran")
plot5=myplot(mydf, 6)
plot5
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

Table Arthritis

myf=function(svy){
  
myvet=ageadjust.direct(count=svytable(Arthritis~Veteran+Age, svy)[2,],
                       pop=svytable(~Veteran+Age, svy)[2,], 
                       stdpop=svytable(Arthritis~Age, svy),
                       conf.level=.95
                       )
mynonvet=ageadjust.direct(count=svytable(Arthritis~Veteran+Age, svy)[1,],
                       pop=svytable(~Veteran+Age, svy)[1,], 
                       stdpop=svytable(Arthritis~Age, svy),
                       conf.level=.95
                       )
z=rbind(myvet,mynonvet)
return(z[,1])
}

#a1=myf(svy2003)
#a2=myf(svy2004)
#a3=myf(svy2005)
#a4=myf(svy2006)
#a5=myf(svy2007)
#a6=myf(svy2008)
a7=myf(svy2009)
a8=myf(svy2010)
a9=myf(svy2011)
a10=myf(svy2012)
a11=myf(svy2013)
a12=myf(svy2014)
a13=myf(svy2015)
a14=myf(svy2016)
a15=myf(svy2017)
a16=myf(svy2018)
a17=myf(svy2019)

myval=rbind(a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17)
mydf=as.data.frame(cbind(seq(2009,2019),myval))
colnames(mydf)=c("Year", "Veteran", "NonVeteran")
plot6=myplot(mydf, 7)
plot6
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

Table Depression

myf=function(svy){
  
myvet=ageadjust.direct(count=svytable(Depression~Veteran+Age, svy)[2,],
                       pop=svytable(~Veteran+Age, svy)[2,], 
                       stdpop=svytable(Depression~Age, svy),
                       conf.level=.95
                       )
mynonvet=ageadjust.direct(count=svytable(Depression~Veteran+Age, svy)[1,],
                       pop=svytable(~Veteran+Age, svy)[1,], 
                       stdpop=svytable(Depression~Age, svy),
                       conf.level=.95
                       )
z=rbind(myvet,mynonvet)
return(z[,1])
}

a1=myf(svy2003)
a2=myf(svy2004)
a3=myf(svy2005)
a4=myf(svy2006)
a5=myf(svy2007)
a6=myf(svy2008)
a7=myf(svy2009)
a8=myf(svy2010)
a9=myf(svy2011)
a10=myf(svy2012)
a11=myf(svy2013)
a12=myf(svy2014)
a13=myf(svy2015)
a14=myf(svy2016)
a15=myf(svy2017)
a16=myf(svy2018)
a17=myf(svy2019)

myval=rbind(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17)
mydf=as.data.frame(cbind(seq(2003,2019),myval))
colnames(mydf)=c("Year", "Veteran", "NonVeteran")
plot7=myplot(mydf, 8)
plot7
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

Table Kidney Disease

myf=function(svy){
  
myvet=ageadjust.direct(count=svytable(KidneyDisease~Veteran+Age, svy)[2,],
                       pop=svytable(~Veteran+Age, svy)[2,], 
                       stdpop=svytable(KidneyDisease~Age, svy),
                       conf.level=.95
                       )
mynonvet=ageadjust.direct(count=svytable(KidneyDisease~Veteran+Age, svy)[1,],
                       pop=svytable(~Veteran+Age, svy)[1,], 
                       stdpop=svytable(KidneyDisease~Age, svy),
                       conf.level=.95
                       )
z=rbind(myvet,mynonvet)
return(z[,1])
}

#a1=myf(svy2003)
#a2=myf(svy2004)
#a3=myf(svy2005)
#a4=myf(svy2006)
#a5=myf(svy2007)
#a6=myf(svy2008)
#a7=myf(svy2009)
#a8=myf(svy2010)
a9=myf(svy2011)
a10=myf(svy2012)
a11=myf(svy2013)
a12=myf(svy2014)
a13=myf(svy2015)
a14=myf(svy2016)
a15=myf(svy2017)
a16=myf(svy2018)
a17=myf(svy2019)

myval=rbind(a9, a10, a11, a12, a13, a14, a15, a17)
mydf=as.data.frame(cbind(seq(2011,2019),myval))
## Warning in cbind(seq(2011, 2019), myval): number of rows of result is not a
## multiple of vector length (arg 1)
colnames(mydf)=c("Year", "Veteran", "NonVeteran")
plot8=myplot(mydf, 9)
plot8
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

Table Diabetes

myf=function(svy){
  
myvet=ageadjust.direct(count=svytable(Diabetes~Veteran+Age, svy)[2,],
                       pop=svytable(~Veteran+Age, svy)[2,], 
                       stdpop=svytable(Diabetes~Age, svy),
                       conf.level=.95
                       )
mynonvet=ageadjust.direct(count=svytable(Diabetes~Veteran+Age, svy)[1,],
                       pop=svytable(~Veteran+Age, svy)[1,], 
                       stdpop=svytable(Diabetes~Age, svy),
                       conf.level=.95
                       )
z=rbind(myvet,mynonvet)
return(z[,1])
}

a1=myf(svy2003)
a2=myf(svy2004)
a3=myf(svy2005)
a4=myf(svy2006)
a5=myf(svy2007)
a6=myf(svy2008)
a7=myf(svy2009)
a8=myf(svy2010)
a9=myf(svy2011)
a10=myf(svy2012)
a11=myf(svy2013)
a12=myf(svy2014)
a13=myf(svy2015)
a14=myf(svy2016)
a15=myf(svy2017)
a16=myf(svy2018)
a17=myf(svy2019)

myval=rbind(a1,a2,a3,a4,a5,a6,a7,a8,a9, a10, a11, a12, a13, a14, a15, a16, a17)
mydf=as.data.frame(cbind(seq(2003,2019),myval))
colnames(mydf)=c("Year", "Veteran", "NonVeteran")
plot9=myplot(mydf, 10)
plot9
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

All Plots Except Obesity

library(ggpubr)
ggarrange(plot1,plot2,plot3,plot4,plot5,plot6,plot7,plot8,plot9, nrow=3, ncol=3)
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

ggarrange(plot2,plot3,plot4,plot5,plot8,plot9, nrow=3, ncol=2)
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

Model 1 BMI

model1<-svyglm(na.omit(BMI~as.factor(Age)+
                        as.factor(Race)+as.factor(Gender)+
                        as.factor(Married)+as.factor(Income)+  
                        as.factor(Education)+
                        as.factor(Employed)+
                        as.factor(State)+
                        as.factor(Veteran)),
                        design=svy2019,
                        family=quasibinomial)
#model1$oddsratios=exp(model1$coefficients) 
#model1$lower=exp(log(model1$oddsratios)-qnorm(.975)*summary(model1)$coefficients[,2])
#model1$upper=exp(log(model1$oddsratios)+qnorm(.975)*summary(model1)$coefficients[,2])
options(digits=3)
write.csv(summary(model1)$coefficients,"d:/jose/obesity.csv")
summary(model1)
## 
## Call:
## svyglm(formula = na.omit(BMI ~ as.factor(Age) + as.factor(Race) + 
##     as.factor(Gender) + as.factor(Married) + as.factor(Income) + 
##     as.factor(Education) + as.factor(Employed) + as.factor(State) + 
##     as.factor(Veteran)), design = svy2019, family = quasibinomial)
## 
## Survey design:
## mysurvey <- svydesign(
##   id=~1,
##   strata = ~Stratum,
##   weights = ~Weights,
##   data = surveydata)
## 
## Coefficients:
##                       Estimate Std. Error t value Pr(>|t|)    
## (Intercept)            0.28476    0.21737    1.31  0.19020    
## as.factor(Age)2        0.59482    0.03238   18.37  < 2e-16 ***
## as.factor(Age)3        0.91423    0.03525   25.93  < 2e-16 ***
## as.factor(Age)4        1.13422    0.03585   31.64  < 2e-16 ***
## as.factor(Age)5        1.06612    0.03614   29.50  < 2e-16 ***
## as.factor(Age)6        0.85451    0.03888   21.98  < 2e-16 ***
## as.factor(Race)2       0.39806    0.02853   13.95  < 2e-16 ***
## as.factor(Race)3      -0.50650    0.04516  -11.22  < 2e-16 ***
## as.factor(Race)4       0.24721    0.06359    3.89  0.00010 ***
## as.factor(Race)5       0.52116    0.03055   17.06  < 2e-16 ***
## as.factor(Race)6       0.12682    0.03946    3.21  0.00131 ** 
## as.factor(Gender)1     0.29387    0.01601   18.35  < 2e-16 ***
## as.factor(Married)2   -0.15772    0.02284   -6.90  5.1e-12 ***
## as.factor(Married)3   -0.26499    0.02573  -10.30  < 2e-16 ***
## as.factor(Married)4   -0.09713    0.05288   -1.84  0.06626 .  
## as.factor(Married)5   -0.22747    0.02370   -9.60  < 2e-16 ***
## as.factor(Married)6   -0.13990    0.03652   -3.83  0.00013 ***
## as.factor(Income)2     0.04620    0.05234    0.88  0.37744    
## as.factor(Income)3     0.05761    0.04625    1.25  0.21289    
## as.factor(Income)4     0.08019    0.04540    1.77  0.07731 .  
## as.factor(Income)5     0.02640    0.04570    0.58  0.56346    
## as.factor(Income)6     0.08033    0.04316    1.86  0.06270 .  
## as.factor(Income)7     0.05755    0.04324    1.33  0.18322    
## as.factor(Income)8    -0.07048    0.04194   -1.68  0.09286 .  
## as.factor(Income)9     0.00766    0.04107    0.19  0.85208    
## as.factor(Education)2 -0.04424    0.21235   -0.21  0.83496    
## as.factor(Education)3 -0.12456    0.21016   -0.59  0.55340    
## as.factor(Education)4 -0.12775    0.20895   -0.61  0.54095    
## as.factor(Education)5 -0.14373    0.20911   -0.69  0.49187    
## as.factor(Education)6 -0.43755    0.20946   -2.09  0.03671 *  
## as.factor(Employed)2  -0.26007    0.02654   -9.80  < 2e-16 ***
## as.factor(Employed)3  -0.11216    0.05406   -2.07  0.03801 *  
## as.factor(Employed)4  -0.08387    0.04841   -1.73  0.08316 .  
## as.factor(Employed)5  -0.13409    0.03393   -3.95  7.7e-05 ***
## as.factor(Employed)6  -0.34727    0.04076   -8.52  < 2e-16 ***
## as.factor(Employed)7  -0.11788    0.02610   -4.52  6.3e-06 ***
## as.factor(Employed)8   0.03284    0.03248    1.01  0.31195    
## as.factor(State)2     -0.08773    0.07397   -1.19  0.23558    
## as.factor(State)4     -0.17704    0.05550   -3.19  0.00142 ** 
## as.factor(State)5      0.03213    0.05996    0.54  0.59204    
## as.factor(State)6     -0.28131    0.04689   -6.00  2.0e-09 ***
## as.factor(State)8     -0.42402    0.04623   -9.17  < 2e-16 ***
## as.factor(State)9     -0.07850    0.04977   -1.58  0.11474    
## as.factor(State)10     0.02512    0.06632    0.38  0.70480    
## as.factor(State)11    -0.45664    0.06675   -6.84  7.9e-12 ***
## as.factor(State)12    -0.24495    0.05302   -4.62  3.8e-06 ***
## as.factor(State)13    -0.10471    0.05683   -1.84  0.06537 .  
## as.factor(State)15    -0.33449    0.05374   -6.22  4.9e-10 ***
## as.factor(State)16    -0.15753    0.06081   -2.59  0.00958 ** 
## as.factor(State)17    -0.16857    0.05222   -3.23  0.00125 ** 
## as.factor(State)18     0.05225    0.04901    1.07  0.28640    
## as.factor(State)19     0.03937    0.04630    0.85  0.39509    
## as.factor(State)20     0.07363    0.04654    1.58  0.11363    
## as.factor(State)21     0.12339    0.05682    2.17  0.02987 *  
## as.factor(State)22     0.03747    0.05708    0.66  0.51152    
## as.factor(State)23    -0.11290    0.05117   -2.21  0.02735 *  
## as.factor(State)24    -0.08779    0.04633   -1.89  0.05812 .  
## as.factor(State)25    -0.21481    0.04951   -4.34  1.4e-05 ***
## as.factor(State)26     0.07665    0.04818    1.59  0.11162    
## as.factor(State)27    -0.05868    0.04346   -1.35  0.17697    
## as.factor(State)28     0.09505    0.05889    1.61  0.10649    
## as.factor(State)29    -0.03748    0.05281   -0.71  0.47781    
## as.factor(State)30    -0.17153    0.05040   -3.40  0.00067 ***
## as.factor(State)31     0.02706    0.04614    0.59  0.55753    
## as.factor(State)32    -0.11054    0.07117   -1.55  0.12037    
## as.factor(State)33     0.01102    0.05747    0.19  0.84792    
## as.factor(State)35    -0.34256    0.05790   -5.92  3.3e-09 ***
## as.factor(State)36    -0.17158    0.04681   -3.67  0.00025 ***
## as.factor(State)37     0.01597    0.05583    0.29  0.77483    
## as.factor(State)38     0.13191    0.05941    2.22  0.02640 *  
## as.factor(State)39     0.03690    0.04932    0.75  0.45433    
## as.factor(State)40     0.11753    0.05401    2.18  0.02956 *  
## as.factor(State)41    -0.16999    0.05148   -3.30  0.00096 ***
## as.factor(State)42     0.00638    0.05189    0.12  0.90216    
## as.factor(State)44    -0.15160    0.05731   -2.65  0.00817 ** 
## as.factor(State)45    -0.03172    0.05249   -0.60  0.54570    
## as.factor(State)46     0.14500    0.06849    2.12  0.03425 *  
## as.factor(State)47     0.00708    0.05577    0.13  0.89904    
## as.factor(State)48    -0.04012    0.05550   -0.72  0.46973    
## as.factor(State)49    -0.15077    0.04570   -3.30  0.00097 ***
## as.factor(State)50    -0.31849    0.05577   -5.71  1.1e-08 ***
## as.factor(State)51    -0.05979    0.04919   -1.22  0.22421    
## as.factor(State)53    -0.13792    0.04564   -3.02  0.00251 ** 
## as.factor(State)54     0.13062    0.05710    2.29  0.02215 *  
## as.factor(State)55     0.05403    0.05773    0.94  0.34937    
## as.factor(State)56    -0.19197    0.05989   -3.21  0.00135 ** 
## as.factor(State)66     0.08060    0.08968    0.90  0.36879    
## as.factor(State)72    -0.37964    0.06055   -6.27  3.6e-10 ***
## as.factor(Veteran)1    0.11359    0.02588    4.39  1.1e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for quasibinomial family taken to be 0.994)
## 
## Number of Fisher Scoring iterations: 5

Model 2

model1<-svyglm(na.omit(HeartDisease~as.factor(Age)+
                        as.factor(Race)+as.factor(Gender)+
                        as.factor(Married)+as.factor(Income)+  
                        as.factor(Education)+
                        as.factor(Employed)+
                        as.factor(State)+
                        as.factor(Veteran)),
                        design=svy2019,
                        family=quasibinomial)
#model1$oddsratios=exp(model1$coefficients) 
#model1$lower=exp(log(model1$oddsratios)-qnorm(.975)*summary(model1)$coefficients[,2])
#model1$upper=exp(log(model1$oddsratios)+qnorm(.975)*summary(model1)$coefficients[,2])
options(digits=3)
write.csv(summary(model1)$coefficients,"d:/jose/heartdisease.csv")
summary(model1)
## 
## Call:
## svyglm(formula = na.omit(HeartDisease ~ as.factor(Age) + as.factor(Race) + 
##     as.factor(Gender) + as.factor(Married) + as.factor(Income) + 
##     as.factor(Education) + as.factor(Employed) + as.factor(State) + 
##     as.factor(Veteran)), design = svy2019, family = quasibinomial)
## 
## Survey design:
## mysurvey <- svydesign(
##   id=~1,
##   strata = ~Stratum,
##   weights = ~Weights,
##   data = surveydata)
## 
## Coefficients:
##                       Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           -4.98044    0.41516  -12.00  < 2e-16 ***
## as.factor(Age)2        0.02026    0.20765    0.10  0.92229    
## as.factor(Age)3        0.75483    0.21370    3.53  0.00041 ***
## as.factor(Age)4        1.65222    0.18775    8.80  < 2e-16 ***
## as.factor(Age)5        2.14713    0.18683   11.49  < 2e-16 ***
## as.factor(Age)6        2.68106    0.19171   13.98  < 2e-16 ***
## as.factor(Race)2      -0.31259    0.05528   -5.65  1.6e-08 ***
## as.factor(Race)3       0.12744    0.16801    0.76  0.44814    
## as.factor(Race)4       0.31732    0.12344    2.57  0.01015 *  
## as.factor(Race)5      -0.33083    0.09813   -3.37  0.00075 ***
## as.factor(Race)6       0.25812    0.08898    2.90  0.00372 ** 
## as.factor(Gender)1     0.55112    0.03448   15.99  < 2e-16 ***
## as.factor(Married)2    0.04950    0.04288    1.15  0.24833    
## as.factor(Married)3    0.15283    0.04182    3.65  0.00026 ***
## as.factor(Married)4    0.17062    0.09376    1.82  0.06881 .  
## as.factor(Married)5   -0.17573    0.05931   -2.96  0.00305 ** 
## as.factor(Married)6   -0.00276    0.10351   -0.03  0.97871    
## as.factor(Income)2     0.00125    0.08391    0.01  0.98809    
## as.factor(Income)3    -0.03480    0.07831   -0.44  0.65675    
## as.factor(Income)4     0.02345    0.08177    0.29  0.77428    
## as.factor(Income)5    -0.10056    0.08156   -1.23  0.21760    
## as.factor(Income)6    -0.20333    0.07940   -2.56  0.01044 *  
## as.factor(Income)7    -0.22759    0.08027   -2.84  0.00458 ** 
## as.factor(Income)8    -0.34699    0.08258   -4.20  2.7e-05 ***
## as.factor(Income)9    -0.28642    0.07717   -3.71  0.00021 ***
## as.factor(Education)2 -0.51787    0.36143   -1.43  0.15190    
## as.factor(Education)3 -0.36940    0.36090   -1.02  0.30605    
## as.factor(Education)4 -0.49321    0.36020   -1.37  0.17092    
## as.factor(Education)5 -0.43106    0.36095   -1.19  0.23238    
## as.factor(Education)6 -0.56632    0.36534   -1.55  0.12111    
## as.factor(Employed)2   0.22455    0.07005    3.21  0.00135 ** 
## as.factor(Employed)3   0.71223    0.09857    7.23  5.0e-13 ***
## as.factor(Employed)4   0.46522    0.12298    3.78  0.00015 ***
## as.factor(Employed)5   0.38388    0.08592    4.47  7.9e-06 ***
## as.factor(Employed)6  -0.46519    0.24650   -1.89  0.05913 .  
## as.factor(Employed)7   0.69207    0.06053   11.43  < 2e-16 ***
## as.factor(Employed)8   1.48937    0.05587   26.66  < 2e-16 ***
## as.factor(State)2     -0.82154    0.16635   -4.94  7.9e-07 ***
## as.factor(State)4     -0.21383    0.10487   -2.04  0.04144 *  
## as.factor(State)5      0.11497    0.09470    1.21  0.22475    
## as.factor(State)6     -0.39410    0.09822   -4.01  6.0e-05 ***
## as.factor(State)8     -0.59354    0.09731   -6.10  1.1e-09 ***
## as.factor(State)9     -0.39988    0.09287   -4.31  1.7e-05 ***
## as.factor(State)10    -0.12047    0.12004   -1.00  0.31558    
## as.factor(State)11    -0.05614    0.13780   -0.41  0.68372    
## as.factor(State)12    -0.12580    0.10191   -1.23  0.21704    
## as.factor(State)13    -0.10147    0.10143   -1.00  0.31712    
## as.factor(State)15    -0.70452    0.13359   -5.27  1.3e-07 ***
## as.factor(State)16    -0.27989    0.11605   -2.41  0.01588 *  
## as.factor(State)17    -0.17184    0.10271   -1.67  0.09430 .  
## as.factor(State)18    -0.05401    0.08580   -0.63  0.52902    
## as.factor(State)19    -0.25483    0.08692   -2.93  0.00337 ** 
## as.factor(State)20    -0.24725    0.08633   -2.86  0.00418 ** 
## as.factor(State)21     0.08182    0.10002    0.82  0.41333    
## as.factor(State)22     0.01027    0.10017    0.10  0.91834    
## as.factor(State)23    -0.10917    0.08765   -1.25  0.21294    
## as.factor(State)24    -0.27845    0.08259   -3.37  0.00075 ***
## as.factor(State)25    -0.14964    0.10048   -1.49  0.13642    
## as.factor(State)26    -0.11904    0.08559   -1.39  0.16428    
## as.factor(State)27    -0.29161    0.08234   -3.54  0.00040 ***
## as.factor(State)28    -0.06039    0.09942   -0.61  0.54355    
## as.factor(State)29    -0.16578    0.09797   -1.69  0.09062 .  
## as.factor(State)30    -0.34369    0.09743   -3.53  0.00042 ***
## as.factor(State)31    -0.22280    0.08316   -2.68  0.00738 ** 
## as.factor(State)32     0.01865    0.16027    0.12  0.90736    
## as.factor(State)33    -0.31905    0.10181   -3.13  0.00173 ** 
## as.factor(State)35    -0.53810    0.11962   -4.50  6.8e-06 ***
## as.factor(State)36    -0.11986    0.09346   -1.28  0.19966    
## as.factor(State)37    -0.07737    0.10428   -0.74  0.45813    
## as.factor(State)38    -0.26926    0.09977   -2.70  0.00696 ** 
## as.factor(State)39    -0.08975    0.08665   -1.04  0.30026    
## as.factor(State)40     0.03684    0.09336    0.39  0.69312    
## as.factor(State)41    -0.34416    0.11449   -3.01  0.00265 ** 
## as.factor(State)42    -0.20002    0.10181   -1.96  0.04945 *  
## as.factor(State)44    -0.18939    0.10381   -1.82  0.06809 .  
## as.factor(State)45    -0.07580    0.09204   -0.82  0.41021    
## as.factor(State)46    -0.10203    0.13880   -0.74  0.46227    
## as.factor(State)47    -0.06143    0.09807   -0.63  0.53107    
## as.factor(State)48    -0.25461    0.10477   -2.43  0.01509 *  
## as.factor(State)49    -0.49071    0.09663   -5.08  3.8e-07 ***
## as.factor(State)50    -0.31329    0.10710   -2.93  0.00344 ** 
## as.factor(State)51    -0.28049    0.08933   -3.14  0.00169 ** 
## as.factor(State)53    -0.34254    0.08737   -3.92  8.8e-05 ***
## as.factor(State)54     0.18911    0.09109    2.08  0.03788 *  
## as.factor(State)55    -0.30704    0.10525   -2.92  0.00353 ** 
## as.factor(State)56    -0.42023    0.12227   -3.44  0.00059 ***
## as.factor(State)66    -0.37118    0.18135   -2.05  0.04068 *  
## as.factor(State)72     0.60215    0.13081    4.60  4.2e-06 ***
## as.factor(Veteran)1    0.29184    0.04527    6.45  1.1e-10 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for quasibinomial family taken to be 0.977)
## 
## Number of Fisher Scoring iterations: 8

Model 3

model1<-svyglm(na.omit(Stroke~as.factor(Age)+
                        as.factor(Race)+as.factor(Gender)+
                        as.factor(Married)+as.factor(Income)+  
                        as.factor(Education)+
                        as.factor(Employed)+
                        as.factor(State)+
                        as.factor(Veteran)),
                        design=svy2019,
                        family=quasibinomial)
#model1$oddsratios=exp(model1$coefficients) 
#model1$lower=exp(log(model1$oddsratios)-qnorm(.975)*summary(model1)$coefficients[,2])
#model1$upper=exp(log(model1$oddsratios)+qnorm(.975)*summary(model1)$coefficients[,2])
options(digits=3)
write.csv(summary(model1)$coefficients,"d:/jose/stroke.csv")
summary(model1)
## 
## Call:
## svyglm(formula = na.omit(Stroke ~ as.factor(Age) + as.factor(Race) + 
##     as.factor(Gender) + as.factor(Married) + as.factor(Income) + 
##     as.factor(Education) + as.factor(Employed) + as.factor(State) + 
##     as.factor(Veteran)), design = svy2019, family = quasibinomial)
## 
## Survey design:
## mysurvey <- svydesign(
##   id=~1,
##   strata = ~Stratum,
##   weights = ~Weights,
##   data = surveydata)
## 
## Coefficients:
##                       Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           -5.36787    0.34590  -15.52  < 2e-16 ***
## as.factor(Age)2        0.77738    0.18926    4.11  4.0e-05 ***
## as.factor(Age)3        1.31336    0.18246    7.20  6.1e-13 ***
## as.factor(Age)4        1.93261    0.17909   10.79  < 2e-16 ***
## as.factor(Age)5        2.20223    0.17971   12.25  < 2e-16 ***
## as.factor(Age)6        2.56595    0.18028   14.23  < 2e-16 ***
## as.factor(Race)2       0.24674    0.05027    4.91  9.2e-07 ***
## as.factor(Race)3       0.18008    0.20374    0.88  0.37677    
## as.factor(Race)4       0.26047    0.10246    2.54  0.01102 *  
## as.factor(Race)5      -0.29474    0.08519   -3.46  0.00054 ***
## as.factor(Race)6       0.33633    0.08833    3.81  0.00014 ***
## as.factor(Gender)1     0.17113    0.03864    4.43  9.5e-06 ***
## as.factor(Married)2    0.16895    0.04659    3.63  0.00029 ***
## as.factor(Married)3    0.23175    0.04750    4.88  1.1e-06 ***
## as.factor(Married)4    0.07212    0.08585    0.84  0.40088    
## as.factor(Married)5    0.07493    0.06268    1.20  0.23187    
## as.factor(Married)6    0.01877    0.10161    0.18  0.85341    
## as.factor(Income)2    -0.00499    0.08746   -0.06  0.95452    
## as.factor(Income)3     0.05551    0.07777    0.71  0.47538    
## as.factor(Income)4    -0.01112    0.08035   -0.14  0.88993    
## as.factor(Income)5    -0.22325    0.08117   -2.75  0.00595 ** 
## as.factor(Income)6    -0.32701    0.08189   -3.99  6.5e-05 ***
## as.factor(Income)7    -0.47073    0.08594   -5.48  4.3e-08 ***
## as.factor(Income)8    -0.71847    0.08982   -8.00  1.3e-15 ***
## as.factor(Income)9    -0.28493    0.07446   -3.83  0.00013 ***
## as.factor(Education)2 -0.05033    0.28289   -0.18  0.85878    
## as.factor(Education)3  0.00360    0.28008    0.01  0.98974    
## as.factor(Education)4 -0.21060    0.27834   -0.76  0.44928    
## as.factor(Education)5 -0.18756    0.27865   -0.67  0.50089    
## as.factor(Education)6 -0.32441    0.28060   -1.16  0.24764    
## as.factor(Employed)2  -0.07469    0.08214   -0.91  0.36317    
## as.factor(Employed)3   0.77803    0.12929    6.02  1.8e-09 ***
## as.factor(Employed)4   0.56006    0.13360    4.19  2.8e-05 ***
## as.factor(Employed)5   0.35127    0.09015    3.90  9.8e-05 ***
## as.factor(Employed)6  -0.29169    0.26738   -1.09  0.27530    
## as.factor(Employed)7   0.78315    0.06435   12.17  < 2e-16 ***
## as.factor(Employed)8   1.73930    0.06688   26.00  < 2e-16 ***
## as.factor(State)2     -0.52476    0.16156   -3.25  0.00116 ** 
## as.factor(State)4     -0.09666    0.11884   -0.81  0.41602    
## as.factor(State)5     -0.05612    0.09826   -0.57  0.56793    
## as.factor(State)6     -0.22912    0.09885   -2.32  0.02046 *  
## as.factor(State)8     -0.37111    0.10205   -3.64  0.00028 ***
## as.factor(State)9     -0.34815    0.11158   -3.12  0.00181 ** 
## as.factor(State)10    -0.07753    0.12103   -0.64  0.52179    
## as.factor(State)11    -0.08969    0.13994   -0.64  0.52159    
## as.factor(State)12    -0.23835    0.09977   -2.39  0.01689 *  
## as.factor(State)13    -0.13014    0.10988   -1.18  0.23628    
## as.factor(State)15    -0.31603    0.14167   -2.23  0.02570 *  
## as.factor(State)16    -0.19912    0.13651   -1.46  0.14467    
## as.factor(State)17    -0.21726    0.11100   -1.96  0.05031 .  
## as.factor(State)18    -0.08374    0.09073   -0.92  0.35604    
## as.factor(State)19    -0.15370    0.09229   -1.67  0.09584 .  
## as.factor(State)20    -0.23479    0.09162   -2.56  0.01038 *  
## as.factor(State)21     0.05559    0.10521    0.53  0.59726    
## as.factor(State)22    -0.08463    0.11354   -0.75  0.45605    
## as.factor(State)23    -0.18468    0.09359   -1.97  0.04847 *  
## as.factor(State)24    -0.16648    0.08928   -1.86  0.06221 .  
## as.factor(State)25    -0.41800    0.11007   -3.80  0.00015 ***
## as.factor(State)26    -0.18734    0.09453   -1.98  0.04750 *  
## as.factor(State)27    -0.27475    0.08653   -3.18  0.00150 ** 
## as.factor(State)28    -0.09707    0.09933   -0.98  0.32846    
## as.factor(State)29    -0.06984    0.09804   -0.71  0.47624    
## as.factor(State)30    -0.28151    0.10993   -2.56  0.01045 *  
## as.factor(State)31    -0.22192    0.09141   -2.43  0.01520 *  
## as.factor(State)32    -0.15923    0.16789   -0.95  0.34292    
## as.factor(State)33    -0.33434    0.11211   -2.98  0.00286 ** 
## as.factor(State)35    -0.36984    0.12062   -3.07  0.00217 ** 
## as.factor(State)36    -0.25324    0.09953   -2.54  0.01095 *  
## as.factor(State)37     0.02199    0.11282    0.19  0.84545    
## as.factor(State)38    -0.27440    0.12058   -2.28  0.02287 *  
## as.factor(State)39    -0.13795    0.09210   -1.50  0.13416    
## as.factor(State)40    -0.00122    0.09713   -0.01  0.99000    
## as.factor(State)41    -0.20029    0.10428   -1.92  0.05478 .  
## as.factor(State)42    -0.07336    0.10552   -0.70  0.48690    
## as.factor(State)44    -0.44384    0.11508   -3.86  0.00011 ***
## as.factor(State)45    -0.05078    0.09803   -0.52  0.60448    
## as.factor(State)46    -0.27257    0.15736   -1.73  0.08326 .  
## as.factor(State)47    -0.05661    0.10103   -0.56  0.57528    
## as.factor(State)48     0.08666    0.11046    0.78  0.43271    
## as.factor(State)49    -0.24045    0.09879   -2.43  0.01494 *  
## as.factor(State)50    -0.29513    0.11406   -2.59  0.00967 ** 
## as.factor(State)51    -0.15505    0.09288   -1.67  0.09504 .  
## as.factor(State)53    -0.22928    0.09118   -2.51  0.01192 *  
## as.factor(State)54    -0.09477    0.09869   -0.96  0.33693    
## as.factor(State)55    -0.41882    0.12331   -3.40  0.00068 ***
## as.factor(State)56    -0.10760    0.12845   -0.84  0.40221    
## as.factor(State)66    -0.50681    0.20418   -2.48  0.01306 *  
## as.factor(State)72    -0.60367    0.14820   -4.07  4.6e-05 ***
## as.factor(Veteran)1    0.21899    0.04690    4.67  3.0e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for quasibinomial family taken to be 0.962)
## 
## Number of Fisher Scoring iterations: 7

Model 4

model1<-svyglm(na.omit(SkinCancer~as.factor(Age)+
                        as.factor(Race)+as.factor(Gender)+
                        as.factor(Married)+as.factor(Income)+  
                        as.factor(Education)+
                        as.factor(Employed)+
                        as.factor(State)+
                        as.factor(Veteran)),
                        design=svy2019,
                        family=quasibinomial)
#model1$oddsratios=exp(model1$coefficients) 
#model1$lower=exp(log(model1$oddsratios)-qnorm(.975)*summary(model1)$coefficients[,2])
#model1$upper=exp(log(model1$oddsratios)+qnorm(.975)*summary(model1)$coefficients[,2])
options(digits=3)
write.csv(summary(model1)$coefficients,"d:/jose/skin.csv")
summary(model1)
## 
## Call:
## svyglm(formula = na.omit(SkinCancer ~ as.factor(Age) + as.factor(Race) + 
##     as.factor(Gender) + as.factor(Married) + as.factor(Income) + 
##     as.factor(Education) + as.factor(Employed) + as.factor(State) + 
##     as.factor(Veteran)), design = svy2019, family = quasibinomial)
## 
## Survey design:
## mysurvey <- svydesign(
##   id=~1,
##   strata = ~Stratum,
##   weights = ~Weights,
##   data = surveydata)
## 
## Coefficients:
##                       Estimate Std. Error t value Pr(>|t|)    
## (Intercept)            -4.8998     0.3980  -12.31  < 2e-16 ***
## as.factor(Age)2        -0.1424     0.1952   -0.73  0.46572    
## as.factor(Age)3         0.8686     0.1842    4.72  2.4e-06 ***
## as.factor(Age)4         1.6379     0.1723    9.50  < 2e-16 ***
## as.factor(Age)5         2.2803     0.1713   13.31  < 2e-16 ***
## as.factor(Age)6         2.8690     0.1730   16.58  < 2e-16 ***
## as.factor(Race)2       -2.7966     0.1045  -26.75  < 2e-16 ***
## as.factor(Race)3       -2.6986     0.2943   -9.17  < 2e-16 ***
## as.factor(Race)4       -0.8078     0.1452   -5.56  2.6e-08 ***
## as.factor(Race)5       -1.5455     0.1434  -10.78  < 2e-16 ***
## as.factor(Race)6       -0.7415     0.0811   -9.14  < 2e-16 ***
## as.factor(Gender)1      0.0868     0.0266    3.27  0.00108 ** 
## as.factor(Married)2    -0.1099     0.0361   -3.04  0.00235 ** 
## as.factor(Married)3     0.0706     0.0315    2.24  0.02515 *  
## as.factor(Married)4    -0.0742     0.1038   -0.72  0.47452    
## as.factor(Married)5    -0.2221     0.0510   -4.36  1.3e-05 ***
## as.factor(Married)6    -0.0757     0.0931   -0.81  0.41621    
## as.factor(Income)2     -0.0654     0.1063   -0.62  0.53839    
## as.factor(Income)3      0.0482     0.1077    0.45  0.65488    
## as.factor(Income)4      0.1003     0.1028    0.97  0.32965    
## as.factor(Income)5      0.1268     0.1018    1.25  0.21296    
## as.factor(Income)6      0.1962     0.0979    2.00  0.04511 *  
## as.factor(Income)7      0.1838     0.0973    1.89  0.05889 .  
## as.factor(Income)8      0.2933     0.0974    3.01  0.00261 ** 
## as.factor(Income)9      0.1642     0.0971    1.69  0.09070 .  
## as.factor(Education)2   0.2360     0.3483    0.68  0.49813    
## as.factor(Education)3   0.1477     0.3461    0.43  0.66964    
## as.factor(Education)4   0.2376     0.3451    0.69  0.49118    
## as.factor(Education)5   0.4250     0.3460    1.23  0.21933    
## as.factor(Education)6   0.5923     0.3472    1.71  0.08808 .  
## as.factor(Employed)2    0.1982     0.0448    4.42  9.9e-06 ***
## as.factor(Employed)3    0.2264     0.0950    2.38  0.01712 *  
## as.factor(Employed)4    0.1129     0.1190    0.95  0.34270    
## as.factor(Employed)5    0.2030     0.0577    3.52  0.00044 ***
## as.factor(Employed)6   -0.5459     0.2210   -2.47  0.01353 *  
## as.factor(Employed)7    0.4197     0.0414   10.14  < 2e-16 ***
## as.factor(Employed)8    0.4491     0.0539    8.33  < 2e-16 ***
## as.factor(State)2      -0.9463     0.1404   -6.74  1.6e-11 ***
## as.factor(State)4      -0.0224     0.0726   -0.31  0.75753    
## as.factor(State)5      -0.2010     0.0764   -2.63  0.00852 ** 
## as.factor(State)6      -0.0178     0.0707   -0.25  0.80126    
## as.factor(State)8      -0.2229     0.0660   -3.38  0.00074 ***
## as.factor(State)9      -0.5018     0.0683   -7.34  2.1e-13 ***
## as.factor(State)10     -0.2207     0.0873   -2.53  0.01145 *  
## as.factor(State)11     -0.0760     0.1215   -0.63  0.53186    
## as.factor(State)12      0.2658     0.0729    3.65  0.00026 ***
## as.factor(State)13     -0.2023     0.0788   -2.57  0.01026 *  
## as.factor(State)15     -0.0277     0.0856   -0.32  0.74601    
## as.factor(State)16     -0.2129     0.0881   -2.42  0.01573 *  
## as.factor(State)17     -0.4979     0.0819   -6.08  1.2e-09 ***
## as.factor(State)18     -0.4589     0.0661   -6.95  3.7e-12 ***
## as.factor(State)19     -0.4921     0.0653   -7.54  4.8e-14 ***
## as.factor(State)20     -0.4280     0.0641   -6.67  2.5e-11 ***
## as.factor(State)21     -0.3066     0.0803   -3.82  0.00013 ***
## as.factor(State)22     -0.2567     0.0847   -3.03  0.00245 ** 
## as.factor(State)23     -0.4775     0.0690   -6.92  4.7e-12 ***
## as.factor(State)24     -0.3602     0.0613   -5.88  4.1e-09 ***
## as.factor(State)25     -0.3769     0.0718   -5.25  1.5e-07 ***
## as.factor(State)26     -0.3680     0.0667   -5.51  3.5e-08 ***
## as.factor(State)27     -0.5974     0.0612   -9.75  < 2e-16 ***
## as.factor(State)28     -0.1436     0.0845   -1.70  0.08941 .  
## as.factor(State)29     -0.2374     0.0756   -3.14  0.00169 ** 
## as.factor(State)30     -0.4600     0.0719   -6.40  1.5e-10 ***
## as.factor(State)31     -0.3954     0.0630   -6.28  3.5e-10 ***
## as.factor(State)32     -0.1930     0.1074   -1.80  0.07238 .  
## as.factor(State)33     -0.4831     0.0756   -6.39  1.7e-10 ***
## as.factor(State)35     -0.1153     0.0842   -1.37  0.17095    
## as.factor(State)36     -0.6364     0.0694   -9.17  < 2e-16 ***
## as.factor(State)37     -0.1069     0.0833   -1.28  0.19930    
## as.factor(State)38     -0.6167     0.0832   -7.41  1.3e-13 ***
## as.factor(State)39     -0.4721     0.0685   -6.90  5.4e-12 ***
## as.factor(State)40     -0.4136     0.0746   -5.54  2.9e-08 ***
## as.factor(State)41     -0.3122     0.0764   -4.09  4.3e-05 ***
## as.factor(State)42     -0.4198     0.0771   -5.45  5.1e-08 ***
## as.factor(State)44     -0.3632     0.0766   -4.74  2.1e-06 ***
## as.factor(State)45      0.0174     0.0708    0.25  0.80583    
## as.factor(State)46     -0.4852     0.0978   -4.96  6.9e-07 ***
## as.factor(State)47     -0.1715     0.0808   -2.12  0.03385 *  
## as.factor(State)48     -0.3139     0.0798   -3.94  8.3e-05 ***
## as.factor(State)49     -0.0169     0.0638   -0.27  0.79086    
## as.factor(State)50     -0.4897     0.0768   -6.38  1.8e-10 ***
## as.factor(State)51     -0.2969     0.0670   -4.43  9.2e-06 ***
## as.factor(State)53     -0.4114     0.0633   -6.50  8.1e-11 ***
## as.factor(State)54     -0.2152     0.0746   -2.88  0.00393 ** 
## as.factor(State)55     -0.5717     0.0824   -6.93  4.1e-12 ***
## as.factor(State)56     -0.3563     0.0833   -4.28  1.9e-05 ***
## as.factor(State)66     -0.9420     0.2428   -3.88  0.00010 ***
## as.factor(State)72     -0.6190     0.1848   -3.35  0.00081 ***
## as.factor(Veteran)1     0.2932     0.0357    8.21  2.3e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for quasibinomial family taken to be 1.22)
## 
## Number of Fisher Scoring iterations: 7

Model 5

model1<-svyglm(na.omit(Cancer~as.factor(Age)+
                        as.factor(Race)+as.factor(Gender)+
                        as.factor(Married)+as.factor(Income)+  
                        as.factor(Education)+
                        as.factor(Employed)+
                        as.factor(State)+
                        as.factor(Veteran)),
                        design=svy2019,
                        family=quasibinomial)
#model1$oddsratios=exp(model1$coefficients) 
#model1$lower=exp(log(model1$oddsratios)-qnorm(.975)*summary(model1)$coefficients[,2])
#model1$upper=exp(log(model1$oddsratios)+qnorm(.975)*summary(model1)$coefficients[,2])
options(digits=3)
write.csv(summary(model1)$coefficients,"d:/jose/cancer.csv")
summary(model1)
## 
## Call:
## svyglm(formula = na.omit(Cancer ~ as.factor(Age) + as.factor(Race) + 
##     as.factor(Gender) + as.factor(Married) + as.factor(Income) + 
##     as.factor(Education) + as.factor(Employed) + as.factor(State) + 
##     as.factor(Veteran)), design = svy2019, family = quasibinomial)
## 
## Survey design:
## mysurvey <- svydesign(
##   id=~1,
##   strata = ~Stratum,
##   weights = ~Weights,
##   data = surveydata)
## 
## Coefficients:
##                        Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           -4.910602   0.374434  -13.11  < 2e-16 ***
## as.factor(Age)2        0.687388   0.231452    2.97   0.0030 ** 
## as.factor(Age)3        1.062017   0.238249    4.46  8.3e-06 ***
## as.factor(Age)4        1.645389   0.236173    6.97  3.2e-12 ***
## as.factor(Age)5        2.090960   0.236371    8.85  < 2e-16 ***
## as.factor(Age)6        2.631739   0.238523   11.03  < 2e-16 ***
## as.factor(Race)2      -0.344446   0.043440   -7.93  2.2e-15 ***
## as.factor(Race)3      -0.809051   0.137356   -5.89  3.9e-09 ***
## as.factor(Race)4       0.116235   0.113034    1.03   0.3038    
## as.factor(Race)5      -0.362979   0.063012   -5.76  8.4e-09 ***
## as.factor(Race)6      -0.028282   0.070851   -0.40   0.6898    
## as.factor(Gender)1    -0.399942   0.026604  -15.03  < 2e-16 ***
## as.factor(Married)2    0.031507   0.033169    0.95   0.3422    
## as.factor(Married)3    0.049223   0.033723    1.46   0.1444    
## as.factor(Married)4    0.076118   0.078261    0.97   0.3307    
## as.factor(Married)5   -0.110617   0.052131   -2.12   0.0338 *  
## as.factor(Married)6   -0.029701   0.084340   -0.35   0.7247    
## as.factor(Income)2     0.093077   0.076504    1.22   0.2237    
## as.factor(Income)3     0.083236   0.072055    1.16   0.2480    
## as.factor(Income)4     0.140630   0.072123    1.95   0.0512 .  
## as.factor(Income)5     0.119789   0.074526    1.61   0.1080    
## as.factor(Income)6     0.132814   0.069713    1.91   0.0568 .  
## as.factor(Income)7     0.125318   0.070076    1.79   0.0737 .  
## as.factor(Income)8     0.107375   0.070827    1.52   0.1295    
## as.factor(Income)9     0.029165   0.065497    0.45   0.6561    
## as.factor(Education)2  0.131185   0.301422    0.44   0.6634    
## as.factor(Education)3  0.350024   0.300940    1.16   0.2448    
## as.factor(Education)4  0.263921   0.296836    0.89   0.3739    
## as.factor(Education)5  0.328818   0.297197    1.11   0.2686    
## as.factor(Education)6  0.312578   0.297556    1.05   0.2935    
## as.factor(Employed)2   0.138612   0.056427    2.46   0.0140 *  
## as.factor(Employed)3   0.426206   0.088586    4.81  1.5e-06 ***
## as.factor(Employed)4   0.166923   0.095435    1.75   0.0803 .  
## as.factor(Employed)5   0.189993   0.057960    3.28   0.0010 ** 
## as.factor(Employed)6  -0.256383   0.190252   -1.35   0.1778    
## as.factor(Employed)7   0.481078   0.036409   13.21  < 2e-16 ***
## as.factor(Employed)8   0.936747   0.043860   21.36  < 2e-16 ***
## as.factor(State)2     -0.207985   0.117648   -1.77   0.0771 .  
## as.factor(State)4      0.096774   0.083768    1.16   0.2480    
## as.factor(State)5     -0.012684   0.078894   -0.16   0.8723    
## as.factor(State)6      0.058852   0.072270    0.81   0.4155    
## as.factor(State)8      0.053996   0.068161    0.79   0.4283    
## as.factor(State)9      0.065444   0.068056    0.96   0.3362    
## as.factor(State)10     0.146144   0.093298    1.57   0.1173    
## as.factor(State)11     0.099240   0.100168    0.99   0.3218    
## as.factor(State)12     0.110698   0.071404    1.55   0.1211    
## as.factor(State)13     0.045653   0.082138    0.56   0.5783    
## as.factor(State)15     0.153732   0.091947    1.67   0.0945 .  
## as.factor(State)16    -0.064862   0.091868   -0.71   0.4802    
## as.factor(State)17     0.015728   0.078294    0.20   0.8408    
## as.factor(State)18     0.040719   0.068176    0.60   0.5503    
## as.factor(State)19    -0.034061   0.066169   -0.51   0.6067    
## as.factor(State)20     0.138512   0.066265    2.09   0.0366 *  
## as.factor(State)21     0.237248   0.079802    2.97   0.0029 ** 
## as.factor(State)22     0.188040   0.085369    2.20   0.0276 *  
## as.factor(State)23     0.187627   0.066886    2.81   0.0050 ** 
## as.factor(State)24     0.168150   0.064002    2.63   0.0086 ** 
## as.factor(State)25     0.158971   0.073280    2.17   0.0301 *  
## as.factor(State)26     0.176231   0.066773    2.64   0.0083 ** 
## as.factor(State)27    -0.011054   0.062045   -0.18   0.8586    
## as.factor(State)28    -0.045193   0.084014   -0.54   0.5906    
## as.factor(State)29     0.132164   0.075972    1.74   0.0819 .  
## as.factor(State)30     0.096866   0.072104    1.34   0.1791    
## as.factor(State)31     0.033913   0.063807    0.53   0.5951    
## as.factor(State)32    -0.094115   0.111843   -0.84   0.4001    
## as.factor(State)33     0.082500   0.075460    1.09   0.2743    
## as.factor(State)35     0.064821   0.084797    0.76   0.4446    
## as.factor(State)36     0.126208   0.066557    1.90   0.0579 .  
## as.factor(State)37     0.124212   0.082346    1.51   0.1315    
## as.factor(State)38     0.104590   0.078090    1.34   0.1805    
## as.factor(State)39     0.130751   0.067676    1.93   0.0534 .  
## as.factor(State)40     0.046421   0.073560    0.63   0.5280    
## as.factor(State)41     0.000445   0.075493    0.01   0.9953    
## as.factor(State)42     0.117579   0.076138    1.54   0.1225    
## as.factor(State)44     0.154691   0.076865    2.01   0.0442 *  
## as.factor(State)45     0.144291   0.072475    1.99   0.0465 *  
## as.factor(State)46     0.054546   0.096929    0.56   0.5736    
## as.factor(State)47     0.110484   0.078305    1.41   0.1583    
## as.factor(State)48     0.105644   0.082560    1.28   0.2007    
## as.factor(State)49    -0.049624   0.069478   -0.71   0.4751    
## as.factor(State)50    -0.058724   0.077977   -0.75   0.4514    
## as.factor(State)51     0.077123   0.068505    1.13   0.2603    
## as.factor(State)53     0.143840   0.065896    2.18   0.0291 *  
## as.factor(State)54     0.183899   0.077052    2.39   0.0170 *  
## as.factor(State)55     0.098252   0.084469    1.16   0.2448    
## as.factor(State)56     0.020270   0.088685    0.23   0.8192    
## as.factor(State)66    -0.408388   0.196951   -2.07   0.0381 *  
## as.factor(State)72     0.027688   0.102613    0.27   0.7873    
## as.factor(Veteran)1    0.339197   0.032506   10.43  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for quasibinomial family taken to be 0.966)
## 
## Number of Fisher Scoring iterations: 7

Model 6

model1<-svyglm(na.omit(COPD~as.factor(Age)+
                        as.factor(Race)+as.factor(Gender)+
                        as.factor(Married)+as.factor(Income)+  
                        as.factor(Education)+
                        as.factor(Employed)+
                        as.factor(State)+
                        as.factor(Veteran)),
                        design=svy2019,
                        family=quasibinomial)
#model1$oddsratios=exp(model1$coefficients) 
#model1$lower=exp(log(model1$oddsratios)-qnorm(.975)*summary(model1)$coefficients[,2])
#model1$upper=exp(log(model1$oddsratios)+qnorm(.975)*summary(model1)$coefficients[,2])
options(digits=3)
write.csv(summary(model1)$coefficients,"d:/jose/COPD.csv")
summary(model1)
## 
## Call:
## svyglm(formula = na.omit(COPD ~ as.factor(Age) + as.factor(Race) + 
##     as.factor(Gender) + as.factor(Married) + as.factor(Income) + 
##     as.factor(Education) + as.factor(Employed) + as.factor(State) + 
##     as.factor(Veteran)), design = svy2019, family = quasibinomial)
## 
## Survey design:
## mysurvey <- svydesign(
##   id=~1,
##   strata = ~Stratum,
##   weights = ~Weights,
##   data = surveydata)
## 
## Coefficients:
##                        Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           -3.207613   0.332203   -9.66  < 2e-16 ***
## as.factor(Age)2        0.355372   0.108184    3.28  0.00102 ** 
## as.factor(Age)3        0.679936   0.105482    6.45  1.1e-10 ***
## as.factor(Age)4        1.062742   0.102389   10.38  < 2e-16 ***
## as.factor(Age)5        1.367657   0.101064   13.53  < 2e-16 ***
## as.factor(Age)6        1.508100   0.104137   14.48  < 2e-16 ***
## as.factor(Race)2      -0.510510   0.043846  -11.64  < 2e-16 ***
## as.factor(Race)3      -0.529762   0.172925   -3.06  0.00219 ** 
## as.factor(Race)4       0.038761   0.081384    0.48  0.63388    
## as.factor(Race)5      -0.793530   0.067662  -11.73  < 2e-16 ***
## as.factor(Race)6       0.211164   0.062062    3.40  0.00067 ***
## as.factor(Gender)1    -0.224331   0.029371   -7.64  2.2e-14 ***
## as.factor(Married)2    0.316733   0.032373    9.78  < 2e-16 ***
## as.factor(Married)3    0.210102   0.034860    6.03  1.7e-09 ***
## as.factor(Married)4    0.341988   0.066315    5.16  2.5e-07 ***
## as.factor(Married)5    0.140434   0.043712    3.21  0.00131 ** 
## as.factor(Married)6    0.225472   0.067022    3.36  0.00077 ***
## as.factor(Income)2     0.025022   0.058200    0.43  0.66724    
## as.factor(Income)3    -0.015497   0.056851   -0.27  0.78517    
## as.factor(Income)4    -0.099274   0.059076   -1.68  0.09287 .  
## as.factor(Income)5    -0.183440   0.060455   -3.03  0.00241 ** 
## as.factor(Income)6    -0.321542   0.060458   -5.32  1.0e-07 ***
## as.factor(Income)7    -0.577180   0.060516   -9.54  < 2e-16 ***
## as.factor(Income)8    -0.813589   0.063435  -12.83  < 2e-16 ***
## as.factor(Income)9    -0.435583   0.053016   -8.22  < 2e-16 ***
## as.factor(Education)2 -0.070670   0.304724   -0.23  0.81660    
## as.factor(Education)3  0.224968   0.303969    0.74  0.45924    
## as.factor(Education)4 -0.103713   0.303314   -0.34  0.73240    
## as.factor(Education)5 -0.137409   0.304088   -0.45  0.65136    
## as.factor(Education)6 -0.683521   0.304414   -2.25  0.02475 *  
## as.factor(Employed)2   0.001326   0.063564    0.02  0.98335    
## as.factor(Employed)3   0.619513   0.075319    8.23  < 2e-16 ***
## as.factor(Employed)4   0.413038   0.087695    4.71  2.5e-06 ***
## as.factor(Employed)5   0.096123   0.063408    1.52  0.12953    
## as.factor(Employed)6  -0.245631   0.153131   -1.60  0.10870    
## as.factor(Employed)7   0.506706   0.040675   12.46  < 2e-16 ***
## as.factor(Employed)8   1.445719   0.039394   36.70  < 2e-16 ***
## as.factor(State)2     -0.529314   0.128052   -4.13  3.6e-05 ***
## as.factor(State)4     -0.145290   0.087793   -1.65  0.09794 .  
## as.factor(State)5      0.058752   0.083121    0.71  0.47968    
## as.factor(State)6     -0.310844   0.082071   -3.79  0.00015 ***
## as.factor(State)8     -0.375881   0.079747   -4.71  2.4e-06 ***
## as.factor(State)9     -0.339553   0.083569   -4.06  4.8e-05 ***
## as.factor(State)10     0.080939   0.100700    0.80  0.42153    
## as.factor(State)11    -0.175373   0.125773   -1.39  0.16321    
## as.factor(State)12    -0.089937   0.077549   -1.16  0.24616    
## as.factor(State)13    -0.023950   0.087559   -0.27  0.78445    
## as.factor(State)15    -0.520575   0.115358   -4.51  6.4e-06 ***
## as.factor(State)16    -0.528737   0.097890   -5.40  6.6e-08 ***
## as.factor(State)17    -0.205561   0.087462   -2.35  0.01876 *  
## as.factor(State)18     0.000431   0.071663    0.01  0.99520    
## as.factor(State)19    -0.289280   0.074386   -3.89  0.00010 ***
## as.factor(State)20    -0.224629   0.072715   -3.09  0.00201 ** 
## as.factor(State)21     0.125205   0.079119    1.58  0.11354    
## as.factor(State)22    -0.053483   0.089231   -0.60  0.54892    
## as.factor(State)23    -0.033946   0.074543   -0.46  0.64884    
## as.factor(State)24    -0.179401   0.072123   -2.49  0.01287 *  
## as.factor(State)25    -0.352218   0.083583   -4.21  2.5e-05 ***
## as.factor(State)26    -0.028569   0.072926   -0.39  0.69524    
## as.factor(State)27    -0.542466   0.071925   -7.54  4.6e-14 ***
## as.factor(State)28    -0.028586   0.085614   -0.33  0.73846    
## as.factor(State)29     0.013637   0.079766    0.17  0.86425    
## as.factor(State)30    -0.311420   0.081751   -3.81  0.00014 ***
## as.factor(State)31    -0.326796   0.072834   -4.49  7.2e-06 ***
## as.factor(State)32     0.076260   0.116645    0.65  0.51325    
## as.factor(State)33    -0.353429   0.087719   -4.03  5.6e-05 ***
## as.factor(State)35    -0.325787   0.095396   -3.42  0.00064 ***
## as.factor(State)36    -0.221777   0.074514   -2.98  0.00292 ** 
## as.factor(State)37    -0.088817   0.090186   -0.98  0.32471    
## as.factor(State)38    -0.376436   0.093938   -4.01  6.1e-05 ***
## as.factor(State)39    -0.006607   0.070982   -0.09  0.92584    
## as.factor(State)40    -0.063552   0.077734   -0.82  0.41361    
## as.factor(State)41    -0.348208   0.088242   -3.95  7.9e-05 ***
## as.factor(State)42    -0.147374   0.083667   -1.76  0.07817 .  
## as.factor(State)44    -0.175739   0.087418   -2.01  0.04440 *  
## as.factor(State)45    -0.098968   0.079258   -1.25  0.21178    
## as.factor(State)46    -0.342419   0.121665   -2.81  0.00489 ** 
## as.factor(State)47     0.023898   0.079326    0.30  0.76321    
## as.factor(State)48    -0.220490   0.087500   -2.52  0.01174 *  
## as.factor(State)49    -0.401701   0.079892   -5.03  5.0e-07 ***
## as.factor(State)50    -0.311601   0.088037   -3.54  0.00040 ***
## as.factor(State)51    -0.100707   0.076448   -1.32  0.18773    
## as.factor(State)53    -0.396818   0.075280   -5.27  1.4e-07 ***
## as.factor(State)54     0.042661   0.076495    0.56  0.57705    
## as.factor(State)55    -0.408593   0.098354   -4.15  3.3e-05 ***
## as.factor(State)56    -0.182240   0.099174   -1.84  0.06612 .  
## as.factor(State)66    -1.047370   0.207085   -5.06  4.2e-07 ***
## as.factor(State)72    -0.222259   0.116180   -1.91  0.05574 .  
## as.factor(Veteran)1    0.379134   0.042664    8.89  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for quasibinomial family taken to be 1.03)
## 
## Number of Fisher Scoring iterations: 6

Model 7

model1<-svyglm(na.omit(Arthritis~as.factor(Age)+
                        as.factor(Race)+as.factor(Gender)+
                        as.factor(Married)+as.factor(Income)+  
                        as.factor(Education)+
                        as.factor(Employed)+
                        as.factor(State)+
                        as.factor(Veteran)),
                        design=svy2019,
                        family=quasibinomial)

#model1$oddsratios=exp(model1$coefficients) 
#model1$lower=exp(log(model1$oddsratios)-qnorm(.975)*summary(model1)$coefficients[,2])
#model1$upper=exp(log(model1$oddsratios)+qnorm(.975)*summary(model1)$coefficients[,2])
options(digits=3)
write.csv(summary(model1)$coefficients,"d:/jose/arthritis.csv")
summary(model1)
## 
## Call:
## svyglm(formula = na.omit(Arthritis ~ as.factor(Age) + as.factor(Race) + 
##     as.factor(Gender) + as.factor(Married) + as.factor(Income) + 
##     as.factor(Education) + as.factor(Employed) + as.factor(State) + 
##     as.factor(Veteran)), design = svy2019, family = quasibinomial)
## 
## Survey design:
## mysurvey <- svydesign(
##   id=~1,
##   strata = ~Stratum,
##   weights = ~Weights,
##   data = surveydata)
## 
## Coefficients:
##                       Estimate Std. Error t value Pr(>|t|)    
## (Intercept)            -2.9929     0.2061  -14.53  < 2e-16 ***
## as.factor(Age)2         0.6917     0.0695    9.96  < 2e-16 ***
## as.factor(Age)3         1.3546     0.0682   19.87  < 2e-16 ***
## as.factor(Age)4         1.9805     0.0675   29.32  < 2e-16 ***
## as.factor(Age)5         2.4453     0.0674   36.28  < 2e-16 ***
## as.factor(Age)6         2.7702     0.0689   40.20  < 2e-16 ***
## as.factor(Race)2       -0.2020     0.0268   -7.54  4.6e-14 ***
## as.factor(Race)3       -0.6095     0.0744   -8.19  2.5e-16 ***
## as.factor(Race)4        0.0961     0.0678    1.42  0.15636    
## as.factor(Race)5       -0.5120     0.0381  -13.44  < 2e-16 ***
## as.factor(Race)6        0.0174     0.0455    0.38  0.70246    
## as.factor(Gender)1     -0.4318     0.0172  -25.09  < 2e-16 ***
## as.factor(Married)2     0.0970     0.0230    4.21  2.5e-05 ***
## as.factor(Married)3     0.1205     0.0252    4.78  1.7e-06 ***
## as.factor(Married)4     0.1989     0.0472    4.22  2.5e-05 ***
## as.factor(Married)5    -0.0852     0.0285   -2.98  0.00286 ** 
## as.factor(Married)6     0.0598     0.0445    1.34  0.17886    
## as.factor(Income)2      0.0621     0.0513    1.21  0.22572    
## as.factor(Income)3      0.0340     0.0471    0.72  0.46984    
## as.factor(Income)4      0.0019     0.0467    0.04  0.96747    
## as.factor(Income)5     -0.0588     0.0458   -1.29  0.19857    
## as.factor(Income)6     -0.0558     0.0444   -1.26  0.20924    
## as.factor(Income)7     -0.0740     0.0449   -1.65  0.09979 .  
## as.factor(Income)8     -0.1951     0.0447   -4.37  1.2e-05 ***
## as.factor(Income)9     -0.2461     0.0423   -5.82  5.8e-09 ***
## as.factor(Education)2   0.3317     0.1901    1.75  0.08096 .  
## as.factor(Education)3   0.5202     0.1885    2.76  0.00580 ** 
## as.factor(Education)4   0.4602     0.1870    2.46  0.01384 *  
## as.factor(Education)5   0.5551     0.1870    2.97  0.00300 ** 
## as.factor(Education)6   0.2604     0.1869    1.39  0.16362    
## as.factor(Employed)2   -0.0341     0.0291   -1.17  0.24184    
## as.factor(Employed)3    0.5152     0.0538    9.58  < 2e-16 ***
## as.factor(Employed)4    0.3068     0.0546    5.62  1.9e-08 ***
## as.factor(Employed)5    0.0246     0.0357    0.69  0.49164    
## as.factor(Employed)6   -0.2712     0.0813   -3.34  0.00085 ***
## as.factor(Employed)7    0.4054     0.0241   16.80  < 2e-16 ***
## as.factor(Employed)8    1.3634     0.0303   45.04  < 2e-16 ***
## as.factor(State)2      -0.4481     0.0775   -5.78  7.3e-09 ***
## as.factor(State)4      -0.4101     0.0548   -7.49  6.9e-14 ***
## as.factor(State)5      -0.1343     0.0557   -2.41  0.01581 *  
## as.factor(State)6      -0.3917     0.0487   -8.04  9.2e-16 ***
## as.factor(State)8      -0.3417     0.0469   -7.29  3.2e-13 ***
## as.factor(State)9      -0.3941     0.0479   -8.23  < 2e-16 ***
## as.factor(State)10     -0.2308     0.0637   -3.62  0.00029 ***
## as.factor(State)11     -0.4944     0.0734   -6.74  1.6e-11 ***
## as.factor(State)12     -0.4105     0.0522   -7.86  3.8e-15 ***
## as.factor(State)13     -0.3483     0.0570   -6.11  9.9e-10 ***
## as.factor(State)15     -0.3921     0.0617   -6.35  2.1e-10 ***
## as.factor(State)16     -0.3396     0.0636   -5.34  9.1e-08 ***
## as.factor(State)17     -0.2721     0.0532   -5.12  3.1e-07 ***
## as.factor(State)18     -0.2779     0.0469   -5.92  3.2e-09 ***
## as.factor(State)19     -0.3146     0.0453   -6.95  3.8e-12 ***
## as.factor(State)20     -0.2775     0.0455   -6.10  1.1e-09 ***
## as.factor(State)21      0.0729     0.0552    1.32  0.18661    
## as.factor(State)22     -0.2438     0.0561   -4.34  1.4e-05 ***
## as.factor(State)23     -0.1714     0.0494   -3.47  0.00052 ***
## as.factor(State)24     -0.2776     0.0433   -6.42  1.4e-10 ***
## as.factor(State)25     -0.2844     0.0505   -5.63  1.8e-08 ***
## as.factor(State)26     -0.0798     0.0460   -1.73  0.08282 .  
## as.factor(State)27     -0.5300     0.0429  -12.36  < 2e-16 ***
## as.factor(State)28     -0.2474     0.0553   -4.47  7.8e-06 ***
## as.factor(State)29     -0.3055     0.0509   -6.00  2.0e-09 ***
## as.factor(State)30     -0.2263     0.0501   -4.52  6.3e-06 ***
## as.factor(State)31     -0.4324     0.0443   -9.76  < 2e-16 ***
## as.factor(State)32     -0.4475     0.0826   -5.42  6.0e-08 ***
## as.factor(State)33     -0.3630     0.0541   -6.71  1.9e-11 ***
## as.factor(State)35     -0.2160     0.0574   -3.77  0.00017 ***
## as.factor(State)36     -0.4174     0.0460   -9.08  < 2e-16 ***
## as.factor(State)37     -0.2788     0.0569   -4.90  9.7e-07 ***
## as.factor(State)38     -0.2132     0.0579   -3.68  0.00023 ***
## as.factor(State)39     -0.1105     0.0473   -2.34  0.01941 *  
## as.factor(State)40     -0.3159     0.0512   -6.17  6.7e-10 ***
## as.factor(State)41     -0.2968     0.0520   -5.70  1.2e-08 ***
## as.factor(State)42     -0.1580     0.0514   -3.07  0.00212 ** 
## as.factor(State)44     -0.2425     0.0553   -4.39  1.2e-05 ***
## as.factor(State)45     -0.2626     0.0510   -5.16  2.5e-07 ***
## as.factor(State)46     -0.2456     0.0730   -3.36  0.00077 ***
## as.factor(State)47     -0.1355     0.0539   -2.51  0.01192 *  
## as.factor(State)48     -0.3837     0.0552   -6.95  3.6e-12 ***
## as.factor(State)49     -0.1625     0.0454   -3.58  0.00034 ***
## as.factor(State)50     -0.3180     0.0544   -5.85  4.9e-09 ***
## as.factor(State)51     -0.1834     0.0480   -3.82  0.00013 ***
## as.factor(State)53     -0.2882     0.0449   -6.42  1.4e-10 ***
## as.factor(State)54      0.2544     0.0525    4.84  1.3e-06 ***
## as.factor(State)55     -0.2419     0.0556   -4.35  1.4e-05 ***
## as.factor(State)56     -0.3718     0.0609   -6.11  1.0e-09 ***
## as.factor(State)66     -0.5560     0.1121   -4.96  7.0e-07 ***
## as.factor(State)72     -0.2841     0.0630   -4.51  6.4e-06 ***
## as.factor(Veteran)1     0.2117     0.0241    8.77  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for quasibinomial family taken to be 0.977)
## 
## Number of Fisher Scoring iterations: 5

Model 8

model1<-svyglm(na.omit(Depression~as.factor(Age)+
                        as.factor(Race)+as.factor(Gender)+
                        as.factor(Married)+as.factor(Income)+  
                        as.factor(Education)+
                        as.factor(Employed)+
                        as.factor(State)+
                        as.factor(Veteran)),
                        design=svy2019,
                        family=quasibinomial)
#model1$oddsratios=exp(model1$coefficients) 
#model1$lower=exp(log(model1$oddsratios)-qnorm(.975)*summary(model1)$coefficients[,2])
#model1$upper=exp(log(model1$oddsratios)+qnorm(.975)*summary(model1)$coefficients[,2])
options(digits=3)
write.csv(summary(model1)$coefficients,"d:/jose/mentalhealth.csv")
summary(model1)
## 
## Call:
## svyglm(formula = na.omit(Depression ~ as.factor(Age) + as.factor(Race) + 
##     as.factor(Gender) + as.factor(Married) + as.factor(Income) + 
##     as.factor(Education) + as.factor(Employed) + as.factor(State) + 
##     as.factor(Veteran)), design = svy2019, family = quasibinomial)
## 
## Survey design:
## mysurvey <- svydesign(
##   id=~1,
##   strata = ~Stratum,
##   weights = ~Weights,
##   data = surveydata)
## 
## Coefficients:
##                       Estimate Std. Error t value Pr(>|t|)    
## (Intercept)            0.15365    0.18615    0.83  0.40914    
## as.factor(Age)2       -0.22894    0.03201   -7.15  8.6e-13 ***
## as.factor(Age)3       -0.45211    0.03430  -13.18  < 2e-16 ***
## as.factor(Age)4       -0.69575    0.03448  -20.18  < 2e-16 ***
## as.factor(Age)5       -0.98712    0.03563  -27.70  < 2e-16 ***
## as.factor(Age)6       -1.35257    0.03878  -34.88  < 2e-16 ***
## as.factor(Race)2      -0.34807    0.02498  -13.94  < 2e-16 ***
## as.factor(Race)3      -0.48025    0.04730  -10.15  < 2e-16 ***
## as.factor(Race)4      -0.07538    0.06203   -1.22  0.22429    
## as.factor(Race)5      -0.47205    0.02820  -16.74  < 2e-16 ***
## as.factor(Race)6       0.12001    0.03714    3.23  0.00123 ** 
## as.factor(Gender)1    -0.48861    0.01541  -31.70  < 2e-16 ***
## as.factor(Married)2    0.35567    0.02284   15.57  < 2e-16 ***
## as.factor(Married)3    0.22482    0.02638    8.52  < 2e-16 ***
## as.factor(Married)4    0.56202    0.04737   11.87  < 2e-16 ***
## as.factor(Married)5    0.37453    0.02208   16.96  < 2e-16 ***
## as.factor(Married)6    0.38287    0.03364   11.38  < 2e-16 ***
## as.factor(Income)2    -0.02529    0.05018   -0.50  0.61425    
## as.factor(Income)3    -0.02415    0.04459   -0.54  0.58810    
## as.factor(Income)4    -0.03622    0.04390   -0.83  0.40932    
## as.factor(Income)5    -0.05520    0.04355   -1.27  0.20490    
## as.factor(Income)6    -0.08476    0.04163   -2.04  0.04177 *  
## as.factor(Income)7    -0.11705    0.04269   -2.74  0.00611 ** 
## as.factor(Income)8    -0.23975    0.04096   -5.85  4.8e-09 ***
## as.factor(Income)9    -0.30775    0.03989   -7.71  1.2e-14 ***
## as.factor(Education)2  0.22357    0.18038    1.24  0.21519    
## as.factor(Education)3  0.31328    0.17818    1.76  0.07872 .  
## as.factor(Education)4  0.24052    0.17652    1.36  0.17303    
## as.factor(Education)5  0.45390    0.17660    2.57  0.01016 *  
## as.factor(Education)6  0.43341    0.17678    2.45  0.01422 *  
## as.factor(Employed)2  -0.07718    0.02631   -2.93  0.00335 ** 
## as.factor(Employed)3   0.51488    0.04943   10.42  < 2e-16 ***
## as.factor(Employed)4   0.41769    0.04686    8.91  < 2e-16 ***
## as.factor(Employed)5  -0.08936    0.03571   -2.50  0.01233 *  
## as.factor(Employed)6   0.32341    0.04104    7.88  3.3e-15 ***
## as.factor(Employed)7   0.00947    0.02595    0.36  0.71512    
## as.factor(Employed)8   1.15147    0.02947   39.08  < 2e-16 ***
## as.factor(State)2     -0.16756    0.07347   -2.28  0.02257 *  
## as.factor(State)4      0.06759    0.05380    1.26  0.20898    
## as.factor(State)5     -0.01888    0.05583   -0.34  0.73523    
## as.factor(State)6     -0.02417    0.04518   -0.54  0.59264    
## as.factor(State)8      0.02364    0.04498    0.53  0.59916    
## as.factor(State)9     -0.09345    0.04824   -1.94  0.05274 .  
## as.factor(State)10     0.00965    0.06032    0.16  0.87292    
## as.factor(State)11     0.15002    0.06552    2.29  0.02205 *  
## as.factor(State)12     0.00281    0.05092    0.06  0.95592    
## as.factor(State)13     0.11062    0.05467    2.02  0.04305 *  
## as.factor(State)15    -0.11491    0.05412   -2.12  0.03371 *  
## as.factor(State)16    -0.00253    0.05809   -0.04  0.96522    
## as.factor(State)17    -0.03915    0.05017   -0.78  0.43520    
## as.factor(State)18    -0.04050    0.04612   -0.88  0.37989    
## as.factor(State)19    -0.14099    0.04406   -3.20  0.00138 ** 
## as.factor(State)20    -0.04962    0.04409   -1.13  0.26037    
## as.factor(State)21     0.04914    0.05300    0.93  0.35384    
## as.factor(State)22     0.08009    0.05377    1.49  0.13637    
## as.factor(State)23    -0.19429    0.04977   -3.90  9.5e-05 ***
## as.factor(State)24    -0.00847    0.04421   -0.19  0.84817    
## as.factor(State)25    -0.08365    0.04772   -1.75  0.07961 .  
## as.factor(State)26     0.06985    0.04528    1.54  0.12295    
## as.factor(State)27    -0.03912    0.04133   -0.95  0.34394    
## as.factor(State)28    -0.15948    0.05451   -2.93  0.00344 ** 
## as.factor(State)29    -0.12301    0.05059   -2.43  0.01505 *  
## as.factor(State)30    -0.01932    0.04862   -0.40  0.69102    
## as.factor(State)31    -0.19929    0.04394   -4.54  5.7e-06 ***
## as.factor(State)32    -0.02532    0.06643   -0.38  0.70314    
## as.factor(State)33    -0.10065    0.05472   -1.84  0.06586 .  
## as.factor(State)35    -0.01766    0.05606   -0.32  0.75271    
## as.factor(State)36    -0.13258    0.04509   -2.94  0.00328 ** 
## as.factor(State)37    -0.20751    0.05339   -3.89  0.00010 ***
## as.factor(State)38    -0.31914    0.05708   -5.59  2.3e-08 ***
## as.factor(State)39     0.00075    0.04678    0.02  0.98720    
## as.factor(State)40    -0.07930    0.05027   -1.58  0.11471    
## as.factor(State)41     0.01341    0.04845    0.28  0.78196    
## as.factor(State)42    -0.09339    0.04976   -1.88  0.06053 .  
## as.factor(State)44    -0.08559    0.05576   -1.53  0.12480    
## as.factor(State)45    -0.06390    0.05035   -1.27  0.20435    
## as.factor(State)46    -0.34339    0.06795   -5.05  4.3e-07 ***
## as.factor(State)47    -0.03001    0.05235   -0.57  0.56651    
## as.factor(State)48    -0.08716    0.05298   -1.65  0.09995 .  
## as.factor(State)49     0.20389    0.04326    4.71  2.4e-06 ***
## as.factor(State)50     0.06916    0.05457    1.27  0.20501    
## as.factor(State)51    -0.12692    0.04705   -2.70  0.00699 ** 
## as.factor(State)53     0.07035    0.04377    1.61  0.10803    
## as.factor(State)54     0.01872    0.05269    0.36  0.72241    
## as.factor(State)55     0.00224    0.05524    0.04  0.96759    
## as.factor(State)56    -0.29794    0.06010   -4.96  7.1e-07 ***
## as.factor(State)66    -0.30773    0.08706   -3.53  0.00041 ***
## as.factor(State)72    -0.66256    0.06112  -10.84  < 2e-16 ***
## as.factor(Veteran)1   -0.00971    0.02470   -0.39  0.69411    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for quasibinomial family taken to be 0.997)
## 
## Number of Fisher Scoring iterations: 4

Model 9

model1<-svyglm(na.omit(KidneyDisease~as.factor(Age)+
                        as.factor(Race)+as.factor(Gender)+
                        as.factor(Married)+as.factor(Income)+  
                        as.factor(Education)+
                        as.factor(Employed)+
                        as.factor(State)+
                        as.factor(Veteran)),
                        design=svy2019,
                        family=quasibinomial)
#model1$oddsratios=exp(model1$coefficients) 
#model1$lower=exp(log(model1$oddsratios)-qnorm(.975)*summary(model1)$coefficients[,2])
#model1$upper=exp(log(model1$oddsratios)+qnorm(.975)*summary(model1)$coefficients[,2])
options(digits=3)
write.csv(summary(model1)$coefficients,"d:/jose/kidneydisease.csv")
summary(model1)
## 
## Call:
## svyglm(formula = na.omit(KidneyDisease ~ as.factor(Age) + as.factor(Race) + 
##     as.factor(Gender) + as.factor(Married) + as.factor(Income) + 
##     as.factor(Education) + as.factor(Employed) + as.factor(State) + 
##     as.factor(Veteran)), design = svy2019, family = quasibinomial)
## 
## Survey design:
## mysurvey <- svydesign(
##   id=~1,
##   strata = ~Stratum,
##   weights = ~Weights,
##   data = surveydata)
## 
## Coefficients:
##                       Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           -4.69564    0.30682  -15.30  < 2e-16 ***
## as.factor(Age)2        0.42083    0.16224    2.59  0.00949 ** 
## as.factor(Age)3        0.58894    0.14529    4.05  5.0e-05 ***
## as.factor(Age)4        1.01995    0.14036    7.27  3.7e-13 ***
## as.factor(Age)5        1.22425    0.14059    8.71  < 2e-16 ***
## as.factor(Age)6        1.59411    0.14042   11.35  < 2e-16 ***
## as.factor(Race)2       0.21643    0.05747    3.77  0.00017 ***
## as.factor(Race)3      -0.02866    0.18337   -0.16  0.87580    
## as.factor(Race)4       0.07420    0.10227    0.73  0.46813    
## as.factor(Race)5       0.26297    0.07721    3.41  0.00066 ***
## as.factor(Race)6       0.15945    0.10836    1.47  0.14118    
## as.factor(Gender)1     0.08540    0.04078    2.09  0.03625 *  
## as.factor(Married)2    0.08425    0.05502    1.53  0.12575    
## as.factor(Married)3    0.11185    0.04875    2.29  0.02177 *  
## as.factor(Married)4    0.07470    0.11429    0.65  0.51340    
## as.factor(Married)5   -0.09498    0.07162   -1.33  0.18475    
## as.factor(Married)6    0.02524    0.10762    0.23  0.81458    
## as.factor(Income)2    -0.17509    0.09479   -1.85  0.06472 .  
## as.factor(Income)3    -0.00955    0.09318   -0.10  0.91836    
## as.factor(Income)4    -0.08551    0.09644   -0.89  0.37528    
## as.factor(Income)5    -0.18659    0.09652   -1.93  0.05322 .  
## as.factor(Income)6    -0.25183    0.09766   -2.58  0.00992 ** 
## as.factor(Income)7    -0.37072    0.10289   -3.60  0.00031 ***
## as.factor(Income)8    -0.42894    0.10319   -4.16  3.2e-05 ***
## as.factor(Income)9    -0.33196    0.09184   -3.61  0.00030 ***
## as.factor(Education)2 -0.22627    0.25708   -0.88  0.37877    
## as.factor(Education)3 -0.32349    0.25220   -1.28  0.19960    
## as.factor(Education)4 -0.26962    0.24974   -1.08  0.28032    
## as.factor(Education)5 -0.17250    0.24863   -0.69  0.48782    
## as.factor(Education)6 -0.29654    0.24984   -1.19  0.23525    
## as.factor(Employed)2   0.06895    0.08914    0.77  0.43924    
## as.factor(Employed)3   0.86986    0.13903    6.26  3.9e-10 ***
## as.factor(Employed)4   0.23379    0.16639    1.41  0.16001    
## as.factor(Employed)5   0.46068    0.10223    4.51  6.6e-06 ***
## as.factor(Employed)6   0.03872    0.18183    0.21  0.83139    
## as.factor(Employed)7   0.82448    0.06322   13.04  < 2e-16 ***
## as.factor(Employed)8   1.54157    0.06264   24.61  < 2e-16 ***
## as.factor(State)2     -0.33096    0.18123   -1.83  0.06783 .  
## as.factor(State)4      0.37219    0.11460    3.25  0.00116 ** 
## as.factor(State)5      0.18138    0.11713    1.55  0.12148    
## as.factor(State)6      0.10626    0.11011    0.97  0.33453    
## as.factor(State)8     -0.34627    0.11817   -2.93  0.00339 ** 
## as.factor(State)9     -0.13067    0.11280   -1.16  0.24670    
## as.factor(State)10     0.40605    0.13761    2.95  0.00317 ** 
## as.factor(State)11    -0.21393    0.18234   -1.17  0.24069    
## as.factor(State)12     0.18451    0.11484    1.61  0.10812    
## as.factor(State)13     0.27879    0.12596    2.21  0.02688 *  
## as.factor(State)15     0.05617    0.14622    0.38  0.70085    
## as.factor(State)16     0.05232    0.15280    0.34  0.73204    
## as.factor(State)17    -0.02643    0.12112   -0.22  0.82729    
## as.factor(State)18     0.19486    0.10368    1.88  0.06019 .  
## as.factor(State)19    -0.16261    0.10875   -1.50  0.13484    
## as.factor(State)20     0.00675    0.10575    0.06  0.94908    
## as.factor(State)21     0.22911    0.11439    2.00  0.04519 *  
## as.factor(State)22     0.21386    0.12052    1.77  0.07598 .  
## as.factor(State)23    -0.00499    0.10824   -0.05  0.96321    
## as.factor(State)24     0.04074    0.10487    0.39  0.69766    
## as.factor(State)25    -0.16080    0.12752   -1.26  0.20733    
## as.factor(State)26     0.15445    0.10219    1.51  0.13068    
## as.factor(State)27    -0.03125    0.10141   -0.31  0.75799    
## as.factor(State)28    -0.18027    0.12732   -1.42  0.15681    
## as.factor(State)29     0.02235    0.11757    0.19  0.84926    
## as.factor(State)30    -0.16181    0.12201   -1.33  0.18476    
## as.factor(State)31    -0.08294    0.10720   -0.77  0.43914    
## as.factor(State)32     0.01239    0.16042    0.08  0.93846    
## as.factor(State)33    -0.03930    0.13157   -0.30  0.76517    
## as.factor(State)35     0.09880    0.12863    0.77  0.44245    
## as.factor(State)36    -0.16055    0.10739   -1.49  0.13492    
## as.factor(State)37     0.23250    0.12448    1.87  0.06181 .  
## as.factor(State)38     0.14414    0.12705    1.13  0.25657    
## as.factor(State)39     0.08080    0.10563    0.76  0.44431    
## as.factor(State)40     0.28580    0.11251    2.54  0.01108 *  
## as.factor(State)41     0.09815    0.12613    0.78  0.43647    
## as.factor(State)42     0.07694    0.12145    0.63  0.52640    
## as.factor(State)44    -0.19083    0.13399   -1.42  0.15438    
## as.factor(State)45    -0.10004    0.11708   -0.85  0.39282    
## as.factor(State)46     0.12059    0.15293    0.79  0.43038    
## as.factor(State)47     0.15966    0.11998    1.33  0.18328    
## as.factor(State)48     0.16235    0.12422    1.31  0.19122    
## as.factor(State)49     0.15169    0.10941    1.39  0.16561    
## as.factor(State)50    -0.15051    0.14957   -1.01  0.31428    
## as.factor(State)51    -0.02700    0.10947   -0.25  0.80515    
## as.factor(State)53     0.01026    0.10595    0.10  0.92286    
## as.factor(State)54     0.17205    0.11232    1.53  0.12558    
## as.factor(State)55    -0.00787    0.14078   -0.06  0.95541    
## as.factor(State)56    -0.16363    0.14870   -1.10  0.27116    
## as.factor(State)66     0.23746    0.19896    1.19  0.23267    
## as.factor(State)72    -0.22869    0.14005   -1.63  0.10250    
## as.factor(Veteran)1    0.08049    0.05328    1.51  0.13086    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for quasibinomial family taken to be 0.974)
## 
## Number of Fisher Scoring iterations: 7

Model 10

model1<-svyglm(na.omit(Diabetes~as.factor(Age)+
                        as.factor(Race)+as.factor(Gender)+
                        as.factor(Married)+as.factor(Income)+  
                        as.factor(Education)+
                        as.factor(Employed)+
                        as.factor(State)+
                        as.factor(Veteran)),
                        design=svy2019,
                        family=quasibinomial)
#model1$oddsratios=exp(model1$coefficients) 
#model1$lower=exp(log(model1$oddsratios)-qnorm(.975)*summary(model1)$coefficients[,2])
#model1$upper=exp(log(model1$oddsratios)+qnorm(.975)*summary(model1)$coefficients[,2])
options(digits=3)
write.csv(summary(model1)$coefficients,"d:/jose/diabetes.csv")
summary(model1)
## 
## Call:
## svyglm(formula = na.omit(Diabetes ~ as.factor(Age) + as.factor(Race) + 
##     as.factor(Gender) + as.factor(Married) + as.factor(Income) + 
##     as.factor(Education) + as.factor(Employed) + as.factor(State) + 
##     as.factor(Veteran)), design = svy2019, family = quasibinomial)
## 
## Survey design:
## mysurvey <- svydesign(
##   id=~1,
##   strata = ~Stratum,
##   weights = ~Weights,
##   data = surveydata)
## 
## Coefficients:
##                        Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           -4.539715   0.227472  -19.96  < 2e-16 ***
## as.factor(Age)2        0.654635   0.117634    5.56  2.6e-08 ***
## as.factor(Age)3        1.644197   0.111227   14.78  < 2e-16 ***
## as.factor(Age)4        2.500356   0.107721   23.21  < 2e-16 ***
## as.factor(Age)5        2.891709   0.107860   26.81  < 2e-16 ***
## as.factor(Age)6        3.188382   0.109200   29.20  < 2e-16 ***
## as.factor(Race)2       0.501504   0.032508   15.43  < 2e-16 ***
## as.factor(Race)3       0.427390   0.083536    5.12  3.1e-07 ***
## as.factor(Race)4       0.473272   0.088412    5.35  8.7e-08 ***
## as.factor(Race)5       0.544722   0.040873   13.33  < 2e-16 ***
## as.factor(Race)6       0.434414   0.056128    7.74  1.0e-14 ***
## as.factor(Gender)1     0.217650   0.022818    9.54  < 2e-16 ***
## as.factor(Married)2   -0.005060   0.032936   -0.15   0.8779    
## as.factor(Married)3    0.015337   0.030544    0.50   0.6156    
## as.factor(Married)4    0.050112   0.062061    0.81   0.4194    
## as.factor(Married)5    0.000375   0.036202    0.01   0.9917    
## as.factor(Married)6   -0.057830   0.067097   -0.86   0.3887    
## as.factor(Income)2     0.142400   0.060028    2.37   0.0177 *  
## as.factor(Income)3     0.174286   0.055476    3.14   0.0017 ** 
## as.factor(Income)4     0.113413   0.058003    1.96   0.0506 .  
## as.factor(Income)5    -0.002286   0.056293   -0.04   0.9676    
## as.factor(Income)6     0.015829   0.056043    0.28   0.7776    
## as.factor(Income)7    -0.079656   0.057891   -1.38   0.1688    
## as.factor(Income)8    -0.261752   0.055757   -4.69  2.7e-06 ***
## as.factor(Income)9    -0.104948   0.051075   -2.05   0.0399 *  
## as.factor(Education)2  0.035161   0.191452    0.18   0.8543    
## as.factor(Education)3 -0.105317   0.190027   -0.55   0.5794    
## as.factor(Education)4 -0.189724   0.187726   -1.01   0.3122    
## as.factor(Education)5 -0.176976   0.188246   -0.94   0.3471    
## as.factor(Education)6 -0.511670   0.188487   -2.71   0.0066 ** 
## as.factor(Employed)2  -0.253721   0.044786   -5.67  1.5e-08 ***
## as.factor(Employed)3   0.345297   0.073428    4.70  2.6e-06 ***
## as.factor(Employed)4   0.169590   0.101407    1.67   0.0945 .  
## as.factor(Employed)5   0.230882   0.054492    4.24  2.3e-05 ***
## as.factor(Employed)6   0.002865   0.142209    0.02   0.9839    
## as.factor(Employed)7   0.358572   0.031727   11.30  < 2e-16 ***
## as.factor(Employed)8   0.992852   0.035471   27.99  < 2e-16 ***
## as.factor(State)2     -0.500088   0.110134   -4.54  5.6e-06 ***
## as.factor(State)4     -0.178579   0.071433   -2.50   0.0124 *  
## as.factor(State)5      0.023371   0.069025    0.34   0.7349    
## as.factor(State)6     -0.260950   0.062003   -4.21  2.6e-05 ***
## as.factor(State)8     -0.482231   0.064525   -7.47  7.8e-14 ***
## as.factor(State)9     -0.250474   0.063454   -3.95  7.9e-05 ***
## as.factor(State)10     0.021175   0.081294    0.26   0.7945    
## as.factor(State)11    -0.276195   0.089331   -3.09   0.0020 ** 
## as.factor(State)12    -0.251319   0.064444   -3.90  9.6e-05 ***
## as.factor(State)13    -0.040037   0.069447   -0.58   0.5643    
## as.factor(State)15    -0.332281   0.078904   -4.21  2.5e-05 ***
## as.factor(State)16    -0.118569   0.077821   -1.52   0.1276    
## as.factor(State)17    -0.082574   0.066947   -1.23   0.2174    
## as.factor(State)18     0.067994   0.058790    1.16   0.2475    
## as.factor(State)19    -0.075013   0.058619   -1.28   0.2007    
## as.factor(State)20    -0.037247   0.057206   -0.65   0.5150    
## as.factor(State)21     0.100252   0.067391    1.49   0.1369    
## as.factor(State)22    -0.076549   0.068574   -1.12   0.2643    
## as.factor(State)23    -0.179308   0.062904   -2.85   0.0044 ** 
## as.factor(State)24    -0.095870   0.056412   -1.70   0.0892 .  
## as.factor(State)25    -0.350302   0.069177   -5.06  4.1e-07 ***
## as.factor(State)26    -0.127057   0.059357   -2.14   0.0323 *  
## as.factor(State)27    -0.221573   0.055792   -3.97  7.1e-05 ***
## as.factor(State)28     0.052537   0.064974    0.81   0.4188    
## as.factor(State)29    -0.202898   0.065955   -3.08   0.0021 ** 
## as.factor(State)30    -0.518424   0.069421   -7.47  8.2e-14 ***
## as.factor(State)31    -0.088231   0.057013   -1.55   0.1217    
## as.factor(State)32    -0.234587   0.102864   -2.28   0.0226 *  
## as.factor(State)33    -0.222057   0.072598   -3.06   0.0022 ** 
## as.factor(State)35    -0.237044   0.073556   -3.22   0.0013 ** 
## as.factor(State)36    -0.208739   0.060810   -3.43   0.0006 ***
## as.factor(State)37    -0.096348   0.071548   -1.35   0.1781    
## as.factor(State)38    -0.143407   0.072018   -1.99   0.0465 *  
## as.factor(State)39    -0.042793   0.059438   -0.72   0.4715    
## as.factor(State)40    -0.024892   0.063232   -0.39   0.6938    
## as.factor(State)41    -0.372176   0.071765   -5.19  2.1e-07 ***
## as.factor(State)42    -0.130599   0.068816   -1.90   0.0577 .  
## as.factor(State)44    -0.171314   0.072754   -2.35   0.0185 *  
## as.factor(State)45     0.020983   0.063977    0.33   0.7429    
## as.factor(State)46    -0.033782   0.094867   -0.36   0.7218    
## as.factor(State)47     0.097234   0.065634    1.48   0.1385    
## as.factor(State)48    -0.011320   0.070229   -0.16   0.8719    
## as.factor(State)49    -0.144401   0.062086   -2.33   0.0200 *  
## as.factor(State)50    -0.314457   0.078267   -4.02  5.9e-05 ***
## as.factor(State)51    -0.086904   0.060570   -1.43   0.1514    
## as.factor(State)53    -0.191489   0.058936   -3.25   0.0012 ** 
## as.factor(State)54     0.152804   0.064662    2.36   0.0181 *  
## as.factor(State)55    -0.364235   0.077291   -4.71  2.4e-06 ***
## as.factor(State)56    -0.432975   0.083650   -5.18  2.3e-07 ***
## as.factor(State)66    -0.058809   0.114038   -0.52   0.6061    
## as.factor(State)72    -0.161688   0.074074   -2.18   0.0291 *  
## as.factor(Veteran)1    0.082708   0.028605    2.89   0.0038 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for quasibinomial family taken to be 0.989)
## 
## Number of Fisher Scoring iterations: 6