sim: Simulate posterior observations

simR Documentation

Simulate posterior observations

Description

Simulates posterior observations for map and map2stan model fits.

Usage

sim( fit , data , n=1000 , post , ll , refresh=0.1 , replace , ... )

Arguments

fit

Object of class map or map2stan

data

Optional list of data to compute predictions over

n

Number of samples to use

post

Samples from posterior. If missing, sim samples using n

...

Other parameters to pass to someone

Details

This function uses the model definition from a map or map2stan fit to simulate outcomes that average over the posterior distribution. It uses link internally to process any linear models. Then the correspond random number function is used, as defined by the model's likelihood.

The rethinking package defines a generic function sim, so methods can be defined for other model fit classes. I might eventually build methods for lm and glm.

Author(s)

Richard McElreath

See Also

link,map,map2stan


rmcelreath/rethinking documentation built on Aug. 26, 2024, 5:54 p.m.