extract.samples: Collect posterior samples from a fit model

Description Usage Arguments Details Value Author(s) See Also

Description

Extracts or draws posterior samples for fit models.

Usage

1
extract.samples( object , n=10000 , clean.names=TRUE , ... )

Arguments

object

Fit model to extract samples from

n

Number of samples to simulate

clean.names

When TRUE, removes parentheses from parameters named (Intercept).

...

Other parameters to pass to descendent functions (when defined)

Details

For map2stan models, this function returns cleaned samples already contained in the object. These samples are cleaned of dimension attributes and the lp__ and dev traces that are used internally.

For map and other types, it uses the variance-covariance matrix and coefficients to define a multivariate Gaussian posterior to draw n samples from.

Value

A named list (for map2stan) or data.frame containing samples for each parameter in the posterior distribution.

Author(s)

Richard McElreath

See Also

mvrnorm


joepowers16/rethinking documentation built on June 2, 2019, 6:52 p.m.