From 70a1cef56ed6968ce21ffbf2f6392ae9b15a0645 Mon Sep 17 00:00:00 2001 From: Tahmina Mojumder Date: Fri, 25 Aug 2023 10:03:34 +0200 Subject: [PATCH 1/3] Updated help file for BayesianTools.R --- BayesianTools/R/BayesianTools.R | 70 ++++++++++++++++++++++----------- 1 file changed, 46 insertions(+), 24 deletions(-) diff --git a/BayesianTools/R/BayesianTools.R b/BayesianTools/R/BayesianTools.R index 3b79b19..cc51001 100644 --- a/BayesianTools/R/BayesianTools.R +++ b/BayesianTools/R/BayesianTools.R @@ -1,25 +1,47 @@ -#' @title BayesianTools -#' @name BayesianTools -#' @docType package -#' @useDynLib BayesianTools, .registration = TRUE -#' @description A package with general-purpose MCMC and SMC samplers, as well as plots and diagnostic functions for Bayesian statistics -#' @details A package with general-purpose MCMC and SMC samplers, as well as plots and diagnostic functions for Bayesian statistics, particularly for process-based models. -#' -#' The package contains 2 central functions, \code{\link{createBayesianSetup}}, which creates a standardized Bayesian setup with likelihood and priors, and \code{\link{runMCMC}}, which allows to run various MCMC and SMC samplers. -#' -#' The package can of course also be used for general (non-Bayesian) target functions. -#' -#' To use the package, a first step is to use \code{\link{createBayesianSetup}} to create a BayesianSetup, which usually contains prior and likelihood densities, or in general a target function. -#' -#' Those can be sampled with \code{\link{runMCMC}}, which can call a number of general purpose Metropolis sampler, including the \code{\link{Metropolis}} that allows to specify various popular Metropolis variants such as adaptive and/or delayed rejection Metropolis; two variants of differential evolution MCMC \code{\link{DE}}, \code{\link{DEzs}}, two variants of DREAM \code{\link{DREAM}} and \code{\link{DREAMzs}}, the \code{\link{Twalk}} MCMC, and a Sequential Monte Carlo sampler \code{\link{smcSampler}}. -#' -#' The output of runMCMC is of class mcmcSampler / smcSampler if one run is performed, or mcmcSamplerList / smcSamplerList if several sampler are run. Various functions are available for plotting, model comparison (DIC, marginal likelihood), or to use the output as a new prior. -#' -#' For details on how to use the packgage, run vignette("BayesianTools", package="BayesianTools"). -#' -#' To get the suggested citation, run citation("BayesianTools") -#' -#' To report bugs or ask for help, post a \href{https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example}{reproducible example} via the BayesianTools \href{https://github.com/florianhartig/BayesianTools/issues}{issue tracker} on GitHub. -#' -#'Acknowledgements: The creation and maintenance of this package profited from funding and collaboration through Cost Action FP 1304 PROFOUND, DFG DO 786/12-1 CONECT, EU FP7 ERA-NET Sumforest REFORCE and Bayklif Project BLIZ. +#' @title BayesianTools +#' @name BayesianTools +#' @docType package +#' @useDynLib BayesianTools, .registration = TRUE +#' @description This package contains general-purpose Markov Chain Monte Carlo +#' (MCMC) and Sequential Monte Carlo (SMC) samplers, along with diagnostic +#' functions and plots used for Bayesian statistics. +#' @details This package works particularly for process-based models. +#' +#' The package includes two primary functions, \code{\link{createBayesianSetup}}, +#' which creates a standardized Bayesian setup with likelihood and priors, and +#' \code{\link{runMCMC}}, which allows various MCMC and SMC samplers to be run. +#' +#' Additionally, the package can be used for general (non-Bayesian) target +#' functions. +#' +#' To use this package, start by creating a BayesianSetup using +#' \code{\link{createBayesianSetup}}. Generally, a BayesianSetup contains priors +#' and likelihood densities, or in general, a target function. +#' +#' You can sample with \code{\link{runMCMC}} function. This function can call +#' several general +#' purpose Metropolis samplers including the \code{\link{Metropolis}}. This +#' function allows you to specify various popular Metropolis variants such as +#' adaptive and/or delayed rejection Metropolis; two variants of differential +#' evolution MCMC - \code{\link{DE}} and \code{\link{DEzs}}, two variants of DREAM - +#' \code{\link{DREAM}} and \code{\link{DREAMzs}}, the \code{\link{Twalk}} MCMC, +#' and a Sequential Monte Carlo sampler \code{\link{smcSampler}}. +#' +#' If a single run is performed, the output of runMCMC is of class mcmcSampler / +#' smcSampler, otherwise, it would be of class mcmcSamplerList / smcSamplerList. +#' To plot, compare models (DIC, marginal likelihood) or use the output as a +#' new prior, several functions are available. +#' +#' To learn how to use the package, run the following command: +#' vignette("BayesianTools", package="BayesianTools"). +#' +#' Run citation("BayesianTools") to cite the package. +#' +#' To report bugs or ask for help, post at +#' \href{https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example}{reproducible example} +#' via the BayesianTools \href{https://github.com/florianhartig/BayesianTools/issues}{issue tracker} +#' on GitHub. +#' +#'Acknowledgements: The creation and maintenance of this package profited from +#'funding and collaboration through Cost Action FP 1304 PROFOUND, DFG DO 786/12-1 CONECT, EU FP7 ERA-NET Sumforest REFORCE and Bayklif Project BLIZ. NULL \ No newline at end of file From 99e0777254123143d5919d504acf944fbb4607c9 Mon Sep 17 00:00:00 2001 From: TahminaMojumder Date: Wed, 25 Oct 2023 15:15:24 +0200 Subject: [PATCH 2/3] update --- BayesianTools/man/BayesianTools.Rd | 44 +++++++++++++++++------ BayesianTools/vignettes/BayesianTools.Rmd | 1 + 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/BayesianTools/man/BayesianTools.Rd b/BayesianTools/man/BayesianTools.Rd index 2c5f317..26f307f 100644 --- a/BayesianTools/man/BayesianTools.Rd +++ b/BayesianTools/man/BayesianTools.Rd @@ -5,26 +5,48 @@ \alias{BayesianTools} \title{BayesianTools} \description{ -A package with general-purpose MCMC and SMC samplers, as well as plots and diagnostic functions for Bayesian statistics +This package contains general-purpose Markov Chain Monte Carlo +(MCMC) and Sequential Monte Carlo (SMC) samplers, along with diagnostic +functions and plots used for Bayesian statistics. } \details{ -A package with general-purpose MCMC and SMC samplers, as well as plots and diagnostic functions for Bayesian statistics, particularly for process-based models. +This package works particularly for process-based models. -The package contains 2 central functions, \code{\link{createBayesianSetup}}, which creates a standardized Bayesian setup with likelihood and priors, and \code{\link{runMCMC}}, which allows to run various MCMC and SMC samplers. +The package includes two primary functions, \code{\link{createBayesianSetup}}, +which creates a standardized Bayesian setup with likelihood and priors, and +\code{\link{runMCMC}}, which allows various MCMC and SMC samplers to be run. -The package can of course also be used for general (non-Bayesian) target functions. +Additionally, the package can be used for general (non-Bayesian) target +functions. -To use the package, a first step is to use \code{\link{createBayesianSetup}} to create a BayesianSetup, which usually contains prior and likelihood densities, or in general a target function. +To use this package, start by creating a BayesianSetup using +\code{\link{createBayesianSetup}}. Generally, a BayesianSetup contains priors +and likelihood densities, or in general, a target function. -Those can be sampled with \code{\link{runMCMC}}, which can call a number of general purpose Metropolis sampler, including the \code{\link{Metropolis}} that allows to specify various popular Metropolis variants such as adaptive and/or delayed rejection Metropolis; two variants of differential evolution MCMC \code{\link{DE}}, \code{\link{DEzs}}, two variants of DREAM \code{\link{DREAM}} and \code{\link{DREAMzs}}, the \code{\link{Twalk}} MCMC, and a Sequential Monte Carlo sampler \code{\link{smcSampler}}. +You can sample with \code{\link{runMCMC}} function. This function can call +several general +purpose Metropolis samplers including the \code{\link{Metropolis}}. This +function allows you to specify various popular Metropolis variants such as +adaptive and/or delayed rejection Metropolis; two variants of differential +evolution MCMC - \code{\link{DE}} and \code{\link{DEzs}}, two variants of DREAM - +\code{\link{DREAM}} and \code{\link{DREAMzs}}, the \code{\link{Twalk}} MCMC, +and a Sequential Monte Carlo sampler \code{\link{smcSampler}}. -The output of runMCMC is of class mcmcSampler / smcSampler if one run is performed, or mcmcSamplerList / smcSamplerList if several sampler are run. Various functions are available for plotting, model comparison (DIC, marginal likelihood), or to use the output as a new prior. +If a single run is performed, the output of runMCMC is of class mcmcSampler / +smcSampler, otherwise, it would be of class mcmcSamplerList / smcSamplerList. +To plot, compare models (DIC, marginal likelihood) or use the output as a +new prior, several functions are available. -For details on how to use the packgage, run vignette("BayesianTools", package="BayesianTools"). +To learn how to use the package, run the following command: +vignette("BayesianTools", package="BayesianTools"). -To get the suggested citation, run citation("BayesianTools") +Run citation("BayesianTools") to cite the package. -To report bugs or ask for help, post a \href{https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example}{reproducible example} via the BayesianTools \href{https://github.com/florianhartig/BayesianTools/issues}{issue tracker} on GitHub. +To report bugs or ask for help, post at +\href{https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example}{reproducible example} +via the BayesianTools \href{https://github.com/florianhartig/BayesianTools/issues}{issue tracker} +on GitHub. -Acknowledgements: The creation and maintenance of this package profited from funding and collaboration through Cost Action FP 1304 PROFOUND, DFG DO 786/12-1 CONECT, EU FP7 ERA-NET Sumforest REFORCE and Bayklif Project BLIZ. +Acknowledgements: The creation and maintenance of this package profited from +funding and collaboration through Cost Action FP 1304 PROFOUND, DFG DO 786/12-1 CONECT, EU FP7 ERA-NET Sumforest REFORCE and Bayklif Project BLIZ. } diff --git a/BayesianTools/vignettes/BayesianTools.Rmd b/BayesianTools/vignettes/BayesianTools.Rmd index cdffad7..3480d91 100644 --- a/BayesianTools/vignettes/BayesianTools.Rmd +++ b/BayesianTools/vignettes/BayesianTools.Rmd @@ -63,6 +63,7 @@ The central object in the BT package is the BayesianSetup. This class contains t A BayesianSetup is created by the createBayesianSetup function. The function expects a log-likelihood and (optional) a log-prior. It then automatically creates the posterior and various convenience functions for the samplers. Advantages of the BayesianSetup include + 1. support for automatic parallelization 2. functions are wrapped in try-catch statements to avoid crashes during long MCMC evaluations 3. and the posterior checks if the parameter is outside the prior first, in which case the likelihood is not evaluated (makes the algorithms faster for slow likelihoods). From f3d9da2a59cef065485af7ff1d262f4865fbd596 Mon Sep 17 00:00:00 2001 From: TahminaMojumder Date: Fri, 27 Oct 2023 12:39:52 +0200 Subject: [PATCH 3/3] removed white space --- BayesianTools/R/BayesianTools.R | 93 +++++++++++++++++---------------- 1 file changed, 47 insertions(+), 46 deletions(-) diff --git a/BayesianTools/R/BayesianTools.R b/BayesianTools/R/BayesianTools.R index cc51001..11a457a 100644 --- a/BayesianTools/R/BayesianTools.R +++ b/BayesianTools/R/BayesianTools.R @@ -1,47 +1,48 @@ -#' @title BayesianTools -#' @name BayesianTools -#' @docType package -#' @useDynLib BayesianTools, .registration = TRUE -#' @description This package contains general-purpose Markov Chain Monte Carlo -#' (MCMC) and Sequential Monte Carlo (SMC) samplers, along with diagnostic -#' functions and plots used for Bayesian statistics. -#' @details This package works particularly for process-based models. -#' -#' The package includes two primary functions, \code{\link{createBayesianSetup}}, -#' which creates a standardized Bayesian setup with likelihood and priors, and -#' \code{\link{runMCMC}}, which allows various MCMC and SMC samplers to be run. -#' -#' Additionally, the package can be used for general (non-Bayesian) target -#' functions. -#' -#' To use this package, start by creating a BayesianSetup using -#' \code{\link{createBayesianSetup}}. Generally, a BayesianSetup contains priors -#' and likelihood densities, or in general, a target function. -#' -#' You can sample with \code{\link{runMCMC}} function. This function can call -#' several general -#' purpose Metropolis samplers including the \code{\link{Metropolis}}. This -#' function allows you to specify various popular Metropolis variants such as -#' adaptive and/or delayed rejection Metropolis; two variants of differential -#' evolution MCMC - \code{\link{DE}} and \code{\link{DEzs}}, two variants of DREAM - -#' \code{\link{DREAM}} and \code{\link{DREAMzs}}, the \code{\link{Twalk}} MCMC, -#' and a Sequential Monte Carlo sampler \code{\link{smcSampler}}. -#' -#' If a single run is performed, the output of runMCMC is of class mcmcSampler / -#' smcSampler, otherwise, it would be of class mcmcSamplerList / smcSamplerList. -#' To plot, compare models (DIC, marginal likelihood) or use the output as a -#' new prior, several functions are available. -#' -#' To learn how to use the package, run the following command: -#' vignette("BayesianTools", package="BayesianTools"). -#' -#' Run citation("BayesianTools") to cite the package. -#' -#' To report bugs or ask for help, post at -#' \href{https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example}{reproducible example} -#' via the BayesianTools \href{https://github.com/florianhartig/BayesianTools/issues}{issue tracker} -#' on GitHub. -#' -#'Acknowledgements: The creation and maintenance of this package profited from -#'funding and collaboration through Cost Action FP 1304 PROFOUND, DFG DO 786/12-1 CONECT, EU FP7 ERA-NET Sumforest REFORCE and Bayklif Project BLIZ. + +#' @title BayesianTools +#' @name BayesianTools +#' @docType package +#' @useDynLib BayesianTools, .registration = TRUE +#' @description This package contains general-purpose Markov Chain Monte Carlo +#' (MCMC) and Sequential Monte Carlo (SMC) samplers, along with diagnostic +#' functions and plots used for Bayesian statistics. +#' @details This package works particularly for process-based models. +#' +#' The package includes two primary functions, \code{\link{createBayesianSetup}}, +#' which creates a standardized Bayesian setup with likelihood and priors, and +#' \code{\link{runMCMC}}, which allows various MCMC and SMC samplers to be run. +#' +#' Additionally, the package can be used for general (non-Bayesian) target +#' functions. +#' +#' To use this package, start by creating a BayesianSetup using +#' \code{\link{createBayesianSetup}}. Generally, a BayesianSetup contains priors +#' and likelihood densities, or in general, a target function. +#' +#' You can sample with \code{\link{runMCMC}} function. This function can call +#' several general +#' purpose Metropolis samplers including the \code{\link{Metropolis}}. This +#' function allows you to specify various popular Metropolis variants such as +#' adaptive and/or delayed rejection Metropolis; two variants of differential +#' evolution MCMC - \code{\link{DE}} and \code{\link{DEzs}}, two variants of DREAM - +#' \code{\link{DREAM}} and \code{\link{DREAMzs}}, the \code{\link{Twalk}} MCMC, +#' and a Sequential Monte Carlo sampler \code{\link{smcSampler}}. +#' +#' If a single run is performed, the output of runMCMC is of class mcmcSampler / +#' smcSampler, otherwise, it would be of class mcmcSamplerList / smcSamplerList. +#' To plot, compare models (DIC, marginal likelihood) or use the output as a +#' new prior, several functions are available. +#' +#' To learn how to use the package, run the following command: +#' vignette("BayesianTools", package="BayesianTools"). +#' +#' Run citation("BayesianTools") to cite the package. +#' +#' To report bugs or ask for help, post at +#' \href{https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example}{reproducible example} +#' via the BayesianTools \href{https://github.com/florianhartig/BayesianTools/issues}{issue tracker} +#' on GitHub. +#' +#'Acknowledgements: The creation and maintenance of this package profited from +#'funding and collaboration through Cost Action FP 1304 PROFOUND, DFG DO 786/12-1 CONECT, EU FP7 ERA-NET Sumforest REFORCE and Bayklif Project BLIZ. NULL \ No newline at end of file