simulate.jglmm: Simulate responses from a model

View source: R/predict.R

simulate.jglmmR Documentation

Simulate responses from a model

Description

Simulate responses from a model

Usage

## S3 method for class 'jglmm'
simulate(object, nsim = 1, seed = NULL, newdata = NULL, ...)

Arguments

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.

Value

A numeric vector of simulated values

Examples

## 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)

mikabr/jglmm documentation built on Nov. 18, 2022, 1:32 a.m.