Navigate to a folder containing sample data.

Load the sample data.

`weight`

contains data from a longitudinal
study, where 20 subjects are randomly assigned to 4 exercise programs,
and their weight loss is recorded over six 2-week time periods. This
is simulated data.

Store the data in a table. Define `Subject`

and `Program`

as
categorical variables.

Fit a linear mixed-effects model where the initial weight,
type of program, week, and the interaction between the week and type
of program are the fixed effects. The intercept and week vary by subject.

Compute the fixed-effects coefficient estimates.

fe =
0.6610
0.0032
0.3608
-0.0333
0.1132
0.1732
0.0388
0.0305
0.0331

The first estimate, 0.6610, corresponds to the constant term.
The second row, 0.0032, and the third row, 0.3608, are estimates for
the coefficient of initial weight and week, respectively. Rows four
to six correspond to the indicator variables for programs B-D, and
the last three rows correspond to the interaction of programs B-D
and week.

Compute the 95% confidence intervals for the fixed-effects
coefficients.

fecI =
0.1480 1.1741
0.0005 0.0059
0.1004 0.6211
-0.2932 0.2267
-0.1471 0.3734
0.0395 0.3069
-0.1503 0.2278
-0.1585 0.2196
-0.1559 0.2221

Some confidence intervals include 0. To obtain specific *p*-values
for each fixed-effects term, use the `fixedEffects`

method.
To test for entire terms use the `anova`

method.

Load the sample data.

Fit a linear mixed-effects model for miles per gallon
(MPG), with fixed effects for acceleration and horsepower, and a potentially
correlated random effect for intercept and acceleration grouped by
model year. First, store the data in a table.

Fit the model.

Compute the fixed-effects coefficient estimates.

fe =
50.1325
-0.5833
-0.1695

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

feCI =
44.2690 55.9961
-0.9300 -0.2365
-0.1883 -0.1507

Compute the 99% confidence intervals for fixed-effects
coefficients using the Satterthwaite approximation to compute the
degrees of freedom.

feCI =
44.0949 56.1701
-0.9640 -0.2025
-0.1884 -0.1507

The Satthertwaite approximation produces similar confidence
intervals to the residual method.

Navigate to a folder containing sample data.

Load the sample data.

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.

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.

Compute the estimate of the BLUPs for random effects.

ans =
0.5775
1.1757
-2.1715
2.3655
-1.9472

Compute the 95% confidence intervals for random effects.

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 =
-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 =
-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.