Example of Fit Mixed Effects Model

A researcher tests the yields of six varieties of alfalfa on four randomly selected fields. The yield for each variety was recorded for each field.

The researcher wants to know whether the variety of alfalfa affects the mean yield. The researcher has 4 fields where they can collect data. However, the researcher wants to be able to model how the alfalfas will grow in fields that are not in the experiment. Thus, the researcher makes the field where the alfalfa grows a random factor. The researcher uses a mixed effects model to evaluate fixed and random effects together.

  1. Open the sample data Alfalfa.MTW.
  2. Choose Stat > ANOVA > Mixed Effects Model > Fit Mixed Effects Model.
  3. In Responses, enter Yield.
  4. In Random factors (required), enter Field.
  5. In Fixed factors, enter Variety.
  6. Click Graphs.
  7. In Residuals for plots, select Conditional standardized.
  8. In Residuals plots, select Four in one.
  9. Click OK in each dialog.

Interpret the results

In the Variance Components table, the p-value for Field is 0.124. The hypothesis test does not show evidence that the variance component is different from 0. The p-value for the variance component for error is 0.003. Because the p-value is less than the significance level of 0.05, the researcher can conclude that the variance component for error is not 0.

The p-value of approximately 0 for the fixed factor term, Variety, shows that at least one type of alfalfa effect on yield is significantly different from the other five types.

The coefficients for the main effects represent the difference between each level mean and the overall mean. For example, Variety 1 is associated with an alfalfa yield that is approximately 0.385 units greater than the overall mean. The p-value of approximately 0 for this coefficient indicates that the effect of Variety 1 on yield is significantly different from another level effect of the Variety term. To determine which level effects are statistically the same, and which level effects are statistically different, the researcher plans to do a multiple comparison analysis for the term.

The R2 value shows that the model explains about 92% of the variation in the yield. The R-sq (adj) value is also high, with a value of approximately 90.2%. The researcher uses this value to compare models that have different numbers of predictors.

Observation 1 and 5 are unusual observations because they have standardized residuals greater than 2. The researcher examines the data to make sure that the response values for those observations are correct.

The residuals on the normal probability plot approximate a straight line, and the points appear to be randomly scattered about 0 on the residuals versus fits plot.


Variance estimationRestricted maximum likelihood
DF for fixed effectsKenward-Roger

Factor Information

FieldRandom41, 2, 3, 4
VarietyFixed61, 2, 3, 4, 5, 6

Variance Components

SourceVar% of TotalSE VarZ-ValueP-Value
-2 Log likelihood = 7.736012

Tests of Fixed Effects

TermDF NumDF DenF-ValueP-Value

Model Summary



TermCoefSE CoefDFT-ValueP-Value

Marginal Fits and Diagnostics for Unusual Observations

ObsYieldFitResidStd Resid
R  Large residual

Conditional Fits and Diagnostics for Unusual Observations

ObsYieldFitResidStd Resid
R  Large residual