OdeModelMCMC: An ODE model MCMC fit (R6 class)

OdeModelMCMCR Documentation

An ODE model MCMC fit (R6 class)

Description

Used for holding the output of the ⁠$sample()⁠ method of the OdeModel class. Users are not meant to instantiate objects of this class directly.

Super class

odemodeling::OdeModelFit -> OdeModelMCMC

Public fields

cmdstan_diagnostics

Output of the diagnose program of 'CmdStan'.

cmdstan_summary

Output of the stansummary program of 'CmdStan'.

Methods

Public methods

Inherited methods

Method print_diagnostics()

Print the 'stdout' of 'CmdStan' diagnostics.

Usage
OdeModelMCMC$print_diagnostics()

Method print_summary()

Print the 'stdout' of 'CmdStan' summary.

Usage
OdeModelMCMC$print_summary()

Method new()

Create an OdeModelMCMC object.

Usage
OdeModelMCMC$new(
  model,
  t0,
  t,
  solver,
  data,
  cmdstanr_fit,
  cmdstan_diagnostics,
  cmdstan_summary
)
Arguments
model

An object of class OdeModel (will be deepcopied).

t0

Used initial time.

t

Used time points.

solver

Used solver. An object of class OdeSolver.

data

Given additional data.

cmdstanr_fit

A cmdstanr::CmdStanMCMC object.

cmdstan_diagnostics

Output of the diagnose program of 'CmdStan'.

cmdstan_summary

Output of the stansummary program of 'CmdStan'.


Method print()

Print information about the object.

Usage
OdeModelMCMC$print()

Method cmdstan_init()

Get used 'CmdStan' init argument.

Usage
OdeModelMCMC$cmdstan_init()

Method gqs()

Simulate ODE solutions (and other possible generated quantities using) the model and fitted params. This If any of the arguments are NULL (default), they are replaced with ones saved in the OdeModelFit object.

Usage
OdeModelMCMC$gqs(
  t0 = NULL,
  t = NULL,
  data = NULL,
  solver = NULL,
  fitted_params = NULL,
  ...
)
Arguments
t0

Initial time.

t

Vector of time points.

data

Additional data.

solver

ODE solver.

fitted_params

Will be passed as the fitted_params argument to the ⁠$generate_quantities()⁠ method of the underlying cmdstanr::CmdStanModel object. If this is NULL (default), parameter draws of the OdeModelFit object are used.

...

Arguments passed to the ⁠$generate_quantities()⁠ method of the underlying cmdstanr::CmdStanModel object.

Returns

An object of class OdeModelGQ.


Method reliability()

Study reliability of results by running standalone generated quantities using more accurate ODE solver configurations. See Timonen, J. et al. (2022) for description of the method. Currently it is the user's responsibility to ensure that solvers is a list of increasingly accurate solvers.

Usage
OdeModelMCMC$reliability(
  solvers,
  savedir = "results",
  basename = "odegq",
  recompute_loglik = TRUE,
  ...
)
Arguments
solvers

List of ODE solvers (should be the same solver as used during MCMC, but with increasingly more accurate configurations). See odesolvers_lists for creating this.

savedir

Directory where results are saved. NOTE: it might be difficult to load the results if you move them to a different place afterwards, because the file paths get saved in the output. Improving the file handling should be a future improvement.

basename

Base name for saved files.

recompute_loglik

Should the log-likelihoods corresponding to solver configuration used during MCMC be recomputed?

...

Additional arguments passed to the ⁠$generate_quantities()⁠ method of the underlying cmdstanr::CmdStanModel object.

Returns

A named list.


Method clone()

The objects of this class are cloneable with this method.

Usage
OdeModelMCMC$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

References

  1. Timonen, J. et al. (2022). An importance sampling approach for reliable and efficient inference in Bayesian ordinary differential equation models. arXiv.

See Also

For more useful methods, see the methods inherited from OdeModelFit.

Other model fit classes: OdeModelFit, OdeModelGQ


jtimonen/odemodeling documentation built on Sept. 15, 2024, 4:29 a.m.