simulate.asreml {asreml3Plus} | R Documentation |
Produce a set of simulated data corresponding to an asreml
model,
along with its fitted values and residuals. A variance matrix V
,
corresponding to the random
and rcov
models must be
supplied. What to save is specified by the which
argument.
## S3 method for class 'asreml' simulate(object, nsim=100, seed = NULL, means=NULL, V, tolerance = 1E-10, update = TRUE, trace = FALSE, which="data", units = "ignore", ...)
object |
An |
means |
The |
V |
The fitted variance |
nsim |
The number of data sets to be simulated. |
seed |
A single value, interpreted as an integer, that specifies the starting value of the random number generator. |
tolerance |
The value such that eigenvalues less than it are consdered to be zero. |
update |
if |
trace |
if |
which |
The quantites from the simulated data set to be stored. Any combination of
|
units |
A |
... |
Other arguments that are passed down to the function asreml. Changes to the models are not allowed. Other changes are dangerous and generally should be avoided. |
Generate nsim
set of data and analyse them using asreml
using the model in object
. Note, if the analysis for a data set does
not converge in maxiter
iterations, it is discarded and
a replacement data set generated. The value of maxiter
can be specified
in the call to simulate.asreml
. The fitted values and residuals are extracted
as required. If aom = TRUE
when the simulated data are analysed, standardised
conditional residuals are stored. If which
includes residuals
or
fitted
, the specified quantities for the observed data are added to the
data.frame
on which the fit in object
is based.
A list
with the following components whose presence depends on the setting of
which
:
observed: present if which
includes residuals
or fitted
,
in which case it will be the data.frame
on which the fit in
object
is based, with residuals
and/or fitted
.
data: present if which
includes data
, a data.frame
containing the simulated data sets.
fitted: present if which
includes fitted
, a data.frame
containing the fitted values from the analyses of the simulated data sets.
residuals: present if which
includes residuals
, a data.frame
containing the residuals from the analyses of the simulated data sets.
Chris Brien
asreml
, variofaces.asreml
, plotvariofaces.asreml
.
## Not run: data(Wheat.dat) current.asr <- asreml(yield ~ Rep + WithinColPairs + Variety, random = ~ Row + Column + units, rcov = ~ ar1(Row):ar1(Column), data=Wheat.dat) current.asrt <- asrtests(current.asr, NULL, NULL) current.asrt <- rmboundary.asrtests(current.asrt) # Form variance matrix based on estimated variance parameters s2 <- current.asr$sigma2 gamma.Row <- current.asr$gammas[1] gamma.unit <- current.asr$gammas[2] rho.r <- current.asr$gammas[4] rho.c <- current.asr$gammas[5] row.ar1 <- mat.ar1(order=10, rho=rho.r) col.ar1 <- mat.ar1(order=15, rho=rho.c) V <- gamma.Row * fac.sumop(Wheat.dat$Row) + gamma.unit * diag(1, nrow=150, ncol=150) + mat.dirprod(col.ar1, row.ar1) V <- s2*V #Produce residuals from 100 simulated data sets resid <- simulate(current.asr, V=V, which="residuals") ## End(Not run)