mvgam_draws {mvgam} | R Documentation |
Extract posterior draws from fitted mvgam
objects
Description
Extract posterior draws in conventional formats as data.frames, matrices, or arrays.
Usage
## S3 method for class 'mvgam'
as.data.frame(
x,
row.names = NULL,
optional = TRUE,
variable = "betas",
use_alias = TRUE,
regex = FALSE,
...
)
## S3 method for class 'mvgam'
as.matrix(x, variable = "betas", regex = FALSE, use_alias = TRUE, ...)
## S3 method for class 'mvgam'
as.array(x, variable = "betas", regex = FALSE, use_alias = TRUE, ...)
## S3 method for class 'mvgam'
as_draws(
x,
variable = NULL,
regex = FALSE,
inc_warmup = FALSE,
use_alias = TRUE,
...
)
## S3 method for class 'mvgam'
as_draws_matrix(
x,
variable = NULL,
regex = FALSE,
inc_warmup = FALSE,
use_alias = TRUE,
...
)
## S3 method for class 'mvgam'
as_draws_df(
x,
variable = NULL,
regex = FALSE,
inc_warmup = FALSE,
use_alias = TRUE,
...
)
## S3 method for class 'mvgam'
as_draws_array(
x,
variable = NULL,
regex = FALSE,
inc_warmup = FALSE,
use_alias = TRUE,
...
)
## S3 method for class 'mvgam'
as_draws_list(
x,
variable = NULL,
regex = FALSE,
inc_warmup = FALSE,
use_alias = TRUE,
...
)
## S3 method for class 'mvgam'
as_draws_rvars(x, variable = NULL, regex = FALSE, inc_warmup = FALSE, ...)
Arguments
x |
|
row.names |
Ignored |
optional |
Ignored |
variable |
A character specifying which parameters to extract. Can either be one of the following options:
OR can be a character vector providing the variables to extract |
use_alias |
Logical. If more informative names for parameters are available
(i.e. for beta coefficients |
regex |
Logical. If not using one of the prespecified options for extractions,
should |
... |
Ignored |
inc_warmup |
Should warmup draws be included? Defaults to |
Value
A data.frame
, matrix
, or array
containing the posterior draws.
Examples
## Not run:
sim <- sim_mvgam(family = Gamma())
mod1 <- mvgam(y ~ s(season, bs = 'cc'),
trend_model = 'AR1',
data = sim$data_train,
family = Gamma(),
chains = 2,
samples = 300)
beta_draws_df <- as.data.frame(mod1, variable = 'betas')
head(beta_draws_df)
str(beta_draws_df)
beta_draws_mat <- as.matrix(mod1, variable = 'betas')
head(beta_draws_mat)
str(beta_draws_mat)
shape_pars <- as.matrix(mod1, variable = 'shape', regex = TRUE)
head(shape_pars)
## End(Not run)