library(tidymodels)
library(broom)
library(marginaleffects)
```

```{r}
#| cache: true
x &lt;- stops |&gt;
  filter(race %in% c("black", "white")) |&gt;
  mutate(race = str_to_title(race), 
         sex = str_to_title(sex))

fit_stops &lt;- linear_reg() |&gt;
    set_engine("lm") |&gt;
    fit(arrested ~ sex + race*zone, data = x)
fit_stops
```

```{r}
fit_stops_logistic &lt;- logistic_reg() |&gt;
  set_engine("glm") |&gt;
  fit(as.factor(arrested) ~ sex + race, data = x)

tidy(fit_st