simulate.jglmm | R Documentation |
Simulate responses from a model
## S3 method for class 'jglmm' simulate(object, nsim = 1, seed = NULL, newdata = NULL, ...)
object |
An object of class 'jglmm', as returned by 'jglmm'. |
nsim |
(optional) A positive integer indicating the number of responses to simulate |
seed |
Not currently used (see 'simulate' generic). |
newdata |
(optional) A dataframe of new data. |
... |
Optional additional arguments, currently none are used. |
A numeric vector of simulated values
## Not run: jglmm_setup() cbpp <- dplyr::mutate(lme4::cbpp, prop = incidence / size) gm1 <- jglmm(prop ~ period + (1 | herd), data = cbpp, family = "binomial", weights = cbpp$size) simulate(gm1) simulate(gm1, nsim = 5) newdata <- with(cbpp, expand.grid(period=unique(period), herd=unique(herd))) simulate(gm1, newdata = newdata) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.