Skip to contents

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

Usage

# S3 method for dynamitefit
coef(
  object,
  parameters = NULL,
  type = c("beta", "delta", "nu", "lambda", "psi"),
  responses = NULL,
  summary = TRUE,
  probs = c(0.05, 0.95),
  include_alpha = TRUE,
  ...
)

Arguments

object

[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.

type

[character(1)]
Either beta (the default) for time-invariant coefficients, delta for time-varying coefficients, nu for random effects, lambda for factor loadings, or psi for latent factor. Ignored if the argument parameters is supplied.

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.

summary

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

probs

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

include_alpha

[logical(1)]
If TRUE (default), extracts also time-invariant intercept term alpha if time-invariant parameters beta are extracted, and time-varying alpha if time-varying delta are extracted. Ignored if the argument parameters is supplied. @param 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.

...

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")