do_mapbayr_sim {mapbayr} | R Documentation |
Simulate with mapbayr
Description
A wrapper around mrgsolve::mrgsim()
for results generated from mapbayest()
. Exported for the purpose of utility but might be prone to changes.
Usage
do_mapbayr_sim(
x,
data,
recsort = 3,
output = "df",
...,
eta = NULL,
nrep = NULL,
new_omega = NULL,
new_sigma = NULL
)
Arguments
x |
the model object |
data |
NMTRAN-like data set |
recsort |
record sorting flag. Defaulted to 3. See |
output |
type of object returned. Defaulted to |
... |
passed to |
eta |
a matrix of individual point estimates of ETA. Most likely obtained with |
nrep |
number of replicates. If used, the original "ID" in the data will be replaced by unique identifiers. |
new_omega , new_sigma |
New "omega" and "sigma" matrices to use instead of those defined in "$OMEGA" and "$SIGMA". |
Value
An output from mrgsolve::mrgsim()
.
Examples
library(mrgsolve)
mod <- exmodel(1, exdata = FALSE)
dat <- exdata(ID = c(1,2))
# Classic framework
set.seed(123)
do_mapbayr_sim(x = mod, data = dat, Request = "DV")
# No random effect
do_mapbayr_sim(x = zero_re(mod), data = dat)
do_mapbayr_sim(x = mod, data = dat, new_omega = "zero_re")
# New random effects
## New omega matrix
do_mapbayr_sim(x = mod, data = dat, new_omega = dmat(0.1, 0.03, 0.01), nrep = 10)
## Matrix with "eta" as mean and "new_omega" as variance covariance matrix
etamat <- get_eta(est001, output = "num")[1:2,]
do_mapbayr_sim(
x = mod, data = dat, nrep = 10,
eta = etamat, new_omega = dmat(0.1, 0.03, 0.01)
)
[Package mapbayr version 0.10.0 Index]