Wolfram Language Paclet Repository
Community-contributed installable additions to the Wolfram Language
Native Gaussian, generalized, and nonlinear mixed-effects models for Wolfram Language
Contributed by: Marco Thiel
MMAMixedEffects extends the fitted-model workflow familiar from LinearModelFit and GeneralizedLinearModelFit to clustered, longitudinal, nested, and crossed data. Models use ordinary Wolfram expressions rather than R-style formulas, and fitted objects expose Wolfram-style properties and prediction by function application. No R, Python, cloud account, server, or API is required for fitting.
To install this paclet in your Wolfram Language environment,
evaluate this code:
PacletInstall["MarcoThiel/MMAMixedEffects"]
To load the code after installation, evaluate this code:
Needs["MarcoThiel`MMAMixedEffects`"]
Fit repeated measurements with a patient random intercept using ordinary Wolfram expressions. The synthetic patientData is a smooth deterministic function of time and patient index, so the output is exactly reproducible; the fitted variance components quantify deviation from a linear-in-time model rather than measurement noise:
| In[1]:= | ![]() |
| Out[1]= |
A list of random specifications adds grouping factors; NestedGrouping makes a clinic/patient hierarchy explicit:
| In[2]:= | ![]() |
| Out[2]= |
Crossed subject and item factors use one random specification per grouping variable:
| In[3]:= | ![]() |
| Out[3]= |
Use an explicit response family for events or counts:
| In[4]:= | ![]() |
| Out[4]= |
Or give a symbolic nonlinear mean expression and starting values:
| In[5]:= | ![]() |
| Out[5]= |
Satterthwaite degrees of freedom for the repeated-measures model:
| In[6]:= | ![]() |
| Out[6]= |
Inspect fit["ConvergenceReport"], fit["SingularFit"], fit["Warnings"], the grouping levels, residual structure, and prediction target before interpreting a result.
Wolfram Language Version 13.0