Hello there, friend! Welcome to the most random Shiny App you've ever visited.

Purpose:

The purpose of this Shiny app is to visualize the changes that happen to your mixed-effects models. Specifically, to visualize the residuals and the standard error of the fixed effects when you add random effects to a mixed-effects model.


Audience:

This Shiny app is for you if you have ever fit a mixed-effects model and have had difficulty imagining what is happening to the explained variance of your model as you add different parameters. It can be used to understand your own models but also as a teaching tool to help others understand the theoretical principles behind adding random effect parameters to your mixed-effects model.


Stability:

You will see that as you click around on the random effect parameters, they will be added or removed from the model, which in turn has an effect on the residuals and standard error.


A guide to our beautiful Shiny App:
  • The Simulate Button: This button will simulate data based on our generative (correct) model.
  • The Random Effects: These checkboxes allow you to select the random effects you would like to add to the model you are estimating.
  • The Residual Plot Tab: A demonstration of the residuals from the generative (correct) model (black dots) compared to the residuals from the model you are estimating (red dots).
  • The Forest Plot Tab: A demonstration of the fixed effects (pink squares) and their confidence intervals (blue lines). This plot also contains a vertical line at 0 to see if your fixed effects are significant.
A suggested order of operations:
  1. Simulate data based on the generative model
  2. Choose which random effects you would like to include in your model
  3. Pick a plot to view
  4. Change around the random effects you chose originally
  5. See the dynamic magic before your eyes!

Estimated residuals from current model: Estimated residuals from the generative (correct) model:

The Residual Plot: A demonstration of the residuals from the generative (correct) model (black dots) compared to the residuals from the model you are estimating (red dots). The x-axis is broken up into chunks representing a subset of the participants in the study. Within each chunk, the residuals associated with each item completed can be found. The y-axis, with 0 in the middle, demonstrates the size of the residual.


Note: In mixed-effects models, you would like to reduce the amount of residuals (i.e., have them closest to 0) because you would like to explain as much variance as possible (i.e., have as little unexplained variance as possible).

Note some more: In mixed-effects models, you want the residuals to be completely independent from one another, as this is an assumption that is made when running this model. In other words, you do not want to see any pattern in the residual plot.

Note even more: In mixed-effects models, it is possible to overfit your data such that you become overconfident in the model you have estimated.

The Forest Plot: A demonstration of the fixed effects (pink squares) and their confidence intervals (blue lines). This plot also contains a vertical line at 0 to see if your fixed effects are significant.


Note: As the model becomes complex, the confidence intervals become larger. This is because when models are too simple, we become overly confident about the precision of our estimates (i.e., have smaller confidence intervals).





This app was created during a TquanT seminar by Kelsey MacKay (Leuven), Hannah Rós Sigurðardóttir (Amsterdam), Johanna Xemaire (Tübingen) and Cristina Mendonça (Lisbon).