Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explore two models with brolgar #69

Open
njtierney opened this issue Sep 3, 2019 · 1 comment
Open

Explore two models with brolgar #69

njtierney opened this issue Sep 3, 2019 · 1 comment

Comments

@njtierney
Copy link
Owner

Explore fitting a model and exploring the individual observations.

For example, imagine fitting two models:

  1. Linear mixed effects model predicting ln_wages - fitting a slope and intercept for each individual.
  2. As for 1., but with a fixed effect for education.

When comparing models, the instinct might be to do something like:

  • Compare the two models with AIC or BIC

But what about comparing and exploring what the model predictions mean at the individual level?

@njtierney
Copy link
Owner Author

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")

```

@njtierney njtierney removed the priority label Dec 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant