The lab specifications can be found [here]

Exercise 1

Use the table1 package to create a table with appropriate descriptive information about the data set. Use the examples provided in the following vignette to help you build a table.

Maternal demographics stratified by smoking
No
(N=1564)
Yes
(N=124)
Birth Weight (g)
Mean (SD) 3250 (601) 3070 (597)
Median [Min, Max] 3290 [369, 5880] 3090 [630, 4220]
Risk Factors Reported
No 1088 (69.6%) 84 (67.7%)
Yes 476 (30.4%) 40 (32.3%)
Mother Age
Mean (SD) 29.0 (5.79) 27.8 (5.79)
Median [Min, Max] 29.0 [15.0, 49.0] 28.0 [17.0, 42.0]
Mother Race/Hispanic Origin
NH White 844 (54.0%) 94 (75.8%)
NH Black 266 (17.0%) 14 (11.3%)
NH Other 125 (8.0%) 10 (8.1%)
Hispanic 329 (21.0%) 6 (4.8%)
Marital Status
Married 1017 (65.0%) 40 (32.3%)
Unmarried 547 (35.0%) 84 (67.7%)
Mother Education
lower 177 (11.3%) 34 (27.4%)
HS 377 (24.1%) 45 (36.3%)
Some college 437 (27.9%) 37 (29.8%)
Uni 573 (36.6%) 8 (6.5%)
PRIORLIVE
0 601 (38.4%) 38 (30.6%)
1 516 (33.0%) 41 (33.1%)
2 265 (16.9%) 17 (13.7%)
3 93 (5.9%) 17 (13.7%)
4+ 89 (5.7%) 11 (8.9%)
PRIORDEAD
0 1551 (99.2%) 123 (99.2%)
1+ 13 (0.8%) 1 (0.8%)
Mother BMI
Mean (SD) 26.9 (6.32) 27.3 (6.42)
Median [Min, Max] 25.6 [15.6, 58.4] 26.3 [16.5, 50.1]

Bonus: Provide a brief description, interpretation or reflection about your findings from the table: (e.g., what do you notice? what do you wonder? how does this relate to you or your community?)

Answer: See table as well. We see that less than 7.3% of the mothers smoked. The mean birth weight is a bit lower than the median birth weight for both smokers and non-smokers, suggesting a few babies at least with a low birth weight (left skewed). Mothers who smoked were more often of Non-Hispanic White descent and much more often unmarried. Additionally, smoking mothers had a lower educational status. Finally, there were small differences in age and BMI with smoking mothers being younger and heavier.

Exercise 2

Use the ggpairs function to explore the association between the different variables. Try to replicate the figure below, or create your own variation.

Bonus: Provide a brief description, interpretation or reflection about your findings from the table.

Answer: See plot as well. The plotted data aligns with the tabulated data. Smoking mothers are slightly younger, more often unmarried and babies from smoking mothers have a lower birth weight. There are correlations between mothers age and BMI and mothers age and the baby birth weight. The latter is depending on the smoking status of the mother. The bar charts are bit hard to interpret in the plots because they are very dense and the % of smoking mothers is relatively small (7.3%). The histograms and diagonal density plots are easier to interpret.

Exercise 3

Fit four linear models, each nested within the other: the null model, the unadjusted model, the full model and the optimal model. Use the step function find the optimal model using the stepwise method. Then use anova to compare the four models. What is your conclusion? Now compare your models using modelsummary function. What does the number in the (brackets) mean? How can you identify the optimal model just by looking at the \(R^2\) and the AIC?

null unadjasted optimal full
(Intercept) 3234.746*** 3247.903*** 3080.559*** 3162.373***
(14.658) (15.187) (64.625) (107.021)
CIG_RECYes -179.096** -160.083** -156.593**
(56.032) (55.632) (56.325)
DMARUnmarried -184.275*** -189.782***
(31.823) (35.084)
MRACEHISPNH Black -292.140*** -290.175***
(41.690) (41.829)
MRACEHISPNH Other -121.695* -120.774*
(52.796) (52.960)
MRACEHISPHispanic -74.492+ -72.464+
(38.075) (39.120)
BMI 10.261*** 10.493***
(2.259) (2.277)
risksYes -158.808*** -152.902***
(31.655) (32.055)
PRIORLIVE1 130.686*** 140.483***
(33.814) (34.725)
PRIORLIVE2 107.170* 123.385**
(41.746) (43.880)
PRIORLIVE3 138.776* 161.298*
(59.972) (63.149)
PRIORLIVE4+ 131.949* 162.508*
(62.333) (67.562)
PRIORDEAD1+ 258.434+ 265.467+
(153.905) (154.184)
MAGER -3.836
(3.085)
MEDUCHS 8.448
(49.909)
MEDUCSome college -0.240
(50.838)
MEDUCUni 31.610
(56.902)
Num.Obs. 1688 1688 1688 1688
R2 0.000 0.006 0.104 0.105
R2 Adj. 0.000 0.005 0.098 0.097
AIC 26401.9 26393.7 26239.9 26246.1
BIC 26412.7 26410.0 26315.9 26343.8
Log.Lik. -13198.942 -13193.843 -13105.946 -13105.039
F 10.217 16.259 12.291
RMSE 602.05 600.23 569.78 569.47
+ p < 0.1, * p < 0.05, ** p < 0.01, *** p < 0.001

