Learn R Programming

rethinking (version 1.59)

sim: 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

Value

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.

See Also

link,map,map2stan