Exercise 1

Create a table1 and use GGally::ggpairs to explore your data.

Table 1: Demographic stratified by lifetime marijuana use
No
(N=491)
Yes
(N=509)
Sex
Female 285 (58.0%) 249 (48.9%)
Male 206 (42.0%) 260 (51.1%)
Alcohol (age first used)
Mean (SD) 19.7 (5.09) 16.0 (3.08)
Median [Min, Max] 19.0 [3.00, 45.0] 16.0 [3.00, 29.0]
Missing 145 (29.5%) 12 (2.4%)
Age
18-25 53 (10.8%) 80 (15.7%)
26-34 52 (10.6%) 87 (17.1%)
35-49 129 (26.3%) 136 (26.7%)
50-64 109 (22.2%) 132 (25.9%)
65+ 148 (30.1%) 74 (14.5%)
Income
Less than $20,000 76 (15.5%) 85 (16.7%)
$20,000 - $49,999 166 (33.8%) 127 (25.0%)
$50,000 - $74,999 64 (13.0%) 81 (15.9%)
$75,000 or more 185 (37.7%) 216 (42.4%)

##            mj_lifetime    
##  demog_sex          No Yes
##     Female         285 249
##       Male         206 260
##            mj_lifetime      
##  demog_sex          No   Yes
##     Female       53.4% 46.6%
##       Male       44.2% 55.8%

Exercise 2

Use the contingency table below to calculate (a) probability of lifetime marijuana among sample subjects (independent of sex), among sample females and among sample males, (b) Odds of lifetime marijuana use among sample subjects, among sample females and among sample males. (c) What is the risk difference, the risk ratio and the odds ratio when comparing lifetime marijuana use among males and females in our sample?

Prediction General Female Male
Probability 0.509 0.466 0.558
Odds 1.037 0.874 1.262
Log Odds 0.036 -0.135 0.233
Contrast Males vs. Females
Risk difference 0.092
Risk Ratio 1.197
Odds ratio 1.444
Log odds ratio 0.367

Exercise 3

You will now estimate the same measures from the previous question, but this time using two types of regressions: a logistic regression and a regular least squares linear regression. Show your code and present your results in a table adding the confidence intervals (see below). Explain your findings: what are the differences between the three approaches (using a contingency table as in the question above, using logistic regression and using linear regression)? What explains these differences (or lack thereof)? What are the advantages/drawbacks of using one approach over the other?

## # A tibble: 1 × 7
##   term        estimate std.error statistic p.value conf.low conf.high
##   <chr>          <dbl>     <dbl>     <dbl>   <dbl>    <dbl>     <dbl>
## 1 (Intercept)    0.233    0.0933      2.50  0.0126   0.0505     0.416
Prediction General Female Male
Probability 0.509 CI [0.478, 0.54] 0.466 CI [0.424, 0.509] 0.558 CI [0.513, 0.603]
Odds 1.037 CI [0.916, 1.174] 0.874 CI [0.737, 1.035] 1.262 CI [1.052, 1.516]
Log Odds 0.036 CI [-0.088, 0.16] -0.135 CI [-0.305, 0.035] 0.233 CI [0.051, 0.416]
Prediction General Female Male
Probability 0.509 CI [0.478, 0.54] 0.466 CI [0.424, 0.509] 0.558 CI [0.513, 0.603]
Odds 1.037 CI [0.916, 1.174] 0.874 CI [0.736, 1.036] 1.262 CI [1.052, 1.52]
Log Odds 0.036 CI [-0.088, 0.16] -0.135 CI [-0.307, 0.035] 0.233 CI [0.051, 0.419]
Contrast Males vs. Females me_lm Males vs. Females me_glm Males vs. Females glm
Risk difference 0.092 CI [0.03, 0.154] 0.092 CI [0.03, 0.153] -
Risk Ratio 1.197 CI [1.051, 1.342] 1.197 CI [1.051, 1.342] -
Odds ratio 1.445 CI [1.125, 1.855] 1.445 CI [1.125, 1.854] 1.445 CI [1.126, 1.855]
Log odds ratio 0.368 CI [0.118, 0.618] 0.368 CI [0.118, 0.617] 0.368 CI [0.119, 0.618]

Exercise 4

Write up your results using the template shown below.

