returns
a vector of conditional predicted
responses `ypred`

= predict(`lme`

)`ypred`

at the original predictors
used to fit the linear mixed-effects model `lme`

.

returns
a vector of conditional predicted responses `ypred`

= predict(`lme`

,`tblnew`

)`ypred`

from
the fitted linear mixed-effects model `lme`

at the
values in the new table or dataset array `tblnew`

.
Use a table or dataset array for `predict`

if you
use a table or dataset array for fitting the model `lme`

.

If a particular grouping variable in `tblnew`

has
levels that are not in the original data, then the random effects
for that grouping variable do not contribute to the `'Conditional'`

prediction
at observations where the grouping variable has new levels.

returns
a vector of conditional predicted responses `ypred`

= predict(`lme`

,`Xnew`

,`Znew`

)`ypred`

from
the fitted linear mixed-effects model `lme`

at the
values in the new fixed- and random-effects design matrices, `Xnew`

and `Znew`

,
respectively. `Znew`

can also be a cell array of
matrices. In this case, the grouping variable `G`

is `ones(n,1)`

,
where *n* is the number of observations used in the
fit.

Use the matrix format for `predict`

if using
design matrices for fitting the model `lme`

.

returns
a vector of conditional predicted responses `ypred`

= predict(`lme`

,`Xnew`

,`Znew`

,`Gnew`

)`ypred`

from
the fitted linear mixed-effects model `lme`

at the
values in the new fixed- and random-effects design matrices, `Xnew`

and `Znew`

,
respectively, and the grouping variable `Gnew`

.

`Znew`

and `Gnew`

can also
be cell arrays of matrices and grouping variables, respectively.

returns
a vector of predicted responses `ypred`

= predict(___,`Name,Value`

)`ypred`

from the
fitted linear mixed-effects model `lme`

with additional
options specified by one or more `Name,Value`

pair
arguments.

For example, you can specify the confidence level, simultaneous confidence bounds, or contributions from only fixed effects.

A conditional prediction includes contributions from both fixed and random effects, whereas a marginal model includes contribution from only fixed effects.

Suppose the linear mixed-effects model `lme`

has
an *n*-by-*p* fixed-effects design
matrix `X`

and an *n*-by-*q* random-effects
design matrix `Z`

. Also, suppose the estimated *p*-by-1
fixed-effects vector is $$\widehat{\beta}$$,
and the *q*-by-1 estimated best linear unbiased predictor
(BLUP) vector of random effects is $$\widehat{b}$$.
The predicted conditional response is

$${\widehat{y}}_{Cond}=X\widehat{\beta}+Z\widehat{b},$$

which corresponds to the `'Conditional','true'`

name-value
pair argument.

The predicted marginal response is

$${\widehat{y}}_{Mar}=X\widehat{\beta},$$

which corresponds to the `'Conditional','false'`

name-value
pair argument.

When making predictions, if a particular grouping variable has
new levels (1s that were not in the original data), then the random
effects for the grouping variable do not contribute to the `'Conditional'`

prediction
at observations where the grouping variable has new levels.

Was this topic helpful?