The GLMM Tab

The GLMM tab fits random intercept models g(μi)=xi′β+uj[i]g(\mu_i) = x_i'\beta + u_{j[i]}, uj∼N(0,σu2)u_j \sim N(0, \sigma_u^2) for data with group structure.

For example, with student test scores collected from multiple schools, you can estimate fixed effects xi′βx_i'\beta such as study hours while accounting for school-level differences through the random intercept uj[i]u_{j[i]}.

This model extends GLM by adding random effects, and is also known as a multilevel model. When test scores are correlated within schools and study hours vary across schools, ignoring the school differences with GLM leads to an underestimated standard error for the study-hours coefficient and a confidence interval that is narrower than it should be.

See GLMM Fundamentals for the mathematical background.

Basic Usage

Opening GLMM

Select Analysis > Mixed Effects Model (GLMM)... from the menu bar.

Setting Up the Analysis

GLMM form configuration

Dataset selects the dataset to analyze. GLMM expects one row per observation, with a column identifying the group. If repeated measurements are spread across columns, convert them with Wide to Long in the Reshape tab.

Response Variable (Y) selects the response variable. Only numeric columns (interval/ratio scale) are available. For the Binomial family, use a column with 0/1 values. GLMM treats each row as a single trial, so it aborts the fit with an error if the column contains any value other than 0 or 1. A boolean column is inferred as nominal scale by default and cannot be selected; change its scale to interval in the Data Table to make it selectable, and its values are treated as true=1, false=0.

Fixed Effects (X) selects predictor variables for fixed effects; select at least one. Only numeric columns are selectable. To use categorical variables, convert them with Dummy Coding first. As with the response variable, boolean columns become selectable when their scale is changed to interval, with true=1 and false=0. The conversion creates a new derived dataset, so switch Dataset to that dataset afterwards.

Group Variable (Random Intercept) selects the grouping variable for random intercepts. Categorical (nominal/ordinal) or string columns are available. Columns that record groups as numbers, such as line numbers or school IDs, are inferred as interval scale and do not appear as candidates; change their scale to nominal in the Data Table to make them selectable.

Distribution Family selects the distribution family:

FamilyDefault LinkAvailable LinksUse Case
Gaussian (Normal)IdentityIdentity, LogContinuous values
Binomial (Logistic)LogitLogit, ProbitBinary data
Poisson (Count)LogLog, IdentityCount data
GammaInverseInverse, Log, IdentityPositive continuous

Link Function selects the link function. Defaults to the canonical link for the selected family.

Link FunctionFormulaDescription
Identityη=μ\eta = \muNo transformation. Canonical link for Gaussian
Logitη=log⁡ ⁣(μ/(1−μ))\eta = \log\!\bigl(\mu / (1 - \mu)\bigr)Log-odds transformation. Canonical link for Binomial
Logη=log⁡(μ)\eta = \log(\mu)Log transformation. Canonical link for Poisson. Ensures μ>0\mu > 0
Inverseη=1/μ\eta = 1/\muReciprocal transformation. Canonical link for Gamma
Probitη=Φ−1(μ)\eta = \Phi^{-1}(\mu)Inverse CDF of the standard normal distribution. Corresponds to a latent normal variable model

See GLM Fundamentals: Choosing a Link Function for the mathematical properties of canonical links.

Include intercept toggles the intercept term (default: on).

Confidence Level sets the confidence level for confidence intervals (default: 95%, range: 50--99.99%). This is reflected in the Lower N% / Upper N% columns of the Fixed Effects table. The Model Detail tab opened after saving has the same input pre-filled with the saved value, and you can change it there to recompute the CI without modifying the saved value.

Max Iterations sets the maximum number of optimization iterations (default: 100).

Convergence Tolerance sets the convergence threshold (default: 1e-6).

Running the Analysis

Click Run GLMM. The estimation algorithm differs by family (see details). While the analysis runs, a progress bar and the estimation stage appear below the form.

Changing the variable selection or the model settings after a run makes the displayed results no longer belong to the current settings. MIDAS removes those results from the view and shows a message asking you to run the analysis again. Restoring the previous settings brings the results back. Changing Dataset also resets the variable selection, so the results are discarded instead. Changing Confidence Level keeps the results, because that setting only recomputes the intervals from the estimated coefficients.

