Skip to content

Commit

Permalink
Merge pull request #18 from mccarthy-m-g/chapter-4
Browse files Browse the repository at this point in the history
Update chapter 4 examples
  • Loading branch information
mccarthy-m-g authored Apr 28, 2024
2 parents 3f2e1bb + 1ce632d commit 4fdacff
Show file tree
Hide file tree
Showing 3 changed files with 652 additions and 242 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Config/Needs/website:
lavaan,
lme4,
modelbased,
modelsummary,
muhaz,
patchwork (>= 1.2.0),
performance,
Expand Down
5 changes: 3 additions & 2 deletions vignettes/articles/chapter-3.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ We can visualize the differences between complete pooling, no pooling, and parti
To do so, we'll first use the `augment()` function from the **broom** and **broom.mixed** packages to get the predicted values for each child's fitted trajectory from the complete pooling, no pooling, and partial pooling models. Note that `augment()` is a generic function, whose methods for linear and multilevel models are available in the broom broom.mixed packages, respectively.

```{r}
# Because the complete pooling model a group indicator for individuals, we need
# to manually add the IDs to the predicted values.
# Because the complete pooling model does not have a group indicator for
# individuals, we need to manually add the IDs to the predicted values.
early_intervention_pred_cp <- early_intervention_fit_cp |>
augment() |>
mutate(model = "complete_pooling", id = early_intervention$id)
Expand Down Expand Up @@ -364,6 +364,7 @@ Before fitting this model, we find it helpful to substitute the level-2 equation

- It makes the parameters of the model easier to identify, particularly in the case of interactions between level-1 and level-2 predictors.
- It is the format most mixed-effects modelling packages in R use to specify the model formula.
- It clarifies which statistical model is actually being fit to the data by the software.

$$
\begin{align}
Expand Down
Loading

0 comments on commit 4fdacff

Please sign in to comment.