Chapter 18 - Generalized Linear Models

Before beginning to answer these questions, you’ll need a categorical outcome variable (binary), a count variable (optional), and continuous/categorical predictors in your data set. The models don’t necessarily have to make theoretical sense.

Logistic Regression

18.1. Use a logistic regression to understand the relationship between your binary outcome and one of your predictors. What do the coefficients from this model mean here? Is this in an intuitive metric?

Answer:

18.2. We can get more interpretable effects using Odds Ratios and Average Marginal Effects (AME). First, we’ll get the odds ratios using the educ7610::oddsratios() function. Interpret the odds ratios and the confidence intervals of these odds ratios in context of the research question.

Answer:

18.3. Now we’ll get the AMEs. We’ll use the margins package again. Interpret these AMEs in context of the research question.

Answer:

18.4. Check the diagnostics of this logistic regression model using plot() These diagnostics will look different than in linear regression due to the nature of the dichotomous outcome. Are there any notable problems?

Answer:

Poisson Regression - Optional

If you have a count variable, feel free to complete this aspect of the homework as practice.

18.5. Run a poisson regression. What do the coefficients mean here?

Answer:

18.6. We can also get risk ratios for Poisson regression with educ7610::riskratios(). (Note that the risk ratio and the odds ratios functions do the exact same thing: grab the coefficients and confidence intervals and exponentiate them.) Interpret the risk ratios in context of the research question.

Answer:

18.7. Let’s also get the AMEs. Interpet these in context of the research question.

Anwer:

Ordinal Logistic Regression - Optional

If you have a count variable, feel free to complete this aspect of the homework as practice.

Do the same steps as for logistic regression previously.

Structural Equation Modeling

18.8. SEM is a complex set of tools that encompass a great deal of research questions. This is only going to be the briefest of brief introductions here. To do so, we will use the main SEM package lavaan (stands for LAtent VAriable ANalysis). To use lavaan we will create a model specification that is just a long string. Create a model for lavaan to use and run it using sem(). Have the model be predicting a continuous outcome with a continuous predictor. What is the effect of your predictor of interest on the outcome? Is it significant?

Answer:

18.9. Show the standardized effects from this model. What is the standardized effect of the predictor of interest? How would you interpret that?

Answer:

Chapter 15 - Mediation

Before beginning to answer these questions, you’ll need an outcome, a mediating variable and a predictor variable. These can be all continuous or some can be categorical.

15.1. Run a mediation model with either lavaan or MarginalMediation, whichever fits your research questions better. Interpret the direct and indirect effects of the model.

Answer:

15.2. Because each part of the mediation is a linear model, we can assess the assumptions as we’ve done before using the individual models. Do you see any issues or extreme values from the figures? What about the diagnostic statistics?

Answer:

Moderated-Mediation (Conditional Process Analysis) - Optional

15.3. There are times that a combination of moderation and mediation are of interest. This can be a challenge but it is possible. Let’s use lavaan for this one as that functionality is still in development in MarginalMediation. Did your moderator moderate any of the paths? (For more information on moderated mediation see nickmichalak.com)

Answer: