Documentation |
ypred = predict(lme) returns a vector of conditional predicted responses ypred at the original predictors used to fit the linear mixed-effects model lme.
ypred = predict(lme,tblnew) returns a vector of conditional predicted responses 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.
ypred = predict(lme,Xnew,Znew) returns a vector of conditional predicted responses 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.
ypred = predict(lme,Xnew,Znew,Gnew) returns a vector of conditional predicted responses 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.
ypred = predict(___,Name,Value) returns a vector of predicted responses 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' and 'Prediction','curve' name-value pair arguments. The predicted conditional response that also includes observation error is
$${\widehat{y}}_{Cond}=X\widehat{\beta}+Z\widehat{b}+\epsilon ,$$
which corresponds to the 'Conditional','true' and 'Prediction','observation' name-value pair arguments.
The predicted marginal response is
$${\widehat{y}}_{Mar}=X\widehat{\beta}.$$
This corresponds to the 'Conditional','false' and 'Prediction','curve' name-value pair arguments. The marginal conditional response that also includes observation error is
$${\widehat{y}}_{Mar}=X\widehat{\beta}+\epsilon ,$$
which corresponds to the 'Conditional','false' and 'Prediction','observation' name-value pair arguments.
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.