## use Salamanders data for structure/covariates
sim_count <- simulate_new(~ mined + (1|site),
newdata = Salamanders,
zi = ~ mined,
family = nbinom2,
newparams = list(beta = c(2, 1),
betazi = c(-0.5, 0.5), ## logit-linear model for zi
betadisp = log(2), ## log(NB dispersion)
theta = log(1)) ## log(among-site SD)
)
sim_obj <- simulate_new(~ mined + (1|site),
return_val = "object",
newdata = Salamanders,
zi = ~ mined,
family = nbinom2,
newparams = list(beta = c(2, 1),
betazi = c(-0.5, 0.5), ## logit-linear model for zi
betad = log(2), ## log(NB dispersion)
theta = log(1)) ## log(among-site SD)
)
data("sleepstudy", package = "lme4")
sim_obj <- simulate_new(~ 1 + (1|Subject) + ar1(0 + factor(Days)|Subject),
return_val = "pars",
newdata = sleepstudy,
family = gaussian,
newparams = list(beta = c(280, 1),
betad = log(2), ## log(SD)
theta = log(c(2, 2, 1))),
)
Run the code above in your browser using DataLab