Accelerating the pace of engineering and science

# Documentation Center

• Trials
• Product Updates

# disp

Class: LinearMixedModel

Display linear mixed-effects model

## Description

example

display(lme) displays the fitted linear mixed-effects model lme.

## Input Arguments

expand all

### lme — Linear mixed-effects modelLinearMixedModel object

Linear mixed-effects model, returned as a LinearMixedModel object.

For properties and methods of this object, see LinearMixedModel.

## Examples

expand all

### Randomized Block Design

Navigate to a folder containing sample data.

```cd(matlabroot)
cd('help/toolbox/stats/examples')```

Load the sample data.

`load shift`

The dataset array shows the absolute deviations from the target quality characteristic measured from the products that five operators manufacture during three shifts, morning, evening, and night. This is a randomized block design, where the operators are the blocks. The experiment is designed to study the impact of the time of shift on the performance. The performance measure is the absolute deviation of the quality characteristics from the target value. This is simulated data.

Shift and Operator are nominal variables.

```shift.Shift = nominal(shift.Shift);
shift.Operator = nominal(shift.Operator);
```

Fit a linear mixed-effects model with a random intercept grouped by operator to assess if performance significantly differs according to the time of the shift.

`lme = fitlme(shift,'QCDev ~ Shift + (1|Operator)');`

Display the model.

`disp(lme)`
```Linear mixed-effects model fit by ML

Model information:
Number of observations              15
Fixed effects coefficients           3
Random effects coefficients          5
Covariance parameters                2

Formula:
QCDev ~ 1 + Shift + (1 | Operator)

Model fit statistics:
AIC       BIC       LogLikelihood    Deviance
59.012    62.552    -24.506          49.012

Fixed effects coefficients (95% CIs):
Name                   Estimate    SE         tStat       DF    pValue       Lower      Upper
'(Intercept)'           3.1196     0.88681      3.5178    12    0.0042407     1.1874     5.0518
'Shift_Morning'        -0.3868     0.48344    -0.80009    12      0.43921    -1.4401    0.66653
'Shift_Night'           1.9856     0.48344      4.1072    12    0.0014535    0.93227     3.0389

Random effects covariance parameters (95% CIs):
Group: Operator (5 Levels)
Name1                Name2                Type         Estimate    Lower      Upper
'(Intercept)'        '(Intercept)'        'std'        1.8297      0.94915    3.5272

Group: Error
Name             Estimate    Lower      Upper
'Res Std'        0.76439     0.49315    1.1848```

This display includes the model performance statistics, Akaike information criterion (AIC), Bayesian information criterion (BIC), loglikelihood, and deviance.

The fixed-effects coefficients table includes the names and estimates of the coefficients in the first two columns. The third column SE shows the standard errors of the coefficients. The column tStat includes the t-statistic values that correspond to each coefficient. DF is the residual degrees of freedom, and the pValue is the p-value that corresponds to the corresponding t-statistic value. The columns Lower and Upper display the lower and upper limits of a 95% confidence interval for each fixed-effects coefficient.

The first table for the random effects shows the types and the estimates of the random effects covariance parameters, with the lower and upper limits of a 95% confidence interval for each parameter. The display also shows the name of the grouping variable, operator, and the total number of levels, 5.

The second table for the random effects shows the estimate of the observation error, with the lower and upper limits of a 95% confidence interval.

## Definitions

### Akaike and Bayesian Information Criteria

Akaike information criterion (AIC) is AIC = –2*logLM + 2*(nc + p + 1), where logLM is the maximized log likelihood (or maximized restricted log likelihood) of the model, and nc + p + 1 is the number of parameters estimated in the model. p is the number of fixed-effects coefficients, and nc is the total number of parameters in the random-effects covariance excluding the residual variance.

Bayesian information criterion (BIC) is BIC = –2*logLM + ln(neff)*(nc + p + 1), where logLM is the maximized log likelihood (or maximized restricted log likelihood) of the model, neff is the effective number of observations, and (nc + p + 1) is the number of parameters estimated in the model.

• If the fitting method is maximum likelihood (ML), then neff = n, where n is the number of observations.

• If the fitting method is restricted maximum likelihood (REML), then neff = np.

A lower value of deviance indicates a better fit. As the value of deviance decreases, both AIC and BIC tend to decrease. Both AIC and BIC also include penalty terms based on the number of parameters estimated, p. So, when the number of parameters increase, the values of AIC and BIC tend to increase as well. When comparing different models, the model with the lowest AIC or BIC value is considered as the best fitting model.

### Deviance

LinearMixedModel computes the deviance of model M as minus two times the loglikelihood of that model. Let LM denote the maximum value of the likelihood function for model M. Then, the deviance of model M is

A lower value of deviance indicates a better fit. Suppose M1 and M2 are two different models, where M1 is nested in M2. Then, the fit of the models can be assessed by comparing the deviances Dev1 and Dev2 of these models. The difference of the deviances is

Usually, the asymptotic distribution of this difference has a chi-square distribution with degrees of freedom v equal to the number of parameters that are estimated in one model but fixed (typically at 0) in the other. That is, it is equal to the difference in the number of parameters estimated in M1 and M2. You can get the p-value for this test using 1 – chi2cdf(Dev,V), where Dev = Dev2Dev1.

However, in mixed-effects models, when some variance components fall on the boundary of the parameter space, the asymptotic distribution of this difference is more complicated. For example, consider the hypotheses

H0: D is a q-by-q symmetric positive semidefinite matrix.

H1: D is a (q+1)-by-(q+1) symmetric positive semidefinite matrix.

That is, H1 states that the last row and column of D are different from zero. Here, the bigger model M2 has q + 1 parameters and the smaller model M1 has q parameters. And Dev has a 50:50 mixture of χ2q and χ2(q + 1) distributions (Stram and Lee, 1994).

## References

[1] Hox, J. Multilevel Analysis, Techniques and Applications. Lawrence Erlbaum Associates, Inc., 2002.

[2] Stram D. O. and J. W. Lee. "Variance components testing in the longitudinal mixed-effects model". Biometrics, Vol. 50, 4, 1994, pp. 1171–1177.

## See Also

Was this topic helpful?