# random

Generate random responses from fitted linear mixed-effects model

## Syntax

## Description

returns
a vector of simulated responses `ysim`

= random(`lme`

)`ysim`

from the
fitted linear mixed-effects model `lme`

at the
original fixed- and random-effects design points, used to fit `lme`

.

`random`

simulates new random-effects vector
and new observation errors. So, the simulated response is

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

where $$\widehat{\beta}$$ is the estimated fixed-effects
coefficients, $$\widehat{b}$$ is the new random
effects, and *ε* is the new observation error.

`random`

also accounts for the effect of observation
weights, if you use any when fitting the model.

returns
a vector of simulated responses `ysim`

= random(`lme`

,`Xnew`

,`Znew`

)`ysim`

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. Use the matrix format for `random`

if you
use design matrices for fitting the model `lme`

.

returns
a vector of simulated responses `ysim`

= random(`lme`

,`Xnew`

,`Znew`

,`Gnew`

)`ysim`

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.

## Examples

## Input Arguments

## Output Arguments

## Version History

**Introduced in R2013b**