Conclusion: Males have significantly higher odds of lifetime marijuana use than females (OR = 1.445 CI 95% [1.125, 1.854, p = 0.004). Males have 44.5% (higher) odds of lifetime marijuana use than females.

Exercise 5

Whereas in the previous questions we explored the relationship between lifetime marijuana use and sex, we will now explore the association between lifetime marijuana use (mj_lifetime) and age at first use of alcohol (alc_agefirst)? Fit a logistic regression and interpret the results, using the template shown below.

Age at first alcohol use is significantly negatively associated with lifetime marijuana use (OR = 0.753 ; 95% CI = 0.713 , 0.792 ; p < 0.001 ). Individuals who first used alcohol at age 19 years have 25.06 % lower odds of having ever used marijuana than those who first used alcohol at age 18 years. In contrast, the reduction in odds associated with starting drinking alcohol 3 years later is -67.826 % lower odds.

Exercise 6

What is the association between lifetime marijuana use (mj_lifetime) and age at first use of alcohol (alc_agefirst), adjusted for age (demog_age_cat6), sex (demog_sex), and income (demog_income)? Fit a model with and without an interaction term (alc_agefirst:demog_sex) and compute the AOR, its 95% CI, and the p-value that tests the significance of age at first use of alcohol. Report also their AORs of the other predictors, their 95% CIs and p-values. Since there are some categorical predictors with more than two levels, use car::Anova(model, type = 3) function to compute p-values for multiple degrees of freedom. In your answer, fill in the template below.

The AOR for our primary predictor alc_agefirst is 0,759 (with interaction 0,713). This represents the OR for lifetime marijuana use comparing those with a one-year difference in age at first use of alcohol, adjusted for age, sex, and income.

The remaining AORs compare levels of categorical predictors to their reference level, adjusted for the other predictors in the model. For example, comparing individuals with the same age of first alcohol use, sex, and income, 35-49 year-olds have 55.3 % (with interaction 55.8 %) lower odds of lifetime marijuana use than 18-25 year-olds (OR = 0.447 ; 95% CI = 0.247 , 0.791 ; p = 0,007 | with interaction: OR = 0.442 ; 95% CI = 0.243, 0.784 ; p = 0,006). An overall 4 df p-value for age can be read from the Type III Test table. It is significant at p = 0.001 . An overall, 3 df p-value for income is not significant at (p = 0.1).

Conclusion: After adjusting for age, sex, and income, age at first alcohol use is significantly negatively associated with lifetime marijuana use (AOR = 0.759 ; 95% CI = 0.718 , 0.8 ; p < 0.001 | with interaction AOR = 0.713 ; 95% CI = 0.654 , 0.772 ; p < 0.001 ). Individuals who first used alcohol at a given age have 24.1% (with interaction: 28.7 %) lower odds of having ever used marijuana than those who first used alcohol one year earlier. The association between age of first alcohol use and lifetime marijuana use differs significantly between males and females (p = 0.0322 ). A likelihood ratio test shows that the adjusted model with the interaction is superior to the one without the interaction (p = 0,031)

Exercise 7

Replicate the model summary shown below, and discuss its main features. Use the likelihood ratio test to determine which model is best, and discuss the association between age of first alcohol and lifetime marijuana use, when comparing males to females.

unadjasted adjusted interaction
(Intercept) 5.341*** 6.254*** 7.374***
(0.475) (0.591) (0.829)
alc_agefirst -0.284*** -0.275*** -0.338***
(0.027) (0.028) (0.042)
demog_age_cat626-34 -0.296 -0.295
(0.329) (0.331)
demog_age_cat635-49 -0.804** -0.816**
(0.297) (0.299)
demog_age_cat650-64 -0.690* -0.687*
(0.299) (0.301)
demog_age_cat665+ -1.275*** -1.260***
(0.304) (0.306)
demog_sexMale -0.061 -2.138*
(0.162) (0.985)
demog_income$20,000 - $49,999 -0.531* -0.530*
(0.266) (0.268)
demog_income$50,000 - $74,999 -0.079 -0.093
(0.305) (0.307)
demog_income$75,000 or more -0.361 -0.363
(0.253) (0.255)
alc_agefirst × demog_sexMale 0.119*
(0.056)
Num.Obs. 843 843 843
AIC 972.4 955.6 952.9
BIC 981.9 1002.9 1005.0
Log.Lik. -484.219 -467.776 -465.448
F 112.743 14.804 13.139
RMSE 0.44 0.43 0.43
+ p < 0.1, * p < 0.05, ** p < 0.01, *** p < 0.001

The interaction term coefficient for “Alcohol (age first used) × Sex [Male]” is 0.119. This means that the effect of “Alcohol (age first used)” on the log-odds of the outcome is modified by being male. Specifically, for each one-unit increase in “Alcohol (age first used)” for males, the log-odds of the outcome increase by an additional 0.119 compared to females.

Exercise 8

Replicate the forest plot shown below, using centralized variables scaled such that standard deviations are 0.5 (you can use the function datawizard::standardize(two_sd = TRUE). What is the advantage of this plot compared to the model summary tables shown above?

The advantage of using a forest plot helps you at a glance to optically see differences between categories and interactions. Also the colour difference helps you to observe positive or negative confidence intervals. Furthermore, beacause the log-odds are standardized it is more clearly visible to what extent the differences reach.

Exercise 9

We want to continue exploring the association between age of first alcohol use and lifetime marijuana use, and how this association varies between males and females. Try to replicate the following graphs, and interpret what you see. Note also that something interesting happens at the age of 18. What is special about that age, according to the two graphs? Is the difference between the predicted outcomes of males and females significant at any age bracket? If so, what is the age bracket?

As visible in the first graph, the turning point is around the age of 18 for alcohol first used. Before 18, males have an increased predicted probability of lifetime marijuana use as compared to females, with identical age. In the 2nd graph, we see that for Pr(female) - Pr(male) there is a positive probability difference before 18, while there is a negative differencte after 18, underlining this train of thought. From the 2nd graph, the age bracket between ~9 and 13 seems to hold signficance regarding difference between predicted outcomes of males and females, as the confidence intervals do not cross the y-axis at 0 here, showcased by the greyed area.