Open njtierney opened 5 years ago
Here is some content from the mixed models vignette that is getting moved here for the time being.
wages_fit_int <- lmer(ln_wages ~ xp + ged + (xp |id), data = wages)
We can use the tools from modelr
to add predictions and residuals to the data
wages_aug <- wages %>%
add_predictions(wages_fit_int, var = "pred_int") %>%
add_residuals(wages_fit_int, var = "res_int")
# Exploring changes across models
We can also explore how the data match the model when we change the model
```{r}
wages_fit_int_slope <- lmer(ln_wages ~ xp + ged + (1 + xp |id),
data = wages)
wages_aug_int_slope <- wages_aug %>%
add_predictions(wages_fit_int_slope, var = "pred_int_slope") %>%
add_residuals(wages_fit_int_slope, var = "res_int_slope")
Explore fitting a model and exploring the individual observations.
For example, imagine fitting two models:
When comparing models, the instinct might be to do something like:
But what about comparing and exploring what the model predictions mean at the individual level?