Skip to contents

Overview

mlmr is an open-source Shiny app and R toolkit for fitting, understanding, and reporting mixed-effects and multilevel models in R. It is designed for researchers who want a guided modeling workflow while keeping the underlying R code visible and reproducible.

The app is built around four practical goals:

  • specify a model without hiding the formula;
  • make centering and random-effects choices explicit;
  • show equations, variance components, and Tau matrix structure;
  • export tables, code, LaTeX, and Quarto-ready reports.

Install the Public Beta

install.packages("remotes")
remotes::install_github("MarcusHarrisUConn/mlmr")

Then load the package:

Launch the App

mlmr::run_mlmr()

The app opens with a built-in HSB-style example so users can test the full workflow before uploading their own data.

Uploaded data can be provided as CSV, TSV/TXT, Excel, SPSS, SAS, or Stata files. Excel support uses the optional readxl package, and SPSS/SAS/Stata support uses the optional haven package.

How the Interface Is Organized

The app uses a small number of main tabs so users can move from data to model results without losing the thread of the analysis.

  • Data is for selecting the built-in example, uploading files, checking missingness, and reviewing variable roles.
  • Model is for declaring the outcome, grouping factors, predictor levels, centering choices, interactions, and random-effects structure.
  • Estimate is for fitting or refitting the model and reviewing model readiness before estimation.
  • Results is for model summaries, APA-style tables, equations, diagnostics, and comparison tools.
  • Report & Code is for reproducible R code, raw LaTeX, and report exports.

The public documentation site includes screenshots of these screens:

https://marcusharrisphd.com/mlmr/

The current supported-models scope is documented in:

mlmr::mlm_supported_models()
#>                      Area                               Status
#> 1          Model families        Supported with scope warnings
#> 2       Nested structures                            Supported
#> 3  Three-level structures                            Supported
#> 4  Crossed random effects                         Experimental
#> 5     Multiple membership                              Planned
#> 6       Repeated measures Supported through grouping structure
#> 7          Random effects                            Supported
#> 8               Centering                            Supported
#> 9            Interactions                            Supported
#> 10 Categorical predictors        Supported through R contrasts
#> 11          Uploaded data                            Supported
#> 12            Diagnostics                            Supported
#> 13      Reporting exports                            Supported
#> 14     Software citations                            Supported
#>                                                                                                                                                                            Scope
#> 1                       Gaussian linear mixed models are the primary production path; binomial, Poisson, negative binomial, and Gamma GLMMs are available as advanced workflows.
#> 2                                                                                                                  Two-level nested models are supported in the app and backend.
#> 3                                                                          Three-level nested models are supported through additional grouping factors and random-effect blocks.
#> 4                                                              Separate lme4 random-effect blocks can be specified; users should verify the design and interpretation carefully.
#> 5                                                                                               Weighted membership models are outside the current lme4-backed production scope.
#> 6                                                    Longitudinal models can be specified when occasions, persons, and higher-level units are represented by grouping variables.
#> 7                                                                        Random intercepts, random slopes, and correlated or independent random-effect structures are supported.
#> 8                                                                           No centering, grand-mean centering, and cluster-mean centering are supported for numeric predictors.
#> 9                                                                                                      Fixed interactions and cross-level interaction-style terms are supported.
#> 10                                                                   Factors and character variables are modeled using R's contrast system; dummy-coding summaries are reported.
#> 11                                                                            CSV, TSV/TXT, Excel, SPSS, SAS, and Stata files are supported when optional readers are installed.
#> 12 Convergence messages, singular-fit checks, gradients, overdispersion for GLMMs, and variance summaries are reported; users should still evaluate design-specific diagnostics.
#> 13                             APA tables, raw LaTeX, equations, Quarto-ready reports, and reproducible R code are supported with explicit Wald-inference and GLMM ICC cautions.
#> 14                                                                           R/package version tables, APA software statements, and optional papaja citation code are supported.
#>                                                                                       User_responsibility
#> 1                                                  Confirm distributional assumptions and link functions.
#> 2                                                Confirm the grouping IDs correctly represent the design.
#> 3                                  Confirm enough units exist at each higher level for stable estimation.
#> 4                                       Confirm the design is truly crossed and not a miscoded hierarchy.
#> 5                           Use specialized methods outside mlmr for weighted multiple-membership models.
#> 6                Confirm time is coded appropriately and that autocorrelation assumptions are acceptable.
#> 7  Inspect convergence, singular fits, and whether the random-effects structure is supported by the data.
#> 8                                                       Match centering choices to the research question.
#> 9                             Interpret lower-order effects conditionally when interactions are included.
#> 10                                           Confirm reference categories and contrasts before reporting.
#> 11                                Check variable types, missing data, and imported labels before fitting.
#> 12                      Treat diagnostics as evidence for revision, not as automatic pass/fail decisions.
#> 13        Review all manuscript text, labels, notation, and inferential method choices before submission.
#> 14                                      Confirm package citations meet the target journal or style guide.

For a longer discussion, see:

vignette("supported-models", package = "mlmr")
  1. Open the app.
  2. Keep the example dataset selected on the Data tab.
  3. Review grouping factors and variable roles.
  4. Move to Model and inspect the preset outcome, predictors, centering, and random-effects choices.
  5. Click Fit Example Model from Data > Overview, or move to Estimate and click Fit Example Model.
  6. Open Results to review the dashboard, APA tables, equations, interpretation, diagnostics, and model comparison panels.
  7. Open Report & Code to export reproducible R code, raw LaTeX, APA tables, or a Quarto-ready report.

What the Example Demonstrates

The built-in example includes a student outcome, student-level predictors, school-level predictors, categorical predictors, interactions, and random effects. It is intentionally more complex than a minimal random-intercept model so users can see why mixed-effects and multilevel models are useful.

The example currently demonstrates:

  • cluster-mean centering for lower-level predictors;
  • grand-mean centering for contextual predictors;
  • dummy coding for categorical predictors;
  • random intercepts and random slopes;
  • fixed interactions and cross-level interaction-style terms;
  • APA-style tables;
  • level-by-level equations and combined equations;
  • Tau variance-covariance matrix display.

Reproducibility

Every model fit in mlmr is paired with reproducible code. The Report & Code tab exports the analysis code and the raw LaTeX used for tables and equations.

The long-term goal is that users can move from the graphical workflow to a scripted R workflow without losing any modeling decisions.

PDF Manual and Help Pages

Like other R packages, mlmr has function help pages that can be viewed with:

?run_mlmr
help(package = "mlmr")

CRAN automatically creates a PDF reference manual from those help pages after a package is accepted. During beta development, the pkgdown website and vignettes are the main user-facing manuals because they explain the workflow in context.

Current Status

mlmr is in public beta. The current version is suitable for structured demo testing, teaching, and feedback. Users should still independently verify model specification, convergence, diagnostics, and interpretation before using fitted results in production research.