The video below provides a walk through of a potential coding solution to the assignment, using political ideology as the variable of interest. There are, of course, many possible ways to do this assignment, so the solution presented in the video is simply one of the many possible ways to do it.

Time stamp Section
0:00 Introduction
1:23 4.1: Variable description
30:21 4.2: Visualizing the variable of interest, aggregated across states
40:00 4.3: Visualizing the relationship between the variable of interest and vote share for Trump
48:24 4.4: Regression

Note: In this video, I use the “stargazer” library to display the regression table. The “stargazer” library is no longer kept up to date by its author, and thus cannot display a number of newer R model objects. Thus in the course, and in your assignments, I expect you to use the “modelsummary” library for displaying tables, which I use in all of the exercises in this course.