dynamite Output to draws_df FormatConverts 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.
# S3 method for dynamitefit
as_draws_df(
x,
parameters = NULL,
responses = NULL,
types = NULL,
times = NULL,
groups = NULL,
...
)# S3 method for dynamitefit
as_draws(x, parameters = NULL, responses = NULL, types = NULL, ...)
A draws_df object.
A draws_df object.
[dynamitefit]
The model fit object.
[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. This argument is mutually exclusive with types.
[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.
omega_alpha, and omega_psi. See also get_parameter_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.
This argument is mutually exclusive with parameters.
[double()]
Time point(s) to keep. If NULL
(the default), all time points are kept.
[character()] Group name(s) to keep. If NULL
(the default), all groups are kept.
Ignored.
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.
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()
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))
Run the code above in your browser using DataLab