Skip to content
Snippets Groups Projects
Commit bb8987bc authored by irisqlin's avatar irisqlin
Browse files

Update FinalProj.Rmd

parent 741000d0
No related branches found
No related tags found
No related merge requests found
---
title: "finalproj403"
author: "Iris Lin and Hannah Zhou"
author: "irisqlin"
date: "11/13/2021"
output: html_document
---
......@@ -278,10 +278,45 @@ anova(cig_mod_3, cig_mod_2, test="Chisq")
anova(cig_mod_3, cig_mod_1, test="Chisq")
# The difference in deviance is significantly significant, the drop in dev test prefers the smaller model, mod 3
summary(cig_mod_3)
exp(coef(cig_mod_3))
```
## Marijuana model
```{r}
# making models, 1 = abusing substance, 0 = not abusing substance
mar_threshold <- mean(data$X30marijuana)
data$mar_var <- ifelse(data$X30marijuana >= mar_threshold, 1, 0)
# total model
mar_total_mod <- glm(mar_var ~ pride + truth + responsibility + friends + fix.problems + decision + excite + hard.work + safe + best.school + talk.adult + grades + Wpdrink + N.safe, data = data, family = "binomial")
summary(mar_total_mod)
# dropped by p > 0.1
mar_mod_1 <- glm(mar_var ~ truth + decision + excite + best.school + grades + Wpdrink, data = data, family = "binomial")
summary(mar_mod_1)
#likelihood ratio test to test whether the observed difference in model fits is statistically significant
# source: https://www.listendata.com/2016/07/insignificant-levels-of-categorical-variable.html
anova(mar_mod_1, mar_total_mod, test="LRT")
# not sig, prefer smaller model mod 1
# Drop in deviance test
anova(mar_mod_1, mar_total_mod, test="Chisq")
# not sig, essentially no difference in residual deviance values
summary(mar_mod_1)
exp(coef(mar_mod_1))
```
```{r}
# Extra code
fiveDrinks_mod_3 <- glm(fiveDrinks_var ~ Wpdrink + friends, data = data, family = "binomial")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment