diff --git a/DESCRIPTION b/DESCRIPTION index a1f5669..3c7bd2d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: odemodeling Title: Building, fitting, and validating Bayesian ODE models in 'Stan' -Version: 0.2.1 +Version: 0.2.2 Authors@R: person(given = "Juho", family = "Timonen", @@ -15,7 +15,7 @@ License: BSD_3_clause + file LICENCE Encoding: UTF-8 LazyData: true Roxygen: list(markdown = TRUE) -RoxygenNote: 7.1.2 +RoxygenNote: 7.2.3 SystemRequirements: CmdStan (https://mc-stan.org/users/interfaces/cmdstan) Imports: methods, diff --git a/NAMESPACE b/NAMESPACE index 7f0321e..5ccea1a 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -9,6 +9,7 @@ export(bdf_list) export(ckrk) export(compute_reliability_metrics) export(euler) +export(example_ode_model) export(log_ratios) export(max_abs_loglik_diff) export(max_abs_odesol_diff) diff --git a/NEWS.md b/NEWS.md index 476c748..38eef09 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,9 @@ # Version 0.2 +## odemodeling 0.2.2 + * Improves documentation. + * Exports `example_ode_model()`. + ## odemodeling 0.2.0 * Adds the `$diagnose()` method for the `OdeModel` class. * Stores the results of `diagnose` and `stansummary`in the diff --git a/R/classes-fit.R b/R/classes-fit.R index 480c022..d180259 100644 --- a/R/classes-fit.R +++ b/R/classes-fit.R @@ -85,7 +85,6 @@ OdeModelMCMC <- R6::R6Class("OdeModelMCMC", solver = NULL, fitted_params = NULL, ...) { - # Handle input t0 <- replace_if_null(t0, self$t0) t <- replace_if_null(t, self$t) diff --git a/R/classes-model.R b/R/classes-model.R index 17596c6..c9e8922 100644 --- a/R/classes-model.R +++ b/R/classes-model.R @@ -126,7 +126,6 @@ OdeModel <- R6::R6Class("OdeModel", list( solver = rk45(), params = NULL, ...) { - # Full Stan data model <- self sd <- create_standata(model, t0, t, solver) @@ -166,7 +165,6 @@ OdeModel <- R6::R6Class("OdeModel", list( data = list(), solver = rk45(), ...) { - # Check and handle input sd <- create_standata(self, t0, t, solver) full_data <- c(sd, data) @@ -212,7 +210,6 @@ OdeModel <- R6::R6Class("OdeModel", list( error = Inf, epsilon = 1e-6, ...) { - # Check and handle input sd <- create_standata(self, t0, t, solver) full_data <- c(sd, data) @@ -273,7 +270,7 @@ OdeModel <- R6::R6Class("OdeModel", list( fit <- model$sample( t0 = t0, t = t, - data = data, + data = data, solver = solver, chains = chains, ... diff --git a/R/classes-standecl.R b/R/classes-standecl.R index d390749..7ec5c20 100644 --- a/R/classes-standecl.R +++ b/R/classes-standecl.R @@ -1,4 +1,3 @@ - #' A Stan variable declaration (an abstract base class) #' #' @field name name of the variable diff --git a/R/main-examples.R b/R/main-examples.R index 05a97be..3240a52 100644 --- a/R/main-examples.R +++ b/R/main-examples.R @@ -9,6 +9,7 @@ #' \item `"lv"` - Lotka-Volterra model #' } #' @return An object of class `OdeModel`. +#' @export #' @family model constructor functions example_ode_model <- function(name, prior_only = FALSE, ...) { choices <- c("gsir", "tmdd", "lv") @@ -29,7 +30,6 @@ example_ode_model <- function(name, prior_only = FALSE, ...) { # Group-stratified SIR example model example_ode_model_gsir <- function(prior_only, ...) { - # Time points N <- stan_dim("N", lower = 0) # number of timepoints @@ -134,7 +134,6 @@ example_ode_model_gsir <- function(prior_only, ...) { # TMDD example model example_ode_model_tmdd <- function(prior_only, ...) { - # Dimensions and other data N <- stan_dim("N", lower = 1) # number of time points D <- stan_dim("D", lower = 1) # ODE system dimension @@ -205,7 +204,6 @@ example_ode_model_tmdd <- function(prior_only, ...) { # Lotka-Volterra example model example_ode_model_lv <- function(prior_only = FALSE, ...) { - # Dimensions and other data N <- stan_dim("N", lower = 1) # number of time points D <- stan_dim("D", lower = 1) # ODE system dimension diff --git a/R/main-model.R b/R/main-model.R index e8295df..73c879f 100644 --- a/R/main-model.R +++ b/R/main-model.R @@ -52,7 +52,6 @@ ode_model <- function(N, verbose = FALSE, compile = TRUE, sig_figs = 18) { - # Argument checks choices_vars <- c("StanParameter", "StanTransformation", "StanDeclaration") checkmate::assert_class(N, "StanDimension") diff --git a/R/odemodeling-package.R b/R/odemodeling-package.R index f42173e..0292aa5 100644 --- a/R/odemodeling-package.R +++ b/R/odemodeling-package.R @@ -45,6 +45,33 @@ #' \item See \code{\link{compare_odefits}} for functions to compare #' different ODE model simulations and fits. #' } +#' @section Importance sampling for reliable and efficient inference in Bayesian ODE models: +#' Our proposed workflow is to +#' \enumerate{ +#' \item Select an initial ODE solver M. +#' \item Sample the parameter posterior using MCMC with M as the ODE solver. +#' \item Compute certain metrics using a more accurate solver M∗. +#' \item Increase the accuracy of M∗ and repeat Step 3 until the metrics converge. +#' If the Pareto-k metric converges to a value larger than 0.7, increase the accuracy +#' of M and go back to Step 2. +#' \item Compute any posterior estimates using final importance weights. See +#' Timonen et al. (2022) below. +#' } +#' The algorithm can be used to validate the reliability, and correct the errors +#' of a given method M, which can be for example a software default. On the other hand, +#' a smart initial selection of M can provide speed gains +#' compared to often rather conservatively set software defaults, while still maintaining +#' reliability of the inferences. +#' +#' We generally recommend selecting M initially so that sampling is as fast as possible. +#' For example, for non-adaptive ODE solvers, one can first try using the smallest +#' sensible number of steps that does not result in immediate failure. +#' Selecting a good M is more difficult in the case of adaptive solvers. +#' We have +#' observed that tolerances on the order of 1e-4 to 1e-3 generally work well. +#' +#' See the \code{reliability()} method of the \code{\link{OdeModelMCMC}} class. +#' #' @section Tutorial: #' See the tutorial vignette. #' @references diff --git a/R/utils-create_input.R b/R/utils-create_input.R index 6fc2cf9..e7f909d 100644 --- a/R/utils-create_input.R +++ b/R/utils-create_input.R @@ -1,4 +1,3 @@ - # Create full Stan data for sampling or gq create_standata <- function(model, t0, t, solver) { checkmate::assert_class(model, "OdeModel") diff --git a/man/AdaptiveOdeSolver.Rd b/man/AdaptiveOdeSolver.Rd index 8d0b351..7f463c6 100644 --- a/man/AdaptiveOdeSolver.Rd +++ b/man/AdaptiveOdeSolver.Rd @@ -25,22 +25,22 @@ An ODE solver with adaptive step size \section{Methods}{ \subsection{Public methods}{ \itemize{ -\item \href{#method-new}{\code{AdaptiveOdeSolver$new()}} -\item \href{#method-standata}{\code{AdaptiveOdeSolver$standata()}} -\item \href{#method-to_string}{\code{AdaptiveOdeSolver$to_string()}} -\item \href{#method-clone}{\code{AdaptiveOdeSolver$clone()}} -} -} -\if{html}{ -\out{
Inherited methods} -\itemize{ -\item \out{}\href{../../odemodeling/html/OdeSolver.html#method-print}{\code{odemodeling::OdeSolver$print()}}\out{} -} -\out{
} -} +\item \href{#method-AdaptiveOdeSolver-new}{\code{AdaptiveOdeSolver$new()}} +\item \href{#method-AdaptiveOdeSolver-standata}{\code{AdaptiveOdeSolver$standata()}} +\item \href{#method-AdaptiveOdeSolver-to_string}{\code{AdaptiveOdeSolver$to_string()}} +\item \href{#method-AdaptiveOdeSolver-clone}{\code{AdaptiveOdeSolver$clone()}} +} +} +\if{html}{\out{ +
Inherited methods + +
+}} \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-new}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-AdaptiveOdeSolver-new}{}}} \subsection{Method \code{new()}}{ Initialize \subsection{Usage}{ @@ -62,8 +62,8 @@ Initialize } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-standata}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-AdaptiveOdeSolver-standata}{}}} \subsection{Method \code{standata()}}{ Create Stan data fields. \subsection{Usage}{ @@ -75,8 +75,8 @@ A list. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-to_string}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-AdaptiveOdeSolver-to_string}{}}} \subsection{Method \code{to_string()}}{ String description of the solver. \subsection{Usage}{ @@ -88,8 +88,8 @@ A string. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-clone}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-AdaptiveOdeSolver-clone}{}}} \subsection{Method \code{clone()}}{ The objects of this class are cloneable with this method. \subsection{Usage}{ diff --git a/man/FixedNumStepsOdeSolver.Rd b/man/FixedNumStepsOdeSolver.Rd index 7252d63..25be178 100644 --- a/man/FixedNumStepsOdeSolver.Rd +++ b/man/FixedNumStepsOdeSolver.Rd @@ -21,22 +21,22 @@ An ODE solver with fixed number of steps \section{Methods}{ \subsection{Public methods}{ \itemize{ -\item \href{#method-new}{\code{FixedNumStepsOdeSolver$new()}} -\item \href{#method-standata}{\code{FixedNumStepsOdeSolver$standata()}} -\item \href{#method-to_string}{\code{FixedNumStepsOdeSolver$to_string()}} -\item \href{#method-clone}{\code{FixedNumStepsOdeSolver$clone()}} -} -} -\if{html}{ -\out{
Inherited methods} -\itemize{ -\item \out{}\href{../../odemodeling/html/OdeSolver.html#method-print}{\code{odemodeling::OdeSolver$print()}}\out{} -} -\out{
} -} +\item \href{#method-FixedNumStepsOdeSolver-new}{\code{FixedNumStepsOdeSolver$new()}} +\item \href{#method-FixedNumStepsOdeSolver-standata}{\code{FixedNumStepsOdeSolver$standata()}} +\item \href{#method-FixedNumStepsOdeSolver-to_string}{\code{FixedNumStepsOdeSolver$to_string()}} +\item \href{#method-FixedNumStepsOdeSolver-clone}{\code{FixedNumStepsOdeSolver$clone()}} +} +} +\if{html}{\out{ +
Inherited methods + +
+}} \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-new}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-FixedNumStepsOdeSolver-new}{}}} \subsection{Method \code{new()}}{ Initialize \subsection{Usage}{ @@ -54,8 +54,8 @@ Initialize } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-standata}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-FixedNumStepsOdeSolver-standata}{}}} \subsection{Method \code{standata()}}{ Create Stan data fields. \subsection{Usage}{ @@ -67,8 +67,8 @@ A list. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-to_string}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-FixedNumStepsOdeSolver-to_string}{}}} \subsection{Method \code{to_string()}}{ String description of the solver. \subsection{Usage}{ @@ -80,8 +80,8 @@ A string. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-clone}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-FixedNumStepsOdeSolver-clone}{}}} \subsection{Method \code{clone()}}{ The objects of this class are cloneable with this method. \subsection{Usage}{ diff --git a/man/OdeModel.Rd b/man/OdeModel.Rd index a39b1c7..2b22ec9 100644 --- a/man/OdeModel.Rd +++ b/man/OdeModel.Rd @@ -28,22 +28,22 @@ to create models. \section{Methods}{ \subsection{Public methods}{ \itemize{ -\item \href{#method-new}{\code{OdeModel$new()}} -\item \href{#method-assert_stanfile_exists}{\code{OdeModel$assert_stanfile_exists()}} -\item \href{#method-reinit}{\code{OdeModel$reinit()}} -\item \href{#method-print}{\code{OdeModel$print()}} -\item \href{#method-code}{\code{OdeModel$code()}} -\item \href{#method-make_params}{\code{OdeModel$make_params()}} -\item \href{#method-gqs}{\code{OdeModel$gqs()}} -\item \href{#method-sample}{\code{OdeModel$sample()}} -\item \href{#method-diagnose}{\code{OdeModel$diagnose()}} -\item \href{#method-sample_manyconf}{\code{OdeModel$sample_manyconf()}} -\item \href{#method-clone}{\code{OdeModel$clone()}} +\item \href{#method-OdeModel-new}{\code{OdeModel$new()}} +\item \href{#method-OdeModel-assert_stanfile_exists}{\code{OdeModel$assert_stanfile_exists()}} +\item \href{#method-OdeModel-reinit}{\code{OdeModel$reinit()}} +\item \href{#method-OdeModel-print}{\code{OdeModel$print()}} +\item \href{#method-OdeModel-code}{\code{OdeModel$code()}} +\item \href{#method-OdeModel-make_params}{\code{OdeModel$make_params()}} +\item \href{#method-OdeModel-gqs}{\code{OdeModel$gqs()}} +\item \href{#method-OdeModel-sample}{\code{OdeModel$sample()}} +\item \href{#method-OdeModel-diagnose}{\code{OdeModel$diagnose()}} +\item \href{#method-OdeModel-sample_manyconf}{\code{OdeModel$sample_manyconf()}} +\item \href{#method-OdeModel-clone}{\code{OdeModel$clone()}} } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-new}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModel-new}{}}} \subsection{Method \code{new()}}{ Create an \code{OdeModel} object. \subsection{Usage}{ @@ -71,8 +71,8 @@ Create an \code{OdeModel} object. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-assert_stanfile_exists}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModel-assert_stanfile_exists}{}}} \subsection{Method \code{assert_stanfile_exists()}}{ Check that the Stan model has been initialized correctly \subsection{Usage}{ @@ -81,8 +81,8 @@ Check that the Stan model has been initialized correctly } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-reinit}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModel-reinit}{}}} \subsection{Method \code{reinit()}}{ (Re)initialize the Stan model \subsection{Usage}{ @@ -91,8 +91,8 @@ Check that the Stan model has been initialized correctly } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-print}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModel-print}{}}} \subsection{Method \code{print()}}{ Print information about the model \subsection{Usage}{ @@ -101,8 +101,8 @@ Print information about the model } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-code}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModel-code}{}}} \subsection{Method \code{code()}}{ Get the Stan code of the model. \subsection{Usage}{ @@ -111,8 +111,8 @@ Get the Stan code of the model. } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-make_params}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModel-make_params}{}}} \subsection{Method \code{make_params()}}{ Format a vector into a draws array that can be passed to \verb{$gqs()}. Currently works only for models with only scalar parameters. @@ -134,8 +134,8 @@ iteration. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-gqs}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModel-gqs}{}}} \subsection{Method \code{gqs()}}{ Run standalone generated quantities. \subsection{Usage}{ @@ -167,8 +167,8 @@ An object of class \link{OdeModelGQ}. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-sample}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModel-sample}{}}} \subsection{Method \code{sample()}}{ Sample parameters of the model \subsection{Usage}{ @@ -196,8 +196,8 @@ An object of class \link{OdeModelMCMC}. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-diagnose}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModel-diagnose}{}}} \subsection{Method \code{diagnose()}}{ Run a gradient diagnosis \subsection{Usage}{ @@ -237,8 +237,8 @@ Raw 'Stan' output. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-sample_manyconf}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModel-sample_manyconf}{}}} \subsection{Method \code{sample_manyconf()}}{ Sample parameters of the ODE model using many different ODE solver configurations @@ -284,8 +284,8 @@ A named list. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-clone}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModel-clone}{}}} \subsection{Method \code{clone()}}{ The objects of this class are cloneable with this method. \subsection{Usage}{ diff --git a/man/OdeModelFit.Rd b/man/OdeModelFit.Rd index c531722..9b0ab4d 100644 --- a/man/OdeModelFit.Rd +++ b/man/OdeModelFit.Rd @@ -55,35 +55,35 @@ method of \code{cmdstanr_fit}.} \section{Methods}{ \subsection{Public methods}{ \itemize{ -\item \href{#method-new}{\code{OdeModelFit$new()}} -\item \href{#method-time}{\code{OdeModelFit$time()}} -\item \href{#method-info}{\code{OdeModelFit$info()}} -\item \href{#method-draws}{\code{OdeModelFit$draws()}} -\item \href{#method-summary}{\code{OdeModelFit$summary()}} -\item \href{#method-niterations}{\code{OdeModelFit$niterations()}} -\item \href{#method-nchains}{\code{OdeModelFit$nchains()}} -\item \href{#method-ndraws}{\code{OdeModelFit$ndraws()}} -\item \href{#method-cmdstan_seed}{\code{OdeModelFit$cmdstan_seed()}} -\item \href{#method-cmdstan_version}{\code{OdeModelFit$cmdstan_version()}} -\item \href{#method-get_t}{\code{OdeModelFit$get_t()}} -\item \href{#method-get_t0}{\code{OdeModelFit$get_t0()}} -\item \href{#method-dim}{\code{OdeModelFit$dim()}} -\item \href{#method-dim_odesol}{\code{OdeModelFit$dim_odesol()}} -\item \href{#method-extract_unflattened}{\code{OdeModelFit$extract_unflattened()}} -\item \href{#method-extract_odesol}{\code{OdeModelFit$extract_odesol()}} -\item \href{#method-extract_y0}{\code{OdeModelFit$extract_y0()}} -\item \href{#method-extract_odesol_quantile}{\code{OdeModelFit$extract_odesol_quantile()}} -\item \href{#method-loglik}{\code{OdeModelFit$loglik()}} -\item \href{#method-extract_odesol_df}{\code{OdeModelFit$extract_odesol_df()}} -\item \href{#method-extract_odesol_df_dist}{\code{OdeModelFit$extract_odesol_df_dist()}} -\item \href{#method-plot_odesol}{\code{OdeModelFit$plot_odesol()}} -\item \href{#method-plot_odesol_dist}{\code{OdeModelFit$plot_odesol_dist()}} -\item \href{#method-clone}{\code{OdeModelFit$clone()}} +\item \href{#method-OdeModelFit-new}{\code{OdeModelFit$new()}} +\item \href{#method-OdeModelFit-time}{\code{OdeModelFit$time()}} +\item \href{#method-OdeModelFit-info}{\code{OdeModelFit$info()}} +\item \href{#method-OdeModelFit-draws}{\code{OdeModelFit$draws()}} +\item \href{#method-OdeModelFit-summary}{\code{OdeModelFit$summary()}} +\item \href{#method-OdeModelFit-niterations}{\code{OdeModelFit$niterations()}} +\item \href{#method-OdeModelFit-nchains}{\code{OdeModelFit$nchains()}} +\item \href{#method-OdeModelFit-ndraws}{\code{OdeModelFit$ndraws()}} +\item \href{#method-OdeModelFit-cmdstan_seed}{\code{OdeModelFit$cmdstan_seed()}} +\item \href{#method-OdeModelFit-cmdstan_version}{\code{OdeModelFit$cmdstan_version()}} +\item \href{#method-OdeModelFit-get_t}{\code{OdeModelFit$get_t()}} +\item \href{#method-OdeModelFit-get_t0}{\code{OdeModelFit$get_t0()}} +\item \href{#method-OdeModelFit-dim}{\code{OdeModelFit$dim()}} +\item \href{#method-OdeModelFit-dim_odesol}{\code{OdeModelFit$dim_odesol()}} +\item \href{#method-OdeModelFit-extract_unflattened}{\code{OdeModelFit$extract_unflattened()}} +\item \href{#method-OdeModelFit-extract_odesol}{\code{OdeModelFit$extract_odesol()}} +\item \href{#method-OdeModelFit-extract_y0}{\code{OdeModelFit$extract_y0()}} +\item \href{#method-OdeModelFit-extract_odesol_quantile}{\code{OdeModelFit$extract_odesol_quantile()}} +\item \href{#method-OdeModelFit-loglik}{\code{OdeModelFit$loglik()}} +\item \href{#method-OdeModelFit-extract_odesol_df}{\code{OdeModelFit$extract_odesol_df()}} +\item \href{#method-OdeModelFit-extract_odesol_df_dist}{\code{OdeModelFit$extract_odesol_df_dist()}} +\item \href{#method-OdeModelFit-plot_odesol}{\code{OdeModelFit$plot_odesol()}} +\item \href{#method-OdeModelFit-plot_odesol_dist}{\code{OdeModelFit$plot_odesol_dist()}} +\item \href{#method-OdeModelFit-clone}{\code{OdeModelFit$clone()}} } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-new}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModelFit-new}{}}} \subsection{Method \code{new()}}{ Create an \link{OdeModelFit} object. \subsection{Usage}{ @@ -110,8 +110,8 @@ object (will be deepcopied).} } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-time}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModelFit-time}{}}} \subsection{Method \code{time()}}{ Get time information. \subsection{Usage}{ @@ -123,8 +123,8 @@ A list. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-info}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModelFit-info}{}}} \subsection{Method \code{info()}}{ Get various information. \subsection{Usage}{ @@ -136,8 +136,8 @@ A string. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-draws}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModelFit-draws}{}}} \subsection{Method \code{draws()}}{ Get draws (parameters and generated quantities). \subsection{Usage}{ @@ -158,8 +158,8 @@ A \link[posterior:draws_array]{posterior::draws_array} object. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-summary}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModelFit-summary}{}}} \subsection{Method \code{summary()}}{ Get summary \subsection{Usage}{ @@ -171,8 +171,8 @@ A \code{tibble}. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-niterations}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModelFit-niterations}{}}} \subsection{Method \code{niterations()}}{ Get number of post-warmup iterations per MCMC chain. \subsection{Usage}{ @@ -181,8 +181,8 @@ Get number of post-warmup iterations per MCMC chain. } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-nchains}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModelFit-nchains}{}}} \subsection{Method \code{nchains()}}{ Get number of MCMC chains. \subsection{Usage}{ @@ -191,8 +191,8 @@ Get number of MCMC chains. } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-ndraws}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModelFit-ndraws}{}}} \subsection{Method \code{ndraws()}}{ Get total number of post-warmup draws. \subsection{Usage}{ @@ -201,8 +201,8 @@ Get total number of post-warmup draws. } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-cmdstan_seed}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModelFit-cmdstan_seed}{}}} \subsection{Method \code{cmdstan_seed()}}{ Get used 'CmdStan' rng seed. \subsection{Usage}{ @@ -211,8 +211,8 @@ Get used 'CmdStan' rng seed. } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-cmdstan_version}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModelFit-cmdstan_version}{}}} \subsection{Method \code{cmdstan_version()}}{ Get used 'CmdStan' version. \subsection{Usage}{ @@ -224,8 +224,8 @@ A string. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-get_t}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModelFit-get_t}{}}} \subsection{Method \code{get_t()}}{ Get time points where the model was fitted. \subsection{Usage}{ @@ -245,8 +245,8 @@ will be \code{N+1}. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-get_t0}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModelFit-get_t0}{}}} \subsection{Method \code{get_t0()}}{ Get used initial time point t0. \subsection{Usage}{ @@ -258,8 +258,8 @@ A numeric value. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-dim}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModelFit-dim}{}}} \subsection{Method \code{dim()}}{ Get dimensions of a variable. \subsection{Usage}{ @@ -281,8 +281,8 @@ obtained as \code{metadata$stan_variable_dims[[variable]]}, where } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-dim_odesol}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModelFit-dim_odesol}{}}} \subsection{Method \code{dim_odesol()}}{ Extract the dimensions of the ODE solution variable. \subsection{Usage}{ @@ -295,8 +295,8 @@ number of time points and second element is the ODE system dimension. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-extract_unflattened}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModelFit-extract_unflattened}{}}} \subsection{Method \code{extract_unflattened()}}{ Extract array variable draws so that the array is unflattened. \subsection{Usage}{ @@ -317,8 +317,8 @@ obtained as \code{self$dim(variable)}. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-extract_odesol}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModelFit-extract_odesol}{}}} \subsection{Method \code{extract_odesol()}}{ Extract the ODE solutions using each parameter draw, in an unflattened base \R array format. @@ -341,8 +341,8 @@ time points and \code{D} is the number of ODE system dimensions. If } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-extract_y0}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModelFit-extract_y0}{}}} \subsection{Method \code{extract_y0()}}{ Extract the ODE initial states using each parameter draw, in a base \R array format. @@ -357,8 +357,8 @@ system dimensions. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-extract_odesol_quantile}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModelFit-extract_odesol_quantile}{}}} \subsection{Method \code{extract_odesol_quantile()}}{ Extract quantiles of the ODE solutions in a base \R array format. @@ -383,8 +383,8 @@ time points and \code{D} is the number of ODE system dimensions. If } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-loglik}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModelFit-loglik}{}}} \subsection{Method \code{loglik()}}{ Extract the log likelihood using each parameter draw. \subsection{Usage}{ @@ -396,8 +396,8 @@ A \link[posterior:draws_array]{posterior::draws_array}. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-extract_odesol_df}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModelFit-extract_odesol_df}{}}} \subsection{Method \code{extract_odesol_df()}}{ Extract the ODE solutions using each parameter draw, in a flattened data frame format that is easy to pass as data @@ -428,8 +428,8 @@ A \code{data.frame}. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-extract_odesol_df_dist}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModelFit-extract_odesol_df_dist}{}}} \subsection{Method \code{extract_odesol_df_dist()}}{ Extract (quantiles of) the marginal distribution of ODE solutions in a data frame format that is easy to pass as data @@ -460,8 +460,8 @@ A \code{data.frame}. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-plot_odesol}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModelFit-plot_odesol}{}}} \subsection{Method \code{plot_odesol()}}{ A quick way to plot the ODE solutions. \subsection{Usage}{ @@ -493,8 +493,8 @@ A \code{ggplot} object. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-plot_odesol_dist}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModelFit-plot_odesol_dist}{}}} \subsection{Method \code{plot_odesol_dist()}}{ A quick way to plot the marginal distribution of ODE solutions at each time point. @@ -528,8 +528,8 @@ A \code{ggplot} object. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-clone}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModelFit-clone}{}}} \subsection{Method \code{clone()}}{ The objects of this class are cloneable with this method. \subsection{Usage}{ diff --git a/man/OdeModelGQ.Rd b/man/OdeModelGQ.Rd index 34c4751..54e99ad 100644 --- a/man/OdeModelGQ.Rd +++ b/man/OdeModelGQ.Rd @@ -23,42 +23,42 @@ Other model fit classes: \section{Methods}{ \subsection{Public methods}{ \itemize{ -\item \href{#method-print}{\code{OdeModelGQ$print()}} -\item \href{#method-clone}{\code{OdeModelGQ$clone()}} +\item \href{#method-OdeModelGQ-print}{\code{OdeModelGQ$print()}} +\item \href{#method-OdeModelGQ-clone}{\code{OdeModelGQ$clone()}} } } -\if{html}{ -\out{
Inherited methods} -\itemize{ -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-cmdstan_seed}{\code{odemodeling::OdeModelFit$cmdstan_seed()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-cmdstan_version}{\code{odemodeling::OdeModelFit$cmdstan_version()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-dim}{\code{odemodeling::OdeModelFit$dim()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-dim_odesol}{\code{odemodeling::OdeModelFit$dim_odesol()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-draws}{\code{odemodeling::OdeModelFit$draws()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-extract_odesol}{\code{odemodeling::OdeModelFit$extract_odesol()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-extract_odesol_df}{\code{odemodeling::OdeModelFit$extract_odesol_df()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-extract_odesol_df_dist}{\code{odemodeling::OdeModelFit$extract_odesol_df_dist()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-extract_odesol_quantile}{\code{odemodeling::OdeModelFit$extract_odesol_quantile()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-extract_unflattened}{\code{odemodeling::OdeModelFit$extract_unflattened()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-extract_y0}{\code{odemodeling::OdeModelFit$extract_y0()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-get_t}{\code{odemodeling::OdeModelFit$get_t()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-get_t0}{\code{odemodeling::OdeModelFit$get_t0()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-info}{\code{odemodeling::OdeModelFit$info()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-initialize}{\code{odemodeling::OdeModelFit$initialize()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-loglik}{\code{odemodeling::OdeModelFit$loglik()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-nchains}{\code{odemodeling::OdeModelFit$nchains()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-ndraws}{\code{odemodeling::OdeModelFit$ndraws()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-niterations}{\code{odemodeling::OdeModelFit$niterations()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-plot_odesol}{\code{odemodeling::OdeModelFit$plot_odesol()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-plot_odesol_dist}{\code{odemodeling::OdeModelFit$plot_odesol_dist()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-summary}{\code{odemodeling::OdeModelFit$summary()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-time}{\code{odemodeling::OdeModelFit$time()}}\out{} -} -\out{
} -} +\if{html}{\out{ +
Inherited methods + +
+}} \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-print}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModelGQ-print}{}}} \subsection{Method \code{print()}}{ Print information about the object. \subsection{Usage}{ @@ -67,8 +67,8 @@ Print information about the object. } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-clone}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModelGQ-clone}{}}} \subsection{Method \code{clone()}}{ The objects of this class are cloneable with this method. \subsection{Usage}{ diff --git a/man/OdeModelMCMC.Rd b/man/OdeModelMCMC.Rd index 509c6d0..2c540e2 100644 --- a/man/OdeModelMCMC.Rd +++ b/man/OdeModelMCMC.Rd @@ -40,47 +40,47 @@ Other model fit classes: \section{Methods}{ \subsection{Public methods}{ \itemize{ -\item \href{#method-print_diagnostics}{\code{OdeModelMCMC$print_diagnostics()}} -\item \href{#method-print_summary}{\code{OdeModelMCMC$print_summary()}} -\item \href{#method-new}{\code{OdeModelMCMC$new()}} -\item \href{#method-print}{\code{OdeModelMCMC$print()}} -\item \href{#method-cmdstan_init}{\code{OdeModelMCMC$cmdstan_init()}} -\item \href{#method-gqs}{\code{OdeModelMCMC$gqs()}} -\item \href{#method-reliability}{\code{OdeModelMCMC$reliability()}} -\item \href{#method-clone}{\code{OdeModelMCMC$clone()}} -} -} -\if{html}{ -\out{
Inherited methods} -\itemize{ -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-cmdstan_seed}{\code{odemodeling::OdeModelFit$cmdstan_seed()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-cmdstan_version}{\code{odemodeling::OdeModelFit$cmdstan_version()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-dim}{\code{odemodeling::OdeModelFit$dim()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-dim_odesol}{\code{odemodeling::OdeModelFit$dim_odesol()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-draws}{\code{odemodeling::OdeModelFit$draws()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-extract_odesol}{\code{odemodeling::OdeModelFit$extract_odesol()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-extract_odesol_df}{\code{odemodeling::OdeModelFit$extract_odesol_df()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-extract_odesol_df_dist}{\code{odemodeling::OdeModelFit$extract_odesol_df_dist()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-extract_odesol_quantile}{\code{odemodeling::OdeModelFit$extract_odesol_quantile()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-extract_unflattened}{\code{odemodeling::OdeModelFit$extract_unflattened()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-extract_y0}{\code{odemodeling::OdeModelFit$extract_y0()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-get_t}{\code{odemodeling::OdeModelFit$get_t()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-get_t0}{\code{odemodeling::OdeModelFit$get_t0()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-info}{\code{odemodeling::OdeModelFit$info()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-loglik}{\code{odemodeling::OdeModelFit$loglik()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-nchains}{\code{odemodeling::OdeModelFit$nchains()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-ndraws}{\code{odemodeling::OdeModelFit$ndraws()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-niterations}{\code{odemodeling::OdeModelFit$niterations()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-plot_odesol}{\code{odemodeling::OdeModelFit$plot_odesol()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-plot_odesol_dist}{\code{odemodeling::OdeModelFit$plot_odesol_dist()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-summary}{\code{odemodeling::OdeModelFit$summary()}}\out{} -\item \out{}\href{../../odemodeling/html/OdeModelFit.html#method-time}{\code{odemodeling::OdeModelFit$time()}}\out{} -} -\out{
} -} +\item \href{#method-OdeModelMCMC-print_diagnostics}{\code{OdeModelMCMC$print_diagnostics()}} +\item \href{#method-OdeModelMCMC-print_summary}{\code{OdeModelMCMC$print_summary()}} +\item \href{#method-OdeModelMCMC-new}{\code{OdeModelMCMC$new()}} +\item \href{#method-OdeModelMCMC-print}{\code{OdeModelMCMC$print()}} +\item \href{#method-OdeModelMCMC-cmdstan_init}{\code{OdeModelMCMC$cmdstan_init()}} +\item \href{#method-OdeModelMCMC-gqs}{\code{OdeModelMCMC$gqs()}} +\item \href{#method-OdeModelMCMC-reliability}{\code{OdeModelMCMC$reliability()}} +\item \href{#method-OdeModelMCMC-clone}{\code{OdeModelMCMC$clone()}} +} +} +\if{html}{\out{ +
Inherited methods + +
+}} \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-print_diagnostics}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModelMCMC-print_diagnostics}{}}} \subsection{Method \code{print_diagnostics()}}{ Print the 'stdout' of 'CmdStan' diagnostics. \subsection{Usage}{ @@ -89,8 +89,8 @@ Print the 'stdout' of 'CmdStan' diagnostics. } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-print_summary}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModelMCMC-print_summary}{}}} \subsection{Method \code{print_summary()}}{ Print the 'stdout' of 'CmdStan' summary. \subsection{Usage}{ @@ -99,8 +99,8 @@ Print the 'stdout' of 'CmdStan' summary. } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-new}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModelMCMC-new}{}}} \subsection{Method \code{new()}}{ Create an \link{OdeModelMCMC} object. \subsection{Usage}{ @@ -139,8 +139,8 @@ Create an \link{OdeModelMCMC} object. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-print}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModelMCMC-print}{}}} \subsection{Method \code{print()}}{ Print information about the object. \subsection{Usage}{ @@ -149,8 +149,8 @@ Print information about the object. } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-cmdstan_init}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModelMCMC-cmdstan_init}{}}} \subsection{Method \code{cmdstan_init()}}{ Get used 'CmdStan' init argument. \subsection{Usage}{ @@ -159,8 +159,8 @@ Get used 'CmdStan' init argument. } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-gqs}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModelMCMC-gqs}{}}} \subsection{Method \code{gqs()}}{ Simulate ODE solutions (and other possible generated quantities using) the model and fitted params. This If any @@ -203,8 +203,8 @@ An object of class \link{OdeModelGQ}. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-reliability}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModelMCMC-reliability}{}}} \subsection{Method \code{reliability()}}{ Study reliability of results by running standalone generated quantities using more accurate ODE solver configurations. @@ -248,8 +248,8 @@ A named list. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-clone}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeModelMCMC-clone}{}}} \subsection{Method \code{clone()}}{ The objects of this class are cloneable with this method. \subsection{Usage}{ diff --git a/man/OdeSolver.Rd b/man/OdeSolver.Rd index 869c28a..28396ae 100644 --- a/man/OdeSolver.Rd +++ b/man/OdeSolver.Rd @@ -20,16 +20,16 @@ An ODE solver (an abstract base class) \section{Methods}{ \subsection{Public methods}{ \itemize{ -\item \href{#method-new}{\code{OdeSolver$new()}} -\item \href{#method-standata}{\code{OdeSolver$standata()}} -\item \href{#method-to_string}{\code{OdeSolver$to_string()}} -\item \href{#method-print}{\code{OdeSolver$print()}} -\item \href{#method-clone}{\code{OdeSolver$clone()}} +\item \href{#method-OdeSolver-new}{\code{OdeSolver$new()}} +\item \href{#method-OdeSolver-standata}{\code{OdeSolver$standata()}} +\item \href{#method-OdeSolver-to_string}{\code{OdeSolver$to_string()}} +\item \href{#method-OdeSolver-print}{\code{OdeSolver$print()}} +\item \href{#method-OdeSolver-clone}{\code{OdeSolver$clone()}} } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-new}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeSolver-new}{}}} \subsection{Method \code{new()}}{ \code{OdeSolver} is an abstract class that can't be initialized. \subsection{Usage}{ @@ -38,8 +38,8 @@ An ODE solver (an abstract base class) } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-standata}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeSolver-standata}{}}} \subsection{Method \code{standata()}}{ Create Stan data fields. \subsection{Usage}{ @@ -51,8 +51,8 @@ A list. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-to_string}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeSolver-to_string}{}}} \subsection{Method \code{to_string()}}{ String description of the solver. \subsection{Usage}{ @@ -64,8 +64,8 @@ A string. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-print}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeSolver-print}{}}} \subsection{Method \code{print()}}{ Print info about the object. \subsection{Usage}{ @@ -74,8 +74,8 @@ Print info about the object. } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-clone}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-OdeSolver-clone}{}}} \subsection{Method \code{clone()}}{ The objects of this class are cloneable with this method. \subsection{Usage}{ diff --git a/man/StanArray.Rd b/man/StanArray.Rd index d0d857c..12f2b67 100644 --- a/man/StanArray.Rd +++ b/man/StanArray.Rd @@ -23,24 +23,24 @@ A Stan array \section{Methods}{ \subsection{Public methods}{ \itemize{ -\item \href{#method-new}{\code{StanArray$new()}} -\item \href{#method-declaration}{\code{StanArray$declaration()}} -\item \href{#method-signature}{\code{StanArray$signature()}} -\item \href{#method-can_be_made_parameter}{\code{StanArray$can_be_made_parameter()}} -\item \href{#method-get_dims}{\code{StanArray$get_dims()}} -\item \href{#method-clone}{\code{StanArray$clone()}} -} -} -\if{html}{ -\out{
Inherited methods} -\itemize{ -\item \out{}\href{../../odemodeling/html/StanDeclaration.html#method-print}{\code{odemodeling::StanDeclaration$print()}}\out{} -} -\out{
} -} +\item \href{#method-StanArray-new}{\code{StanArray$new()}} +\item \href{#method-StanArray-declaration}{\code{StanArray$declaration()}} +\item \href{#method-StanArray-signature}{\code{StanArray$signature()}} +\item \href{#method-StanArray-can_be_made_parameter}{\code{StanArray$can_be_made_parameter()}} +\item \href{#method-StanArray-get_dims}{\code{StanArray$get_dims()}} +\item \href{#method-StanArray-clone}{\code{StanArray$clone()}} +} +} +\if{html}{\out{ +
Inherited methods + +
+}} \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-new}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanArray-new}{}}} \subsection{Method \code{new()}}{ Create a \link{StanArray} object. \subsection{Usage}{ @@ -65,8 +65,8 @@ Create a \link{StanArray} object. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-declaration}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanArray-declaration}{}}} \subsection{Method \code{declaration()}}{ Create a declaration for the array \subsection{Usage}{ @@ -78,8 +78,8 @@ a string } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-signature}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanArray-signature}{}}} \subsection{Method \code{signature()}}{ The variable when used in function signature \subsection{Usage}{ @@ -88,8 +88,8 @@ The variable when used in function signature } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-can_be_made_parameter}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanArray-can_be_made_parameter}{}}} \subsection{Method \code{can_be_made_parameter()}}{ Can the object be made into a parameter? \subsection{Usage}{ @@ -98,8 +98,8 @@ Can the object be made into a parameter? } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-get_dims}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanArray-get_dims}{}}} \subsection{Method \code{get_dims()}}{ Get all declared dimensions related to the object. \subsection{Usage}{ @@ -111,8 +111,8 @@ A list. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-clone}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanArray-clone}{}}} \subsection{Method \code{clone()}}{ The objects of this class are cloneable with this method. \subsection{Usage}{ diff --git a/man/StanDeclaration.Rd b/man/StanDeclaration.Rd index 9eba982..f854a10 100644 --- a/man/StanDeclaration.Rd +++ b/man/StanDeclaration.Rd @@ -22,18 +22,18 @@ A Stan variable declaration (an abstract base class) \section{Methods}{ \subsection{Public methods}{ \itemize{ -\item \href{#method-new}{\code{StanDeclaration$new()}} -\item \href{#method-declaration}{\code{StanDeclaration$declaration()}} -\item \href{#method-signature}{\code{StanDeclaration$signature()}} -\item \href{#method-print}{\code{StanDeclaration$print()}} -\item \href{#method-can_be_made_parameter}{\code{StanDeclaration$can_be_made_parameter()}} -\item \href{#method-get_dims}{\code{StanDeclaration$get_dims()}} -\item \href{#method-clone}{\code{StanDeclaration$clone()}} +\item \href{#method-StanDeclaration-new}{\code{StanDeclaration$new()}} +\item \href{#method-StanDeclaration-declaration}{\code{StanDeclaration$declaration()}} +\item \href{#method-StanDeclaration-signature}{\code{StanDeclaration$signature()}} +\item \href{#method-StanDeclaration-print}{\code{StanDeclaration$print()}} +\item \href{#method-StanDeclaration-can_be_made_parameter}{\code{StanDeclaration$can_be_made_parameter()}} +\item \href{#method-StanDeclaration-get_dims}{\code{StanDeclaration$get_dims()}} +\item \href{#method-StanDeclaration-clone}{\code{StanDeclaration$clone()}} } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-new}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanDeclaration-new}{}}} \subsection{Method \code{new()}}{ \code{StanDeclaration} is an abstract class that can't be initialized. \subsection{Usage}{ @@ -42,8 +42,8 @@ A Stan variable declaration (an abstract base class) } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-declaration}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanDeclaration-declaration}{}}} \subsection{Method \code{declaration()}}{ The variable declaration as a string. \subsection{Usage}{ @@ -52,8 +52,8 @@ The variable declaration as a string. } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-signature}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanDeclaration-signature}{}}} \subsection{Method \code{signature()}}{ The variable when used in function signature \subsection{Usage}{ @@ -62,8 +62,8 @@ The variable when used in function signature } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-print}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanDeclaration-print}{}}} \subsection{Method \code{print()}}{ Print \subsection{Usage}{ @@ -72,8 +72,8 @@ Print } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-can_be_made_parameter}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanDeclaration-can_be_made_parameter}{}}} \subsection{Method \code{can_be_made_parameter()}}{ Can the object be made into a parameter? \subsection{Usage}{ @@ -82,8 +82,8 @@ Can the object be made into a parameter? } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-get_dims}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanDeclaration-get_dims}{}}} \subsection{Method \code{get_dims()}}{ Get all declared dimensions related to the object. \subsection{Usage}{ @@ -95,8 +95,8 @@ A list. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-clone}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanDeclaration-clone}{}}} \subsection{Method \code{clone()}}{ The objects of this class are cloneable with this method. \subsection{Usage}{ diff --git a/man/StanDimension.Rd b/man/StanDimension.Rd index 9c6706a..3a57900 100644 --- a/man/StanDimension.Rd +++ b/man/StanDimension.Rd @@ -14,24 +14,24 @@ A dimension for a Stan vector or array \section{Methods}{ \subsection{Public methods}{ \itemize{ -\item \href{#method-new}{\code{StanDimension$new()}} -\item \href{#method-declaration}{\code{StanDimension$declaration()}} -\item \href{#method-signature}{\code{StanDimension$signature()}} -\item \href{#method-get_dims}{\code{StanDimension$get_dims()}} -\item \href{#method-clone}{\code{StanDimension$clone()}} -} -} -\if{html}{ -\out{
Inherited methods} -\itemize{ -\item \out{}\href{../../odemodeling/html/StanDeclaration.html#method-can_be_made_parameter}{\code{odemodeling::StanDeclaration$can_be_made_parameter()}}\out{} -\item \out{}\href{../../odemodeling/html/StanDeclaration.html#method-print}{\code{odemodeling::StanDeclaration$print()}}\out{} -} -\out{
} -} +\item \href{#method-StanDimension-new}{\code{StanDimension$new()}} +\item \href{#method-StanDimension-declaration}{\code{StanDimension$declaration()}} +\item \href{#method-StanDimension-signature}{\code{StanDimension$signature()}} +\item \href{#method-StanDimension-get_dims}{\code{StanDimension$get_dims()}} +\item \href{#method-StanDimension-clone}{\code{StanDimension$clone()}} +} +} +\if{html}{\out{ +
Inherited methods + +
+}} \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-new}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanDimension-new}{}}} \subsection{Method \code{new()}}{ Create a \link{StanDimension} object \subsection{Usage}{ @@ -51,8 +51,8 @@ Create a \link{StanDimension} object } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-declaration}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanDimension-declaration}{}}} \subsection{Method \code{declaration()}}{ Create a data block declaration for the dimension. \subsection{Usage}{ @@ -61,8 +61,8 @@ Create a data block declaration for the dimension. } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-signature}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanDimension-signature}{}}} \subsection{Method \code{signature()}}{ The variable when used in function signature \subsection{Usage}{ @@ -71,8 +71,8 @@ The variable when used in function signature } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-get_dims}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanDimension-get_dims}{}}} \subsection{Method \code{get_dims()}}{ Get all declared dimensions related to the object. \subsection{Usage}{ @@ -84,8 +84,8 @@ A list. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-clone}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanDimension-clone}{}}} \subsection{Method \code{clone()}}{ The objects of this class are cloneable with this method. \subsection{Usage}{ diff --git a/man/StanMatrix.Rd b/man/StanMatrix.Rd index 9295f29..fc8228d 100644 --- a/man/StanMatrix.Rd +++ b/man/StanMatrix.Rd @@ -23,24 +23,24 @@ A Stan matrix \section{Methods}{ \subsection{Public methods}{ \itemize{ -\item \href{#method-new}{\code{StanMatrix$new()}} -\item \href{#method-declaration}{\code{StanMatrix$declaration()}} -\item \href{#method-signature}{\code{StanMatrix$signature()}} -\item \href{#method-can_be_made_parameter}{\code{StanMatrix$can_be_made_parameter()}} -\item \href{#method-get_dims}{\code{StanMatrix$get_dims()}} -\item \href{#method-clone}{\code{StanMatrix$clone()}} -} -} -\if{html}{ -\out{
Inherited methods} -\itemize{ -\item \out{}\href{../../odemodeling/html/StanDeclaration.html#method-print}{\code{odemodeling::StanDeclaration$print()}}\out{} -} -\out{
} -} +\item \href{#method-StanMatrix-new}{\code{StanMatrix$new()}} +\item \href{#method-StanMatrix-declaration}{\code{StanMatrix$declaration()}} +\item \href{#method-StanMatrix-signature}{\code{StanMatrix$signature()}} +\item \href{#method-StanMatrix-can_be_made_parameter}{\code{StanMatrix$can_be_made_parameter()}} +\item \href{#method-StanMatrix-get_dims}{\code{StanMatrix$get_dims()}} +\item \href{#method-StanMatrix-clone}{\code{StanMatrix$clone()}} +} +} +\if{html}{\out{ +
Inherited methods + +
+}} \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-new}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanMatrix-new}{}}} \subsection{Method \code{new()}}{ Create a \link{StanMatrix} object. \subsection{Usage}{ @@ -64,8 +64,8 @@ Create a \link{StanMatrix} object. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-declaration}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanMatrix-declaration}{}}} \subsection{Method \code{declaration()}}{ Create a declaration for the matrix \subsection{Usage}{ @@ -77,8 +77,8 @@ a string } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-signature}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanMatrix-signature}{}}} \subsection{Method \code{signature()}}{ The variable when used in function signature \subsection{Usage}{ @@ -87,8 +87,8 @@ The variable when used in function signature } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-can_be_made_parameter}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanMatrix-can_be_made_parameter}{}}} \subsection{Method \code{can_be_made_parameter()}}{ Can the object be made into a parameter? \subsection{Usage}{ @@ -97,8 +97,8 @@ Can the object be made into a parameter? } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-get_dims}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanMatrix-get_dims}{}}} \subsection{Method \code{get_dims()}}{ Get all declared dimensions related to the object. \subsection{Usage}{ @@ -110,8 +110,8 @@ A list. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-clone}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanMatrix-clone}{}}} \subsection{Method \code{clone()}}{ The objects of this class are cloneable with this method. \subsection{Usage}{ diff --git a/man/StanParameter.Rd b/man/StanParameter.Rd index a59abf3..32e678a 100644 --- a/man/StanParameter.Rd +++ b/man/StanParameter.Rd @@ -20,14 +20,14 @@ A Stan parameter \section{Methods}{ \subsection{Public methods}{ \itemize{ -\item \href{#method-new}{\code{StanParameter$new()}} -\item \href{#method-print}{\code{StanParameter$print()}} -\item \href{#method-clone}{\code{StanParameter$clone()}} +\item \href{#method-StanParameter-new}{\code{StanParameter$new()}} +\item \href{#method-StanParameter-print}{\code{StanParameter$print()}} +\item \href{#method-StanParameter-clone}{\code{StanParameter$clone()}} } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-new}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanParameter-new}{}}} \subsection{Method \code{new()}}{ Create a \link{StanParameter} object. \subsection{Usage}{ @@ -45,8 +45,8 @@ Create a \link{StanParameter} object. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-print}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanParameter-print}{}}} \subsection{Method \code{print()}}{ Print \subsection{Usage}{ @@ -55,8 +55,8 @@ Print } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-clone}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanParameter-clone}{}}} \subsection{Method \code{clone()}}{ The objects of this class are cloneable with this method. \subsection{Usage}{ diff --git a/man/StanTransformation.Rd b/man/StanTransformation.Rd index 0e10d5f..b71e9a6 100644 --- a/man/StanTransformation.Rd +++ b/man/StanTransformation.Rd @@ -22,14 +22,14 @@ A Stan transformation \section{Methods}{ \subsection{Public methods}{ \itemize{ -\item \href{#method-new}{\code{StanTransformation$new()}} -\item \href{#method-print}{\code{StanTransformation$print()}} -\item \href{#method-clone}{\code{StanTransformation$clone()}} +\item \href{#method-StanTransformation-new}{\code{StanTransformation$new()}} +\item \href{#method-StanTransformation-print}{\code{StanTransformation$print()}} +\item \href{#method-StanTransformation-clone}{\code{StanTransformation$clone()}} } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-new}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanTransformation-new}{}}} \subsection{Method \code{new()}}{ Create a \link{StanTransformation} object. \subsection{Usage}{ @@ -52,8 +52,8 @@ added to the end if it is missing.} } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-print}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanTransformation-print}{}}} \subsection{Method \code{print()}}{ Print \subsection{Usage}{ @@ -62,8 +62,8 @@ Print } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-clone}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanTransformation-clone}{}}} \subsection{Method \code{clone()}}{ The objects of this class are cloneable with this method. \subsection{Usage}{ diff --git a/man/StanVariable.Rd b/man/StanVariable.Rd index 79e3e36..3983698 100644 --- a/man/StanVariable.Rd +++ b/man/StanVariable.Rd @@ -21,24 +21,24 @@ A Stan variable \section{Methods}{ \subsection{Public methods}{ \itemize{ -\item \href{#method-new}{\code{StanVariable$new()}} -\item \href{#method-declaration}{\code{StanVariable$declaration()}} -\item \href{#method-signature}{\code{StanVariable$signature()}} -\item \href{#method-can_be_made_parameter}{\code{StanVariable$can_be_made_parameter()}} -\item \href{#method-clone}{\code{StanVariable$clone()}} -} -} -\if{html}{ -\out{
Inherited methods} -\itemize{ -\item \out{}\href{../../odemodeling/html/StanDeclaration.html#method-get_dims}{\code{odemodeling::StanDeclaration$get_dims()}}\out{} -\item \out{}\href{../../odemodeling/html/StanDeclaration.html#method-print}{\code{odemodeling::StanDeclaration$print()}}\out{} -} -\out{
} -} +\item \href{#method-StanVariable-new}{\code{StanVariable$new()}} +\item \href{#method-StanVariable-declaration}{\code{StanVariable$declaration()}} +\item \href{#method-StanVariable-signature}{\code{StanVariable$signature()}} +\item \href{#method-StanVariable-can_be_made_parameter}{\code{StanVariable$can_be_made_parameter()}} +\item \href{#method-StanVariable-clone}{\code{StanVariable$clone()}} +} +} +\if{html}{\out{ +
Inherited methods + +
+}} \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-new}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanVariable-new}{}}} \subsection{Method \code{new()}}{ Create a \link{StanVariable} object. \subsection{Usage}{ @@ -60,8 +60,8 @@ Create a \link{StanVariable} object. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-declaration}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanVariable-declaration}{}}} \subsection{Method \code{declaration()}}{ Create a declaration for the variable \subsection{Usage}{ @@ -73,8 +73,8 @@ a string } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-signature}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanVariable-signature}{}}} \subsection{Method \code{signature()}}{ The variable when used in function signature \subsection{Usage}{ @@ -83,8 +83,8 @@ The variable when used in function signature } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-can_be_made_parameter}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanVariable-can_be_made_parameter}{}}} \subsection{Method \code{can_be_made_parameter()}}{ Can the object be made into a parameter? \subsection{Usage}{ @@ -93,8 +93,8 @@ Can the object be made into a parameter? } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-clone}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanVariable-clone}{}}} \subsection{Method \code{clone()}}{ The objects of this class are cloneable with this method. \subsection{Usage}{ diff --git a/man/StanVector.Rd b/man/StanVector.Rd index d8d3b19..12b7c03 100644 --- a/man/StanVector.Rd +++ b/man/StanVector.Rd @@ -21,24 +21,24 @@ A Stan vector \section{Methods}{ \subsection{Public methods}{ \itemize{ -\item \href{#method-new}{\code{StanVector$new()}} -\item \href{#method-declaration}{\code{StanVector$declaration()}} -\item \href{#method-signature}{\code{StanVector$signature()}} -\item \href{#method-can_be_made_parameter}{\code{StanVector$can_be_made_parameter()}} -\item \href{#method-get_dims}{\code{StanVector$get_dims()}} -\item \href{#method-clone}{\code{StanVector$clone()}} -} -} -\if{html}{ -\out{
Inherited methods} -\itemize{ -\item \out{}\href{../../odemodeling/html/StanDeclaration.html#method-print}{\code{odemodeling::StanDeclaration$print()}}\out{} -} -\out{
} -} +\item \href{#method-StanVector-new}{\code{StanVector$new()}} +\item \href{#method-StanVector-declaration}{\code{StanVector$declaration()}} +\item \href{#method-StanVector-signature}{\code{StanVector$signature()}} +\item \href{#method-StanVector-can_be_made_parameter}{\code{StanVector$can_be_made_parameter()}} +\item \href{#method-StanVector-get_dims}{\code{StanVector$get_dims()}} +\item \href{#method-StanVector-clone}{\code{StanVector$clone()}} +} +} +\if{html}{\out{ +
Inherited methods + +
+}} \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-new}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanVector-new}{}}} \subsection{Method \code{new()}}{ Create a \link{StanVector} object. \subsection{Usage}{ @@ -60,8 +60,8 @@ Create a \link{StanVector} object. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-declaration}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanVector-declaration}{}}} \subsection{Method \code{declaration()}}{ Create a declaration for the vector \subsection{Usage}{ @@ -73,8 +73,8 @@ a string } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-signature}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanVector-signature}{}}} \subsection{Method \code{signature()}}{ The variable when used in function signature \subsection{Usage}{ @@ -83,8 +83,8 @@ The variable when used in function signature } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-can_be_made_parameter}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanVector-can_be_made_parameter}{}}} \subsection{Method \code{can_be_made_parameter()}}{ Can the object be made into a parameter? \subsection{Usage}{ @@ -93,8 +93,8 @@ Can the object be made into a parameter? } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-get_dims}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanVector-get_dims}{}}} \subsection{Method \code{get_dims()}}{ Get all declared dimensions related to the object. \subsection{Usage}{ @@ -106,8 +106,8 @@ A list. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-clone}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanVector-clone}{}}} \subsection{Method \code{clone()}}{ The objects of this class are cloneable with this method. \subsection{Usage}{ diff --git a/man/StanVectorArray.Rd b/man/StanVectorArray.Rd index 2c28d74..32b1563 100644 --- a/man/StanVectorArray.Rd +++ b/man/StanVectorArray.Rd @@ -23,24 +23,24 @@ A Stan array of vectors \section{Methods}{ \subsection{Public methods}{ \itemize{ -\item \href{#method-new}{\code{StanVectorArray$new()}} -\item \href{#method-declaration}{\code{StanVectorArray$declaration()}} -\item \href{#method-signature}{\code{StanVectorArray$signature()}} -\item \href{#method-can_be_made_parameter}{\code{StanVectorArray$can_be_made_parameter()}} -\item \href{#method-get_dims}{\code{StanVectorArray$get_dims()}} -\item \href{#method-clone}{\code{StanVectorArray$clone()}} -} -} -\if{html}{ -\out{
Inherited methods} -\itemize{ -\item \out{}\href{../../odemodeling/html/StanDeclaration.html#method-print}{\code{odemodeling::StanDeclaration$print()}}\out{} -} -\out{
} -} +\item \href{#method-StanVectorArray-new}{\code{StanVectorArray$new()}} +\item \href{#method-StanVectorArray-declaration}{\code{StanVectorArray$declaration()}} +\item \href{#method-StanVectorArray-signature}{\code{StanVectorArray$signature()}} +\item \href{#method-StanVectorArray-can_be_made_parameter}{\code{StanVectorArray$can_be_made_parameter()}} +\item \href{#method-StanVectorArray-get_dims}{\code{StanVectorArray$get_dims()}} +\item \href{#method-StanVectorArray-clone}{\code{StanVectorArray$clone()}} +} +} +\if{html}{\out{ +
Inherited methods + +
+}} \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-new}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanVectorArray-new}{}}} \subsection{Method \code{new()}}{ Create a \link{StanVectorArray} object. \subsection{Usage}{ @@ -65,8 +65,8 @@ Create a \link{StanVectorArray} object. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-declaration}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanVectorArray-declaration}{}}} \subsection{Method \code{declaration()}}{ Create a declaration for the array of vectors \subsection{Usage}{ @@ -78,8 +78,8 @@ a string } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-signature}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanVectorArray-signature}{}}} \subsection{Method \code{signature()}}{ The variable when used in function signature \subsection{Usage}{ @@ -88,8 +88,8 @@ The variable when used in function signature } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-can_be_made_parameter}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanVectorArray-can_be_made_parameter}{}}} \subsection{Method \code{can_be_made_parameter()}}{ Can the object be made into a parameter? \subsection{Usage}{ @@ -98,8 +98,8 @@ Can the object be made into a parameter? } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-get_dims}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanVectorArray-get_dims}{}}} \subsection{Method \code{get_dims()}}{ Get all declared dimensions related to the object. \subsection{Usage}{ @@ -111,8 +111,8 @@ A list. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-clone}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-StanVectorArray-clone}{}}} \subsection{Method \code{clone()}}{ The objects of this class are cloneable with this method. \subsection{Usage}{ diff --git a/man/compare_odefits.Rd b/man/compare_odefits.Rd index 42a233c..165cbbc 100644 --- a/man/compare_odefits.Rd +++ b/man/compare_odefits.Rd @@ -37,21 +37,21 @@ Compare two objects that contain ODE solutions and ODE model likelihoods } \section{Functions}{ \itemize{ -\item \code{max_abs_odesol_diff}: Compute maximum absolute difference in +\item \code{max_abs_odesol_diff()}: Compute maximum absolute difference in ODE solutions of \code{x} and \code{y}. -\item \code{max_abs_loglik_diff}: Compute maximum absolute differences in +\item \code{max_abs_loglik_diff()}: Compute maximum absolute differences in log likelihoods of \code{x} and \code{y}. -\item \code{log_ratios}: Compute log likelihood ratios (on log scale), +\item \code{log_ratios()}: Compute log likelihood ratios (on log scale), i.e. just \code{x$loglik() - y$loglik()}. -\item \code{psis_relative_eff}: Compute relative efficiency needed for PSIS, +\item \code{psis_relative_eff()}: Compute relative efficiency needed for PSIS, using \code{\link[loo:relative_eff]{loo::relative_eff()}}. -\item \code{psis}: Call \code{\link[loo:psis]{loo::psis()}} using the log likelihoods +\item \code{psis()}: Call \code{\link[loo:psis]{loo::psis()}} using the log likelihoods from \code{x} and \code{y}. -\item \code{compute_reliability_metrics}: Compute all metrics. -}} +\item \code{compute_reliability_metrics()}: Compute all metrics. +}} diff --git a/man/odemodeling-package.Rd b/man/odemodeling-package.Rd index fbd4fb8..e17ddbb 100644 --- a/man/odemodeling-package.Rd +++ b/man/odemodeling-package.Rd @@ -54,6 +54,35 @@ different ODE model simulations and fits. } } +\section{Importance sampling for reliable and efficient inference in Bayesian ODE models}{ + +Our proposed workflow is to +\enumerate{ +\item Select an initial ODE solver M. +\item Sample the parameter posterior using MCMC with M as the ODE solver. +\item Compute certain metrics using a more accurate solver M∗. +\item Increase the accuracy of M∗ and repeat Step 3 until the metrics converge. +If the Pareto-k metric converges to a value larger than 0.7, increase the accuracy +of M and go back to Step 2. +\item Compute any posterior estimates using final importance weights. See +Timonen et al. (2022) below. +} +The algorithm can be used to validate the reliability, and correct the errors +of a given method M, which can be for example a software default. On the other hand, +a smart initial selection of M can provide speed gains +compared to often rather conservatively set software defaults, while still maintaining +reliability of the inferences. + +We generally recommend selecting M initially so that sampling is as fast as possible. +For example, for non-adaptive ODE solvers, one can first try using the smallest +sensible number of steps that does not result in immediate failure. +Selecting a good M is more difficult in the case of adaptive solvers. +We have +observed that tolerances on the order of 1e-4 to 1e-3 generally work well. + +See the \code{reliability()} method of the \code{\link{OdeModelMCMC}} class. +} + \section{Tutorial}{ See the tutorial vignette. diff --git a/man/odesolvers.Rd b/man/odesolvers.Rd index 44f54c1..ba3adf6 100644 --- a/man/odesolvers.Rd +++ b/man/odesolvers.Rd @@ -54,20 +54,20 @@ steps between consequent output time points } \section{Functions}{ \itemize{ -\item \code{rk45}: Create an RK45 solver (\link{AdaptiveOdeSolver}) +\item \code{rk45()}: Create an RK45 solver (\link{AdaptiveOdeSolver}) -\item \code{bdf}: Create a BDF solver (\link{AdaptiveOdeSolver}) +\item \code{bdf()}: Create a BDF solver (\link{AdaptiveOdeSolver}) -\item \code{adams}: Create an Adams solver (\link{AdaptiveOdeSolver}) +\item \code{adams()}: Create an Adams solver (\link{AdaptiveOdeSolver}) -\item \code{ckrk}: Create a Cash-Karp solver (\link{AdaptiveOdeSolver}). +\item \code{ckrk()}: Create a Cash-Karp solver (\link{AdaptiveOdeSolver}). -\item \code{euler}: Create a forward Euler solver +\item \code{euler()}: Create a forward Euler solver (\link{FixedNumStepsOdeSolver}) -\item \code{midpoint}: Create an explicit midpoint solver +\item \code{midpoint()}: Create an explicit midpoint solver (\link{FixedNumStepsOdeSolver}) -\item \code{rk4}: Create an RK4 solver (\link{FixedNumStepsOdeSolver}) -}} +\item \code{rk4()}: Create an RK4 solver (\link{FixedNumStepsOdeSolver}) +}} diff --git a/man/odesolvers_lists.Rd b/man/odesolvers_lists.Rd index a6abd82..77fad33 100644 --- a/man/odesolvers_lists.Rd +++ b/man/odesolvers_lists.Rd @@ -31,16 +31,16 @@ Each function here returns a list of \link{OdeSolver}s. } \section{Functions}{ \itemize{ -\item \code{rk45_list}: Create a list of RK45 solvers with different +\item \code{rk45_list()}: Create a list of RK45 solvers with different tolerances. -\item \code{bdf_list}: Create a list of BDF solvers with +\item \code{bdf_list()}: Create a list of BDF solvers with different tolerances. -\item \code{midpoint_list}: Create a list of explicit midpoint +\item \code{midpoint_list()}: Create a list of explicit midpoint solvers with different fixed number of steps. -\item \code{rk4_list}: Create a list of RK4 +\item \code{rk4_list()}: Create a list of RK4 solvers with different fixed number of steps. -}} +}} diff --git a/man/plot_metric.Rd b/man/plot_metric.Rd index 84d4724..0761d98 100644 --- a/man/plot_metric.Rd +++ b/man/plot_metric.Rd @@ -38,12 +38,12 @@ Either \code{tols} or \code{num_steps} has to be \code{NULL}. } \section{Functions}{ \itemize{ -\item \code{plot_metric}: Plot a generic metric. +\item \code{plot_metric()}: Plot a generic metric. -\item \code{plot_pareto_k}: Plot pareto-k metric. +\item \code{plot_pareto_k()}: Plot pareto-k metric. -\item \code{plot_r_eff}: Plot relative efficiency. +\item \code{plot_r_eff()}: Plot relative efficiency. -\item \code{plot_mad}: Plot maximum absolute difference. -}} +\item \code{plot_mad()}: Plot maximum absolute difference. +}} diff --git a/tests/testthat/test-main_declarations.R b/tests/testthat/test-main_declarations.R index 6e9d6cc..16aa8bf 100644 --- a/tests/testthat/test-main_declarations.R +++ b/tests/testthat/test-main_declarations.R @@ -1,4 +1,3 @@ - test_that("stan_dim() works correctly", { N <- stan_dim("N") M <- stan_dim("M", lower = 1, upper = 100) diff --git a/tests/testthat/test-workflow-tmdd.R b/tests/testthat/test-workflow-tmdd.R index da3e4e7..4b5aa27 100644 --- a/tests/testthat/test-workflow-tmdd.R +++ b/tests/testthat/test-workflow-tmdd.R @@ -1,5 +1,4 @@ test_that("tmdd example can generate quantities", { - # Create model tmdd <- example_ode_model(name = "tmdd", prior_only = TRUE) expect_false(tmdd$has_likelihood) diff --git a/vignettes/tutorial.Rmd b/vignettes/tutorial.Rmd index 60b1ea3..f0f3308 100644 --- a/vignettes/tutorial.Rmd +++ b/vignettes/tutorial.Rmd @@ -55,23 +55,24 @@ We need to define the variable for the initial system state at `t0` as `y0`. The ODE system dimension is declared as `D` and number of time points as `N`. ```{r sho_dims} -N <- stan_dim("N", lower=1) +N <- stan_dim("N", lower = 1) D <- stan_dim("D") y0 <- stan_vector("y0", length = D) -k <- stan_param(stan_var("k", lower=0), "inv_gamma(5, 1)") +k <- stan_param(stan_var("k", lower = 0), "inv_gamma(5, 1)") ``` Finally we declare the parameter `k` and its prior. ```{r sho_param} -k <- stan_param(stan_var("k", lower=0), prior = "inv_gamma(5, 1)") +k <- stan_param(stan_var("k", lower = 0), prior = "inv_gamma(5, 1)") ``` The following code creates and compiles the Stan model. ```{r sho_create_prior} sho <- ode_model(N, - odefun_vars = list(k), - odefun_body = sho_fun_body, - odefun_init = y0) + odefun_vars = list(k), + odefun_body = sho_fun_body, + odefun_init = y0 +) print(sho) ``` As we see, all variables that affect the function $f_{\psi}$ need to be given @@ -90,8 +91,8 @@ We could call `print(sho$stanmodel)` to see the entire generated Stan model code We can sample from the prior distribution of model parameters like so. ```{r sho_prior_sample} -sho_fit_prior <- sho$sample( - t0 = 0.0, +sho_fit_prior <- sho$sample( + t0 = 0.0, t = seq(0.1, 10, by = 0.1), data = list(y0 = c(1, 0), D = 2), refresh = 0, @@ -134,11 +135,11 @@ We generate quantities using a different `solver` and different output time poin the last two take a fixed number of steps and are written in Stan code. ```{r sho_gq_bdf, fig.width=6.5, fig.height=3.2} -gq_bdf <- sho_fit_prior$gqs(solver = bdf(tol=1e-4), t = seq(0.5, 10, by = 0.5)) +gq_bdf <- sho_fit_prior$gqs(solver = bdf(tol = 1e-4), t = seq(0.5, 10, by = 0.5)) ``` ```{r sho_gq_mp, fig.width=6.5, fig.height=3.2} -gq_mp <- sho_fit_prior$gqs(solver = midpoint(num_steps=4), t = seq(0.5, 10, by = 0.5)) +gq_mp <- sho_fit_prior$gqs(solver = midpoint(num_steps = 4), t = seq(0.5, 10, by = 0.5)) ``` We can again plot ODE solution using one draw like so @@ -171,18 +172,19 @@ having to declare them or write Stan code that computes them: Here we define as `loglik_vars` a `sigma` which is a noise magnitude parameter, and the data `y1_obs`. Notice that we can also use the `N` variable in `loglik_body`, because it is a dimension (length) of `y1_obs`. ```{r sho_loglik_vars} -sigma <- stan_param(stan_var("sigma", lower=0), prior="normal(0, 2)") -y1_obs <- stan_vector("y1_obs", length=N) +sigma <- stan_param(stan_var("sigma", lower = 0), prior = "normal(0, 2)") +y1_obs <- stan_vector("y1_obs", length = N) ``` The following code creates and compiles the posterior Stan model. ```{r sho_create} sho_post <- ode_model(N, - odefun_vars = list(k), - odefun_body = sho_fun_body, - odefun_init = y0, - loglik_vars = list(sigma, y1_obs), - loglik_body = sho_loglik_body) + odefun_vars = list(k), + odefun_body = sho_fun_body, + odefun_init = y0, + loglik_vars = list(sigma, y1_obs), + loglik_body = sho_loglik_body +) print(sho_post) ``` @@ -190,15 +192,17 @@ print(sho_post) Now if we have some data ```{r sho_data} -y1_obs <- c(0.801, 0.391, 0.321, -0.826, -0.234, -0.663, -0.756, -0.717, --0.078, -0.083, 0.988, 0.878, 0.300, 0.307, 0.270, -0.464, -0.403, --0.295, -0.186, 0.158) +y1_obs <- c( + 0.801, 0.391, 0.321, -0.826, -0.234, -0.663, -0.756, -0.717, + -0.078, -0.083, 0.988, 0.878, 0.300, 0.307, 0.270, -0.464, -0.403, + -0.295, -0.186, 0.158 +) t_obs <- seq(0.5, 10, by = 0.5) ``` and assume that initial state `y0 = c(1, 0)` is known, we can fit the model ```{r sho_fit_post} -sho_fit_post <- sho_post$sample( - t0 = 0.0, +sho_fit_post <- sho_post$sample( + t0 = 0.0, t = t_obs, data = list(y0 = c(1, 0), D = 2, y1_obs = y1_obs), refresh = 0, @@ -209,10 +213,10 @@ sho_fit_post <- sho_post$sample( We fit the posterior distribution of ODE solutions against the data ```{r sho_post_plot, fig.width=6.5, fig.height=3.2} plt <- sho_fit_post$plot_odesol_dist() -df_data <- data.frame(t_obs, y1_obs, ydim=rep("y1", length(t_obs))) +df_data <- data.frame(t_obs, y1_obs, ydim = rep("y1", length(t_obs))) colnames(df_data) <- c("t", "y", "ydim") df_data$ydim <- as.factor(df_data$ydim) -plt <- plt + geom_point(data=df_data, aes(x=t,y=y), inherit.aes=FALSE) +plt <- plt + geom_point(data = df_data, aes(x = t, y = y), inherit.aes = FALSE) plt ``` @@ -221,7 +225,7 @@ plt Finally we can study whether the solver we used during MCMC (`midpoint(2)`) was accurate enough. This is done by solving the system using increasingly more numbers of steps in the solver, and studying different metrics computed using the ODE solutions and corresponding likelihood values. ```{r sho_rel} -solvers <- midpoint_list(c(4,6,8,10,12,14,16,18)) +solvers <- midpoint_list(c(4, 6, 8, 10, 12, 14, 16, 18)) rel <- sho_fit_post$reliability(solvers = solvers) print(rel$metrics) unlink("results")