diff --git a/DESCRIPTION b/DESCRIPTION index 3ea67e82..ba457a30 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: pomp Type: Package Title: Statistical Inference for Partially Observed Markov Processes -Version: 5.11.0.0 -Date: 2024-09-11 +Version: 5.11.0.1 +Date: 2024-10-04 Authors@R: c(person(given=c("Aaron","A."),family="King",role=c("aut","cre"),email="kingaa@umich.edu",comment=c(ORCID="0000-0001-6159-3207")), person(given=c("Edward","L."),family="Ionides",role="aut",comment=c(ORCID="0000-0002-4190-0174")) , person(given="Carles",family="Bretó",role="aut",comment=c(ORCID="0000-0003-4695-4902")), diff --git a/R/accumulators.R b/R/accumulators.R index 003da556..c9ccba7a 100644 --- a/R/accumulators.R +++ b/R/accumulators.R @@ -6,13 +6,13 @@ ##' @rdname accumvars ##' @family implementation information ##' @seealso \code{\link{sir}} -##' ##' @details ##' In formulating models, one sometimes wishes to define a state variable that will accumulate some quantity over the interval between successive observations. ##' \pkg{pomp} provides a facility to make such features more convenient. -##' Specifically, variables named in the \code{pomp}'s \code{accumvars} argument will be set to zero immediately following each observation. -##' See \code{\link{sir}} and the tutorials on the \href{https://kingaa.github.io/pomp/}{package website} for examples. -##' +##' Specifically, if \eqn{a} is a state-variable named in the \code{pomp}'s \code{accumvars} argument, then for each interval \eqn{(t_k,t_{k+1})}{(t[k],t[k+1])}, \eqn{k=0,1,2,\dots}, \eqn{a} will be set to zero at prior to any \code{\link{rprocess}} computation over that interval. +##' Deterministic trajectory computation is handled slightly differently: +##' see \code{\link{flow}}. +##' For examples, see \code{\link{sir}} and the tutorials on the \href{https://kingaa.github.io/pomp/}{package website}. ##' @example examples/accumulators.R ##' NULL diff --git a/R/flow.R b/R/flow.R index bb6b35cb..e1884ab6 100644 --- a/R/flow.R +++ b/R/flow.R @@ -29,7 +29,11 @@ ##' @return ##' \code{flow} returns an array of dimensions \code{nvar} x \code{nrep} x \code{ntimes}. ##' If \code{x} is the returned matrix, \code{x[i,j,k]} is the i-th component of the state vector at time \code{times[k]} given parameters \code{params[,j]}. -##' +##' @section Accumulator variables: +##' When there are accumulator variables (as determined by the \code{\link{accumvars}} argument), their handling in the continuous-time (vectorfield) case differs from that in the discrete-time (map) case. +##' In the latter, accumulator variables are set to zero at the beginning of each interval \eqn{(t_k,t_{k+1})}{(t[k],t[k+1])}, \eqn{k=0,1,2,\dots} over which flow computation is required. +##' In the former, the flow computation proceeds over the entire set of intervals required, and accumulator variables are then differenced. +##' That is, the value \eqn{a_k}{a[k]} of accumulator variable \eqn{a} at times \eqn{t_k}{t[k]}, \eqn{k=1,2,\dots} will be \eqn{A_k-A_{k-1}}{A[k]-A[k-1]}, where \eqn{A_k}{A[k]} is the solution of the corresponding differential equation at \eqn{t_k}{t[k]}. NULL setGeneric( diff --git a/inst/NEWS b/inst/NEWS index e5b803b1..861ca9cc 100644 --- a/inst/NEWS +++ b/inst/NEWS @@ -1,5 +1,10 @@ _N_e_w_s _f_o_r _p_a_c_k_a_g_e '_p_o_m_p' +_C_h_a_n_g_e_s _i_n '_p_o_m_p' _v_e_r_s_i_o_n _5._1_1._1: + + • The help-page discussion of accumulator variables has been + expanded and clarified. + _C_h_a_n_g_e_s _i_n '_p_o_m_p' _v_e_r_s_i_o_n _5._1_0._1: • An improper typecast in the C snippet system, which was diff --git a/inst/NEWS.Rd b/inst/NEWS.Rd index 00a73f23..6d6ce41e 100644 --- a/inst/NEWS.Rd +++ b/inst/NEWS.Rd @@ -1,5 +1,10 @@ \name{NEWS} \title{News for package `pomp'} +\section{Changes in \pkg{pomp} version 5.11.1}{ + \itemize{ + \item The help-page discussion of accumulator variables has been expanded and clarified. + } +} \section{Changes in \pkg{pomp} version 5.10.1}{ \itemize{ \item An improper typecast in the C snippet system, which was resolvable by many compilers but threw an error under recent versions of \pkg{clang} on MacOS, has been repaired. diff --git a/man/accumvars.Rd b/man/accumvars.Rd index a8c0a4fc..1a0c5f1f 100644 --- a/man/accumvars.Rd +++ b/man/accumvars.Rd @@ -9,8 +9,10 @@ Latent state variables that accumulate quantities through time. \details{ In formulating models, one sometimes wishes to define a state variable that will accumulate some quantity over the interval between successive observations. \pkg{pomp} provides a facility to make such features more convenient. -Specifically, variables named in the \code{pomp}'s \code{accumvars} argument will be set to zero immediately following each observation. -See \code{\link{sir}} and the tutorials on the \href{https://kingaa.github.io/pomp/}{package website} for examples. +Specifically, if \eqn{a} is a state-variable named in the \code{pomp}'s \code{accumvars} argument, then for each interval \eqn{(t_k,t_{k+1})}{(t[k],t[k+1])}, \eqn{k=0,1,2,\dots}, \eqn{a} will be set to zero at prior to any \code{\link{rprocess}} computation over that interval. +Deterministic trajectory computation is handled slightly differently: +see \code{\link{flow}}. +For examples, see \code{\link{sir}} and the tutorials on the \href{https://kingaa.github.io/pomp/}{package website}. } \examples{ \donttest{ diff --git a/man/flow.Rd b/man/flow.Rd index 6124b94e..e1e7dd4b 100644 --- a/man/flow.Rd +++ b/man/flow.Rd @@ -50,6 +50,14 @@ Compute the flow generated by a deterministic vectorfield or map. In the case of a discrete-time system (map), \code{flow} iterates the map to yield trajectories of the system. In the case of a continuous-time system (vectorfield), \code{flow} uses the numerical solvers in \pkg{\link[deSolve]{deSolve}} to integrate the vectorfield starting from given initial conditions. } +\section{Accumulator variables}{ + +When there are accumulator variables (as determined by the \code{\link{accumvars}} argument), their handling in the continuous-time (vectorfield) case differs from that in the discrete-time (map) case. +In the latter, accumulator variables are set to zero at the beginning of each interval \eqn{(t_k,t_{k+1})}{(t[k],t[k+1])}, \eqn{k=0,1,2,\dots} over which flow computation is required. +In the former, the flow computation proceeds over the entire set of intervals required, and accumulator variables are then differenced. +That is, the value \eqn{a_k}{a[k]} of accumulator variable \eqn{a} at times \eqn{t_k}{t[k]}, \eqn{k=1,2,\dots} will be \eqn{A_k-A_{k-1}}{A[k]-A[k-1]}, where \eqn{A_k}{A[k]} is the solution of the corresponding differential equation at \eqn{t_k}{t[k]}. +} + \seealso{ More on \pkg{pomp} workhorse functions: \code{\link{dinit}()},