Skip to contents

Extracts either time-varying or time-invariant parameters of the model.

Usage

# S3 method for dynamitefit
coef(
  object,
  types = c("alpha", "beta", "delta"),
  parameters = NULL,
  responses = NULL,
  times = NULL,
  groups = NULL,
  summary = TRUE,
  probs = c(0.05, 0.95),
  ...
)

Arguments

object

[dynamitefit]
The model fit object.

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.

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. This argument is mutually exclusive with types.

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. omega_alpha, and omega_psi. See also get_parameter_types().

times

[double()]
Time point(s) to keep. If NULL (the default), all time points are kept.

groups

[character()] Group name(s) to keep. If NULL (the default), all groups are kept.

summary

[logical(1)]
If TRUE (default), returns posterior mean, standard deviation, and posterior quantiles (as defined by the probs argument) for all parameters. If FALSE, returns the posterior samples instead.

probs

[numeric()]
Quantiles of interest. Default is c(0.05, 0.95).

...

Ignored.

Value

A tibble containing either samples or summary statistics of the model parameters in a long format.

Examples

data.table::setDTthreads(1) # For CRAN
betas <- coef(gaussian_example_fit, type = "beta")
deltas <- coef(gaussian_example_fit, type = "delta")