as.matrix.epimodel {epidemia}R Documentation

Extract posterior samples

Description

Get parameter samples from a fitted model object of class epimodel.

Usage

## S3 method for class 'epimodel'
as.matrix(
  x,
  ...,
  pars = NULL,
  regex_pars = NULL,
  par_models = NULL,
  par_types = NULL,
  par_groups = NULL
)

## S3 method for class 'epimodel'
as.array(
  x,
  ...,
  pars = NULL,
  regex_pars = NULL,
  par_models = NULL,
  par_types = NULL,
  par_groups = NULL
)

## S3 method for class 'epimodel'
as.data.frame(
  x,
  ...,
  pars = NULL,
  regex_pars = NULL,
  par_models = NULL,
  par_types = NULL,
  par_groups = NULL
)

Arguments

x

A fitted model object returned by epim. See epimodel-objects.

...

Not used.

pars

Character vector of parameter names to return. Same as as.matrix.stanreg

regex_pars

Character vector of regular expressions against which to match parameter names.Same as as.matrix.stanreg

par_models

A character vector that restricts parameters to a subset of model components. For example, "R" only uses parameters in the transmission model, "inf" uses parameters in infection model. Strings giving the name of the response in an observation model (i.e. LHS of the formula in epiobs) can also be used. If NULL (the default), all components are used.

par_types

A character vector that restricts parameters based on their type. The vector can include any of "fixed", "autocor", "random", "aux", "latent", or "seeds". The default is c("fixed", "aux", "seeds"), to avoid printing a very large number of parameters. If NULL, all types are used.

par_groups

A character vector restricting parameters to those used for a subset of regions in which the epidemic is modeled. Defaults to NULL in which case all regions are used.

Details

as.matrix, as.array and as.data.frame each return a sample of parameter draws from objects of class epimodel. The returned parameters include those in the regression for R_{tm}$, but also other parameters in the model. These methods closely resemble those for stanreg objects in rstanarm. Please see as.matrix.stanreg for a general explanation of these methods.

Value

A matrix, array or data.frame object.


[Package epidemia version 1.0.0 Index]