Understanding Results

GLMM analysis results (Random Effects, ICC, Fixed Effects, Model Fit)

The display format of each numeric column in the Random Effects, Fixed Effects, and BLUP tables can be changed per column. Right-clicking a column header opens presets such as fixed decimals and significant digits. The chosen format is stored in the tab and persists when the model is rerun.

Random Effects

Displays variance components for random effects.

ColumnDescription
ComponentName of the variance component. Group (variable name) for the group variable variance, Residual for the Gaussian residual variance, Dispersion (φ) for the Gamma dispersion parameter
VarianceEstimate: σu2\sigma_u^2 for the group variable, σe2\sigma_e^2 for Residual, ϕ\phi for Dispersion (φ)
Std.Dev.Square root of Variance. The Dispersion (φ) row shows "-", which marks a value that cannot be computed, because its square root is not a standard deviation

For Poisson and Binomial families, neither the Residual row nor the Dispersion (φ) row is shown because the dispersion parameter is fixed at ϕ=1\phi = 1.

How the variance components are estimated depends on the combination of family and link. For Gaussian + identity, the variance components are REML estimates. For all other combinations, every displayed variance component is a maximum-likelihood estimate that maximizes the Laplace-approximated marginal likelihood. The value of the Residual row or the Dispersion (φ) row is then the estimate of the family's dispersion parameter ϕ\phi. Maximum-likelihood estimates understate the variance components when there are few groups (see the REML section). See GLMM Fundamentals for the details of the estimation.

What the dispersion parameter ϕ\phi represents is determined by the distribution family, not by the link function, because the relation between ϕ\phi and the conditional variance of the response is a property of the distribution family. For Gaussian, Var⁡(Y∣μ)=ϕ\operatorname{Var}(Y \mid \mu) = \phi, so ϕ\phi is the residual variance σe2\sigma_e^2 itself. For Gamma, Var⁡(Y∣μ)=ϕμ2\operatorname{Var}(Y \mid \mu) = \phi \mu^2, so ϕ\phi is not a variance and its square root is not a standard deviation. The link function affects the estimate of ϕ\phi and the diagnostic residuals (deviance and Pearson) through the fitted values μ^=g−1(η)\hat\mu = g^{-1}(\eta) computed from the linear predictor (see Saving and Diagnostics).

ICC (Intraclass Correlation Coefficient)

ICC represents the share of unexplained variance attributable to between-group differences (ICC=σu2/(σu2+σe2)\text{ICC} = \sigma_u^2 / (\sigma_u^2 + \sigma_e^2)). MIDAS computes ICC only for the following family+link combinations, where σe2\sigma_e^2 has a theoretical basis:

FamilyLinkσe2\sigma_e^2
GaussianidentityREML estimate
Binomiallogitπ2/3\pi^2/3 (threshold model)
Binomialprobit11 (threshold model)

For all other combinations — Poisson (all links), Gamma (all links), and Gaussian with the log link — no theoretically grounded residual variance exists, so N/A (ICC not defined) is shown instead of an ICC value (see GLMM Fundamentals for details). For these combinations, the magnitude of between-group variation can still be assessed from the Variance in the Random Effects table (σu2\sigma_u^2 on the link scale) and from BLUP.

The interpretation of ICC depends on the nature of the data and the research objective, and group size should also be considered (see When to Use GLMM vs GLM).

For Binomial models, ICC is computed on the latent (link) scale, not the probability scale. It does not equal the correlation of the observed binary responses.

Fixed Effects

Coefficient table for fixed effects.

ColumnDescription
VariableVariable name
EstimateRegression coefficient β^\hat\beta
Std. ErrorStandard error. For Gaussian + identity, the Kenward-Roger method corrects the understatement caused by plugging in estimated variance components. For all other combinations, an approximation based on the working weight matrix at the estimates
dfPer-coefficient degrees of freedom of the t-distribution used for the confidence interval. Shown only for Gaussian + identity when the Kenward-Roger correction was computed. Coefficients for which it cannot be computed show -
Lower N% / Upper N%Wald-based confidence interval bounds, where N is the selected confidence level

