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.

Method

Variance estimationRestricted maximum likelihood
DF for fixed effectsKenward-Roger

Factor Information

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

Variance Components

SourceVar% of TotalSE VarZ-ValueP-Value
Field0.07791972.93%0.0675801.1529960.124
Error0.02892427.07%0.0105622.7386130.003
Total0.106843       
-2 Log likelihood = 7.736012

Tests of Fixed Effects

TermDF NumDF DenF-ValueP-Value
Variety5.0015.0026.290.000

Model Summary

SR-sqR-sq(adj)AICcBIC
0.17007192.33%90.20%12.5413.52

Coefficients

TermCoefSE CoefDFT-ValueP-Value
Constant3.0945830.1438223.0021.5166920.000
Variety         
  10.3854170.07762615.004.9650160.000
  20.1454170.07762615.001.8732870.081
  30.1079170.07762615.001.3902050.185
  4-0.3195830.07762615.00-4.1169380.001
  50.3954170.07762615.005.0938380.000

Marginal Fits and Diagnostics for Unusual Observations

ObsYieldFitResidStd Resid
14.1000003.4800000.6200002.190221R
54.2200003.4900000.7300002.578808R
R  Large residual

Conditional Fits and Diagnostics for Unusual Observations

ObsYieldFitResidStd Resid
54.2200003.8953390.3246612.400733R
R  Large residual