post_draws {gratia} | R Documentation |
Low-level Functions to generate draws from the posterior distribution of model coefficients
Description
Low-level Functions to generate draws from the posterior distribution of model coefficients
Generate posterior draws from a fitted model
Usage
post_draws(model, ...)
## Default S3 method:
post_draws(
model,
n,
method = c("gaussian", "mh", "inla", "user"),
mu = NULL,
sigma = NULL,
n_cores = 1L,
burnin = 1000,
thin = 1,
t_df = 40,
rw_scale = 0.25,
index = NULL,
frequentist = FALSE,
unconditional = FALSE,
parametrized = TRUE,
mvn_method = c("mvnfast", "mgcv"),
draws = NULL,
seed = NULL,
...
)
generate_draws(model, ...)
## S3 method for class 'gam'
generate_draws(
model,
n,
method = c("gaussian", "mh", "inla"),
mu = NULL,
sigma = NULL,
n_cores = 1L,
burnin = 1000,
thin = 1,
t_df = 40,
rw_scale = 0.25,
index = NULL,
frequentist = FALSE,
unconditional = FALSE,
mvn_method = c("mvnfast", "mgcv"),
seed = NULL,
...
)
Arguments
model |
a fitted R model. Currently only models fitted by |
... |
arguments passed to methods. |
n |
numeric; the number of posterior draws to take. |
method |
character; which algorithm to use to sample from the posterior.
Currently implemented methods are: |
mu |
numeric; user-supplied mean vector (vector of model coefficients). Currently ignored. |
sigma |
matrix; user-supplied covariance matrix for |
n_cores |
integer; number of CPU cores to use when generating
multivariate normal distributed random values. Only used if
|
burnin |
numeric; the length of any initial burn in period to discard.
See |
thin |
numeric; retain only |
t_df |
numeric; degrees of freedom for static multivariate t proposal.
See |
rw_scale |
numeric; factor by which to scale posterior covariance
matrix when generating random walk proposals. See |
index |
numeric; vector of indices of coefficients to use. Can be used
to subset the mean vector and covariance matrix extracted from |
frequentist |
logical; if |
unconditional |
logical; if |
parametrized |
logical; use parametrized coefficients and covariance
matrix, which respect the linear inequality constraints of the model. Only
for |
mvn_method |
character; one of |
draws |
matrix; user supplied posterior draws to be used when
|
seed |
numeric; the random seed to use. If |