When the link function is logit or log, the following columns are added:

ColumnDescription
OR / IRR / exp(Est.)Exponentiated estimate exp⁡(β^)\exp(\hat\beta). Displayed as odds ratio (OR) for logit link, incidence rate ratio (IRR) for log link with Poisson, and exp(Est.) for log link with other families
exp(Lower N%) / exp(Upper N%)Exponentiated confidence interval bounds

Coefficients are interpreted on the link function scale, as in GLM. See GLM coefficient interpretation for details.

The reference distribution of the confidence intervals depends on the family and link combination. For Gaussian + identity, MIDAS uses a t-distribution with per-coefficient degrees of freedom from the Kenward-Roger method, so the interval width reflects the uncertainty from estimating the variance components. Coefficients with small degrees of freedom are estimated from little information, and their intervals are wider accordingly. All other combinations use the standard normal distribution, whose intervals can be too narrow when the number of groups is small. See GLMM Fundamentals: Fixed Effect Inference for details.

The fixed effects coefficients table can be saved as a dataset using the Save as Dataset button for export to CSV. Using Add to Report also adds the BLUP table at the same time. Both require a saved model; if the model is not yet saved, the dialog asks for a model name and saves the model as part of the same action.

Model Fit

MetricDescription
REML Log-Likelihood / Log-Likelihood (Laplace)Log-likelihood. REML for Gaussian + identity; the Laplace-approximated marginal log-likelihood for all other combinations
AIC−2ℓ+2k-2\ell + 2k, where kk is the total number of fixed-effect parameters and variance components
BIC−2ℓ+klog⁡n-2\ell + k\log n, where nn is the number of observations

Model comparison based on AIC and BIC has limitations (see GLMM Fundamentals: AIC/BIC Limitations). REML-based AIC (Gaussian + identity) can only compare models with identical fixed-effect structure. Models with different families or links cannot be compared by AIC, BIC, or log-likelihood, because the log-likelihood basis (REML vs. Laplace) and scale differ.

BLUP (Random Effect Predictions)

BLUP table showing random effect predictions by group

Displays the BLUP (Best Linear Unbiased Predictor) of the random intercept for each group.

ColumnDescription
GroupGroup variable value
Conditional ModePredicted value of the random effect uju_j. Smaller groups are shrunk more toward the overall mean (0) (shrinkage details)
Std. ErrorStandard error of the prediction. The square root of the conditional variance; larger for smaller groups
RankRank of Conditional Mode in descending order

The defining property of the BLUP — the smallest mean squared prediction error among linear unbiased predictors — holds only for Gaussian + identity. For all other combinations, the predicted value is the mode (the point of highest density) of the distribution of uju_j conditional on the observed data — the conditional mode — which is the quantity shown in the Conditional Mode column (see GLMM Fundamentals: Estimation and Prediction).

For combinations other than Gaussian + identity, the Std. Error is based on a normal approximation around the conditional mode, so an interval of the form (conditional mode) ± z × SE is not guaranteed to be an accurate prediction interval.

The BLUP table can be saved as a dataset using the Save as Dataset button for export to CSV. Saving the BLUP dataset requires a saved model; if the model is not yet saved, the dialog also asks for a model name and saves the model together with the dataset. To add it to a report, use the Add to Report button in the Fixed Effects section.

Saving and Diagnostics

Enter a model name in Model Name and click Save Model to save the model to the project. A diagnostic derived dataset is automatically created on save.

ColumnDescription
fitted_valuesPredicted values (fixed + random effects)
deviance_residualsDeviance residuals
pearson_residualsPearson residuals
group_random_effectGroup random intercept (BLUP)

For Gaussian + identity, the deviance and Pearson residuals both equal the raw residual yi−y^iy_i - \hat y_i, so deviance_residuals and pearson_residuals hold the same values.

After saving, View Model Details and View Diagnostics buttons become available. Model Detail displays the fixed effects coefficient table and a BLUP table (per-group random intercept estimates). The BLUP table shows up to 50 rows by default; when there are more groups, click Show all N rows (N is the total number of groups) to expand the full list. Use the Add to Report button to add both the coefficients table and the BLUP table to a report. When the fit raised warnings, Model Detail and the report both show the same warnings.