Answer: The number in brackets represents the Standard Error. We can identify the optimal model by looking at the highest R^2 and the lowest AIC. We can compare based on adjusted R^2 because the models are nested within each other. The optimal model performs better than the null and unadjusted. The optimal model does perform slightly better than the full model if we look at the adjusted R^2 metric.

Exercise 4

Center and scale all the continuous variables, and create a forest plot for the optimal model.

Answer: Here forest plot is displayed of predictors together with their coefficients. Blue lines represent a positive contribution to birth weight, the opposite for the red lines meaning a negative contribution to birth weight. Examples for interpreation: Smoking during pregnancy seems to be associated with a decrease in birth weight; Unmarried women seem to deliver babies with a lower weight.

Exercise 5

How do the effect estimate of smoking, the standard error of its estimate, its 95% confidence interval, and its statistical significance change between the un-adjusted, optimal and full models? Please use the centered and scaled models to answer this question.

## # A tibble: 3 × 7
##   model      CIG_RECYes std.error statistic p.value conf.low conf.high
##   <chr>           <dbl>     <dbl>     <dbl>   <dbl>    <dbl>     <dbl>
## 1 Unadjusted     -0.149    0.0465     -3.20 0.00142   -0.240   -0.0575
## 2 Optimal        -0.133    0.0462     -2.88 0.00406   -0.224   -0.0423
## 3 Full           -0.130    0.0468     -2.78 0.00549   -0.222   -0.0383

Answer: The effect estimates for smoking decreases from unadjusted model to full model indicating a potentially diminishing effect as more variables are included in the model. Standard errors are quite similar between the models, indicating relatively consistent estimates. The 95% confidence interval decreases as the model adjusts for more variables, which is expected as the precision improves. p-values are below 0.05 for all models, suggesting statistical significance in each model.

Exercise 6

Does the association between cigarette smoking during pregnancy and birth weight depend on mother’s education? Modify the FULL model appropriately to be able to answer this question. Use anova to test whether the model with the interaction is significantly better than the one without it. Regardless of statistical significance, create a dumbell plot illustrating the smoking effect at each level of mother’s education and estimate the cigarette smoking effect at each level of mother’s education. Hint: When creating the dataset for plotting, include the value zero for each predictor not included in the interaction (the reference level for all categorical variables). Picking the value zero in a centered predictor is like choosing the mean of that variable, which is a reasonable choice.

Answer: Based on the plot it seems that smoking changes the birth weight of the babies depending on the education of the mother, but the model including the three-way interaction is not significantly better than the one without it.

More extensively: We’ve recreated the Hispanic graph and compared the association between cigarette smoking during pregnancy and birth weight and whether this depend on mother’s education. We can observe that there is no difference between birth weight and mother education for the non-smokers but there is a widespread variation for the smokers in birth weight based on their education level. we can see an increase in birth weight for University educational levels and High school, a neutral association for High school and a decrease in birth weight for ‘some college’ educational levels.

Exercise 7

Does the association between mother’s BMI and birth-weight differ between mothers of different race/ethnicity? Modify the OPTIMAL model appropriately to be able to answer this question, using the dataset with the centered variables. Use anova to test whether the model with the interaction is significantly better than the one without it. Regardless of statistical significance, estimate the BMI effect at each level of mother’s race/ethnicity and plot the BMI effect at each level of mother’s race/ethnicity using a dumbell plot.

Answer: The model including the interaction is not significantly better than the one without it.

Bonus: Provide a brief description, interpretation or reflection about what you see in the plot (e.g., what do you notice? what do you wonder?): In the plot, we see that BMI influences birth weight differently for different races/ethnicities of the mother. While Hispanic, black, and white moms show a similar slope, mothers with other races/ethnicities show a steeper one. Therefore it seems that for these races/ethnicities (NH Other) the effect of BMI on birth weight is significantly larger as compared to other races/ethnicities. Furthermore, we clearly see that black mothers have a lower birth weight overall as compared to all other races/ethnicities. It would be interesting to see what the “NH Other” group consists of specifically, to further elucidate which race/ethnicity might influence this difference the most. Or if perhaps all races/ethnicities in this group show a bigger effect of BMI on birth weight.

Exercise 8

Does the association between mother’s BMI and birth-weight depend on mother’s age? Modify the FULL model appropriately to be able to answer this question, using the dataset with the centered variables. Use anova to test whether the model with the interaction is significantly better than the one without it. Regardless of statistical significance, estimate the BMI effect for mothers age 20, 30, and 40 years and make a plot illustrating the BMI effect at each of these ages.

Bonus: Provide a brief description, interpretation or reflection about what you see in the plot (e.g., what do you notice? what do you wonder?): In this plot, we can see that the effect of BMI on birth weight is more or less similar between different ages (20, 30 and 40), as depicted by the similar slopes. However, it seems that younger mothers usually have a larger birth weight on average. This depends on the BMI of said mother since we can see that a mother aged 30 with an increased BMI (mean + sd) is associated with a larger birth weight than a mother aged 20 without an increased BMI (mean). This holds true for the differences in mothers aged 30 and 40 as well, although to a lesser extent. We wonder what the effect might be across all ages, rather than stratified into set groups. At what ages would the difference in birth weight be the most? Where does this effect kick in and at around what age does it settle down?