Simulate random numbers from a fitted evm object
# S3 method for evmOpt
simulate(object, nsim = 1, seed = NULL, param = NULL, ...)# S3 method for evmSim
simulate(object, nsim = 1, seed = NULL, ...)
# S3 method for evmBoot
simulate(object, nsim = 1, seed = NULL, ...)
If nsim=1
, a vector or random numbers simulated from the
fitted model object. If nsim > 1
, a matrix with each column being a
set of simulated responses.
A fitted evm object having class 'evmOpt', 'evmSim' or 'evmBoot'.
The number of simulations to perform. Defaults to nsim=1
.
A single simulation involves simulating a new set of responses from the data
that was provided to evm
(after thresholding if thresholding is
performed.)
An integer to be passed to set.seed
. Defaults to
seed=NULL
.
Parameters to use in the random number generator. Defaults to
param=NULL
in which case the parameters from the fitted model are
used. For simulate.evmSim
and simulate.evmBoot
, this argument
is not available and the simulated parameters or replicates are used.
Unused.
Paul Metcalfe, Harry Southworth
For simulate.evmSim
and simulate.evmBoot
, the parameters from
the Markov chains or bootstrap replicates are randomly permuted prior to
each set of simulated responses being computed. In this way, reusing the
same set of values is avoided.
evm
mod <- evm(rain, qu=.95)
hist(simulate(mod, 100))
Run the code above in your browser using DataLab