Simulates posterior observations for map
and map2stan
model fits.
sim( fit , data , n=1000 , post , ll , refresh=0.1 , replace , ... )
Object of class map
or map2stan
Optional list of data to compute predictions over
Number of samples to use
Samples from posterior. If missing, sim
samples using n
Other parameters to pass to someone
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
.