as_draws_df.dynamitefit {dynamite}R Documentation

Convert dynamite Output to draws_df Format

Description

Converts the output from a dynamite() call to a draws_df format of the posterior package, enabling the use of diagnostics and plotting methods of posterior and bayesplot packages. Note that this function returns variables in a wide format, whereas as.data.frame() uses the long format.

Usage

## S3 method for class 'dynamitefit'
as_draws_df(x, parameters = NULL, responses = NULL, types = NULL, ...)

## S3 method for class 'dynamitefit'
as_draws(x, parameters = NULL, responses = NULL, types = NULL, ...)

Arguments

x

[dynamitefit]
The model fit object.

parameters

[character()]
Parameter(s) for which the samples should be extracted. Possible options can be found with function get_parameter_names(). Default is all parameters of specific type for all responses.

responses

[character()]
Response(s) for which the samples should be extracted. Possible options are elements of unique(x$priors$response), and the default is this entire vector. Ignored if the argument parameters is supplied.

types

[character()]
Type(s) of the parameters for which the samples should be extracted. See details of possible values. Default is all values listed in details except spline coefficients omega, omega_alpha, and omega_psi. See also get_parameter_types(). Ignored if the argument parameters is supplied.

...

Ignored.

Details

You can use the arguments parameters, responses and types to extract only a subset of the model parameters (i.e., only certain types of parameters related to a certain response variable).

See potential values for the types argument in as.data.frame.dynamitefit() and get_parameter_names() for potential values for parameters argument.

Value

A draws_df object.

A draws_df object.

See Also

Model outputs as.data.frame.dynamitefit(), as.data.table.dynamitefit(), coef.dynamitefit(), confint.dynamitefit(), dynamite(), get_code(), get_data(), get_parameter_dims(), get_parameter_names(), get_parameter_types(), ndraws.dynamitefit(), nobs.dynamitefit()

Examples

data.table::setDTthreads(1) # For CRAN
as_draws(gaussian_example_fit, types = c("sigma", "beta"))

# Compute MCMC diagnostics using the posterior package
posterior::summarise_draws(as_draws(gaussian_example_fit))


[Package dynamite version 1.4.9 Index]