Notes

Current Limitations

The current GLMM implementation supports random intercept models only. Random slopes (models where a predictor's effect varies by group) and crossed random effects (models where observations belong to multiple group variables) are not supported (see GLMM Fundamentals).

The GLM tab offers the Negative Binomial family, but GLMM does not.

The Binomial family in GLMM does not support the successes-and-trials format that the GLM tab offers as Grouped (n trials). Data aggregated into successes and trials can be fitted after expanding it into 0/1 data with one row per trial. Each expanded row keeps the predictors and the group of the original row. The likelihood of the expanded data differs from the binomial likelihood of the successes and trials only by a constant factor, the binomial coefficient, so the expansion leaves the estimates of the coefficients and the variance component unchanged. The Log-Likelihood and AIC, however, differ from the values computed from the binomial likelihood by the sum of the logarithms of the binomial coefficients, and the BIC differs further because its number of observations becomes the total number of trials. Proportions whose numbers of trials are unknown cannot be expanded.

When to Use GLMM vs GLM

When ICC is small, ignoring group structure and using GLM produces nearly identical results. The impact depends not only on ICC but also on group size; the design effect DEFF=1+(nˉ−1)×ICC\text{DEFF} = 1 + (\bar n - 1) \times \text{ICC} provides a rough guide (see GLMM Fundamentals).

When ICC is large, GLM violates the independence assumption between observations and distorts the standard errors of the coefficients. The size of the distortion depends on the predictor: the more a predictor's variation lies between groups (such as a school-level tuition fee, which takes the same value within each group), the more strongly its standard error is underestimated, while predictors that vary mainly within groups are less affected. GLMM avoids this problem by explicitly modeling within-group correlation.

When you want to compare a small number of specific groups and estimate their effects directly, another option is to convert the groups to dummy variables with Dummy Coding and treat them as fixed effects in GLM (see GLMM Fundamentals).

Automatic Exclusion of Missing Values

Rows containing missing values, non-numeric values, or infinity are automatically excluded. The Observations value in the results is the number of observations after exclusion. This is listwise deletion. See Missing Data Mechanisms for conditions under which it yields valid estimates.

Convergence Issues

If the model fails to converge, try the following:

  • Increase Max Iterations (for example, from 100 to 500)
  • Relax Convergence Tolerance (for example, from 1e-6 to 1e-4)
  • Standardize predictors whose scales differ greatly

Predictors are scaled internally, but extreme scale differences can make the GLM estimation that provides the initial values fail. Convergence problems are also more likely with very few groups (2 or 3), where variance component estimation becomes unstable.

Max Iterations limits only the golden-section iterations of the search over θ\theta. The evaluations at points over the search range are fixed in number and do not count toward this limit. The iterations that compute the fixed effects and random effects for each candidate θ\theta have their own limits. For each candidate value of the relative covariance parameter θ\theta (see GLMM Fundamentals), MIDAS finds a starting point for the fixed effects and random effects with PIRLS (Penalized IRLS) iterations. Further iterations then optimize the fixed effects from there.

With the Inverse link for Gamma, the fit aborts with an error when the linear predictor cannot be kept positive. The Inverse link sets the mean to the reciprocal of the linear predictor, so a linear predictor of zero or below gives no positive mean. The Log link has no such restriction, because it gives a positive mean for any value of the linear predictor. The Log link, however, models the mean on a different scale from the Inverse link, so the coefficients also take a different meaning.

Singular Fit

Singular fit occurs when the group variable explains very little variation in the response, or when the sample size or number of groups is too small to separate group-level variation from residual variation. It also occurs when the search over θ\theta stops at a local maximum on the boundary θ=0\theta = 0 and misses a maximum with a higher likelihood away from the boundary. GLMM Fundamentals explains when the search misses a maximum.

When singular fit occurs, ICC and variance component estimates should be interpreted with caution. A fixed-effects-only model (GLM) may be more appropriate.

See also

  • GLM - Generalized linear models without random effects
  • GLMM Fundamentals - Mathematical background of random effect models