Learn R Programming

rethinking (version 1.59)

extract.samples: Collect posterior samples from a fit model

Description

Extracts or draws posterior samples for fit models.

Usage

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)

Value

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

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.

See Also

mvrnorm