In a survey people were asked, “Is addiction a disease or are addicts weak-willed?” The response was in three categories, 0 = “addicts are weak-willed,” 1 = “addiction is a disease,” or 2 = “both alternatives hold”. Use an appropriate model to examine how the response depends on respondent’s gender (0 = male, 1 = female), age, and academic status (1 = academic or 0 = otherwise). The dataset is available as addiction{catdata}.
## ill gender age university
## 1 1 1 61 0
## 2 0 1 43 0
## 3 2 0 44 0
## 4 0 1 21 1
## 5 0 0 33 0
## 6 1 0 83 0
## 'data.frame': 712 obs. of 4 variables:
## $ ill : int 1 0 2 0 0 1 0 1 1 1 ...
## $ gender : int 1 1 0 1 0 0 0 0 1 0 ...
## $ age : int 61 43 44 21 33 83 29 61 37 19 ...
## $ university: int 0 0 0 1 0 0 0 0 0 0 ...
m0_addic<-glm(ill~factor(gender)+age+factor(university), data=addiction, family = poisson)
summary(m0_addic)##
## Call:
## glm(formula = ill ~ factor(gender) + age + factor(university),
## family = poisson, data = addiction)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.92293 -1.17525 0.01138 0.33807 1.33959
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.570631 0.113507 -5.027 4.98e-07 ***
## factor(gender)1 0.081732 0.079617 1.027 0.30462
## age 0.010792 0.002222 4.857 1.19e-06 ***
## factor(university)1 0.235455 0.084554 2.785 0.00536 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for poisson family taken to be 1)
##
## Null deviance: 528.42 on 681 degrees of freedom
## Residual deviance: 498.77 on 678 degrees of freedom
## (30 observations deleted due to missingness)
## AIC: 1570.6
##
## Number of Fisher Scoring iterations: 5