Navigate to a folder containing sample data.

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

Load the sample data.

load shift

The data shows the 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 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 there is significant difference in
the performance according to the time of the shift.

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

Compute the estimate of the BLUPs for random effects.

randomEffects(lme)

ans =
0.5775
1.1757
-2.1715
2.3655
-1.9472

Compute the 95% confidence intervals for random effects.

[~,reCI] = coefCI(lme)

reCI =
-1.3916 2.5467
-0.7934 3.1449
-4.1407 -0.2024
0.3964 4.3347
-3.9164 0.0219

Compute the 99% confidence intervals for random effects
using the residuals method to determine the degrees of freedom. This
is the default method.

[~,reCI] = coefCI(lme,'Alpha',0.01)

reCI =
-2.1831 3.3382
-1.5849 3.9364
-4.9322 0.5891
-0.3951 5.1261
-4.7079 0.8134

Compute the 99% confidence intervals for random effects
using the Satterthwaite approximation to determine the degrees of
freedom.

[~,reCI] = coefCI(lme,'Alpha',0.01,'DFMethod','Satterthwaite')

reCI =
-2.6840 3.8390
-2.0858 4.4372
-5.4330 1.0900
-0.8960 5.6270
-5.2087 1.3142

The Satterthwaite approximation might produce smaller `DF` values
than the residual method. That is why these confidence intervals are
larger than the previous ones computed using the residual method.