A matrix of simulated values for the response (or an array, for nsim greater than 1)
Arguments
object
a mlm object, typically the result of calling lm
where the response is a matrix.
nsim
number of replicate datasets to simulate. If nsim is greater than 1,
the output is arranged in a 3D array.
seed
an object specifying if and how the random number generator should be
initialized (‘seeded’). Either NULL or an integer that will be used in a call to set.seed
before simulating the response vectors. If set, the value is saved as the "seed" attribute
of the returned value. The default, NULL will not change the random generator state, and
return .Random.seed as the "seed" attribute, see ‘Value’
...
additional optional arguments.
Author
David Warton <david.warton@unsw.edu.au>
Details
A simulate function for mlm objects, which simulates one or more
sets of responses from a Multivariate Linear Model (mlm) object.
If multiple sets of responses are requested, they are returned in a 3D array,
with simulation number along the third dimension.
The weights argument is currently ignored -- a constant
variance-covariance matrix assumed for mlm.
# fit a mlm to iris data:data(iris)
iris.mlm=lm(cbind(Sepal.Length,Sepal.Width,Petal.Length,Petal.Width)~Species,data=iris)
# simulate new responses:simulate(iris.mlm)