Simulate Method for 'rma' Objects
The function simulates observed outcomes based on "rma"
model object.
## S3 method for class 'rma' simulate(object, nsim = 1, seed = NULL, ...)
object |
an object of class |
nsim |
number of response vectors to simulate (defaults to 1). |
seed |
an object specifying if and how the random number generator should be initialized (‘seeded’). Either |
... |
other arguments. |
A data frame with nsim
columns with the simulated outcomes.
The data frame comes with an attribute "seed"
. If argument seed
is NULL
, the attribute is the value of .Random.seed
before the simulation was started; otherwise it is the value of the argument with a "kind"
attribute with value as.list(RNGkind())
.
Wolfgang Viechtbauer wvb@metafor-project.org http://www.metafor-project.org/
Viechtbauer, W. (2010). Conducting meta-analyses in R with the metafor package. Journal of Statistical Software, 36(3), 1–48. https://www.jstatsoft.org/v036/i03.
### copy BCG vaccine data into 'dat' dat <- dat.bcg ### calculate log risk ratios and corresponding sampling variances dat <- escalc(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat) dat ### random-effects model res <- rma(yi, vi, data=dat) res ### simulate 10 sets of new outcomes based on the fitted model newdat <- simulate(res, nsim=10, seed=1234) newdat
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.