[Pomp-commits] r740 - in pkg/pomp: . R inst man tests
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Jun 29 23:12:06 CEST 2012
Author: kingaa
Date: 2012-06-29 23:12:06 +0200 (Fri, 29 Jun 2012)
New Revision: 740
Modified:
pkg/pomp/DESCRIPTION
pkg/pomp/R/pomp.R
pkg/pomp/inst/NEWS
pkg/pomp/man/pomp.Rd
pkg/pomp/tests/sir.R
Log:
- add 'params' argument to 'pomp' constructor
Modified: pkg/pomp/DESCRIPTION
===================================================================
--- pkg/pomp/DESCRIPTION 2012-06-29 21:10:08 UTC (rev 739)
+++ pkg/pomp/DESCRIPTION 2012-06-29 21:12:06 UTC (rev 740)
@@ -1,8 +1,8 @@
Package: pomp
Type: Package
Title: Statistical inference for partially observed Markov processes
-Version: 0.42-6
-Date: 2012-06-18
+Version: 0.43-1
+Date: 2012-06-30
Author: Aaron A. King, Edward L. Ionides, Carles Breto, Steve Ellner, Bruce Kendall, Helen Wearing, Matthew J. Ferrari, Michael Lavine, Daniel C. Reuman
Maintainer: Aaron A. King <kingaa at umich.edu>
URL: http://pomp.r-forge.r-project.org
Modified: pkg/pomp/R/pomp.R
===================================================================
--- pkg/pomp/R/pomp.R 2012-06-29 21:10:08 UTC (rev 739)
+++ pkg/pomp/R/pomp.R 2012-06-29 21:12:06 UTC (rev 740)
@@ -50,13 +50,14 @@
rmeasure, dmeasure, measurement.model,
skeleton = NULL, skeleton.type = c("map","vectorfield"),
skelmap.delta.t = 1,
- initializer, covar, tcovar,
+ initializer, params, covar, tcovar,
obsnames, statenames, paramnames, covarnames, zeronames,
PACKAGE, parameter.transform, parameter.inv.transform) {
if (missing(data)) stop(sQuote("data")," is a required argument")
if (missing(times)) stop(sQuote("times")," is a required argument")
if (missing(t0)) stop(sQuote("t0")," is a required argument")
+ if (missing(params)) params <- numeric(0)
## check the data
if (is.data.frame(data)) {
@@ -273,6 +274,7 @@
times = times,
t0 = t0,
initializer = initializer,
+ params=params,
covar = covar,
tcovar = tcovar,
obsnames = obsnames,
@@ -374,7 +376,7 @@
rmeasure, dmeasure, measurement.model,
skeleton = NULL, skeleton.type = c("map","vectorfield"),
skelmap.delta.t = 1,
- initializer, covar, tcovar,
+ initializer, params, covar, tcovar,
obsnames, statenames, paramnames, covarnames, zeronames,
PACKAGE, parameter.transform, parameter.inv.transform) {
pomp.constructor(
@@ -390,6 +392,7 @@
skeleton.type=skeleton.type,
skelmap.delta.t=skelmap.delta.t,
initializer=initializer,
+ params=params,
covar=covar,
tcovar=tcovar,
obsnames=obsnames,
@@ -412,7 +415,7 @@
rmeasure, dmeasure, measurement.model,
skeleton = NULL, skeleton.type = c("map","vectorfield"),
skelmap.delta.t = 1,
- initializer, covar, tcovar,
+ initializer, params, covar, tcovar,
obsnames, statenames, paramnames, covarnames, zeronames,
PACKAGE, parameter.transform, parameter.inv.transform) {
pomp.constructor(
@@ -428,6 +431,7 @@
skeleton.type=skeleton.type,
skelmap.delta.t=skelmap.delta.t,
initializer=initializer,
+ params=params,
covar=covar,
tcovar=tcovar,
obsnames=obsnames,
@@ -451,7 +455,7 @@
rmeasure, dmeasure, measurement.model,
skeleton = NULL, skeleton.type = c("map","vectorfield"),
skelmap.delta.t = 1,
- initializer, covar, tcovar,
+ initializer, params, covar, tcovar,
obsnames, statenames, paramnames, covarnames, zeronames,
PACKAGE, parameter.transform, parameter.inv.transform) {
pomp.constructor(
@@ -467,6 +471,7 @@
skeleton.type=skeleton.type,
skelmap.delta.t=skelmap.delta.t,
initializer=initializer,
+ params=params,
covar=covar,
tcovar=tcovar,
obsnames=obsnames,
@@ -488,7 +493,7 @@
function (data, times, t0, ..., rprocess, dprocess,
rmeasure, dmeasure, measurement.model,
skeleton, skeleton.type, skelmap.delta.t,
- initializer, covar, tcovar,
+ initializer, params, covar, tcovar,
obsnames, statenames, paramnames, covarnames, zeronames,
PACKAGE, parameter.transform, parameter.inv.transform) {
mmg <- !missing(measurement.model)
@@ -512,6 +517,7 @@
if (missing(rprocess)) rprocess <- data at rprocess
if (missing(dprocess)) dprocess <- data at dprocess
if (missing(initializer)) initializer <- data at initializer
+ if (missing(params)) params <- data at params
if (missing(covar)) covar <- data at covar
if (missing(tcovar)) tcovar <- data at tcovar
if (missing(obsnames)) obsnames <- data at obsnames
@@ -524,8 +530,6 @@
if (missing(skeleton)) skeleton <- data at skeleton
if (missing(skelmap.delta.t)) skelmap.delta.t <- data at skelmap.delta.t
- pars <- coef(data)
-
if (missing(parameter.transform)) {
if (missing(parameter.inv.transform)) {
par.trans <- data at par.trans
@@ -577,7 +581,7 @@
)
) -> retval
- coef(retval) <- pars
+ coef(retval) <- params
retval
}
Modified: pkg/pomp/inst/NEWS
===================================================================
--- pkg/pomp/inst/NEWS 2012-06-29 21:10:08 UTC (rev 739)
+++ pkg/pomp/inst/NEWS 2012-06-29 21:12:06 UTC (rev 740)
@@ -1,4 +1,9 @@
NEWS
+0.43-1
+ o Modify 'traj.match.objfun' to allow arbitrary parameters to be passed to the ODE integrator.
+
+ o Add 'params' argument to 'pomp' so that parameters can be specified at the time the pomp object is created.
+
0.42-6
o Improve error checking in 'pomp'.
Modified: pkg/pomp/man/pomp.Rd
===================================================================
--- pkg/pomp/man/pomp.Rd 2012-06-29 21:10:08 UTC (rev 739)
+++ pkg/pomp/man/pomp.Rd 2012-06-29 21:12:06 UTC (rev 740)
@@ -16,25 +16,25 @@
\S4method{pomp}{data.frame}(data, times, t0, \dots, rprocess, dprocess, rmeasure, dmeasure,
measurement.model,
skeleton = NULL, skeleton.type = c("map","vectorfield"), skelmap.delta.t = 1,
- initializer, covar, tcovar,
+ initializer, params, covar, tcovar,
obsnames, statenames, paramnames, covarnames, zeronames,
PACKAGE, parameter.transform, parameter.inv.transform)
\S4method{pomp}{numeric}(data, times, t0, \dots, rprocess, dprocess, rmeasure, dmeasure,
measurement.model,
skeleton = NULL, skeleton.type = c("map","vectorfield"), skelmap.delta.t = 1,
- initializer, covar, tcovar,
+ initializer, params, covar, tcovar,
obsnames, statenames, paramnames, covarnames, zeronames,
PACKAGE, parameter.transform, parameter.inv.transform)
\S4method{pomp}{matrix}(data, times, t0, \dots, rprocess, dprocess, rmeasure, dmeasure,
measurement.model,
skeleton = NULL, skeleton.type = c("map","vectorfield"), skelmap.delta.t = 1,
- initializer, covar, tcovar,
+ initializer, params, covar, tcovar,
obsnames, statenames, paramnames, covarnames, zeronames,
PACKAGE, parameter.transform, parameter.inv.transform)
\S4method{pomp}{pomp}(data, times, t0, \dots, rprocess, dprocess, rmeasure, dmeasure,
measurement.model,
skeleton, skeleton.type, skelmap.delta.t,
- initializer, covar, tcovar,
+ initializer, params, covar, tcovar,
obsnames, statenames, paramnames, covarnames, zeronames,
PACKAGE, parameter.transform, parameter.inv.transform)
}
@@ -108,6 +108,9 @@
These are simply copied over as initial conditions when \code{init.state} is called (see \code{\link{init.state-pomp}}).
The names of the state variables are the same as the corresponding initial value parameters, but with the \dQuote{\code{.0}} dropped.
}
+ \item{params}{
+ optional named numeric vector of parameters.
+ }
\item{covar, tcovar}{
An optional table of covariates: \code{covar} is the table (with one column per variable) and \code{tcovar} the corresponding times (one entry per row of \code{covar}).
\code{covar} can be specified as either a matrix or a data frame.
@@ -158,7 +161,7 @@
}
In general, the specification of process-model codes \code{rprocess} and/or \code{dprocess} can be somewhat nontrivial:
for this reason, \code{\link{plugins}} have been developed to streamline this process for the user.
- Currently, if one's process model evolves in discrete time or one is willing to make such an approximation (e.g., via an Euler approximation), then the \code{\link{euler.sim}} or \code{\link{onestep.sim}} plugin for \code{rprocess} and \code{\link{onestep.dens}} plugin for \code{dprocess} are available.
+ Currently, if one's process model evolves in discrete time or one is willing to make such an approximation (e.g., via an Euler approximation), then the \code{\link{euler.sim}}, \code{\link{discrete.time.sim}}, or \code{\link{onestep.sim}} plugin for \code{rprocess} and \code{\link{onestep.dens}} plugin for \code{dprocess} are available.
For exact simulation of certain continuous-time Markov chains, an implementation of Gillespie's algorithm is available (see \code{\link{gillespie.sim}}).
To use the plugins, consult the help documentation (\code{?\link{plugins}}) and the vignettes.
Modified: pkg/pomp/tests/sir.R
===================================================================
--- pkg/pomp/tests/sir.R 2012-06-29 21:10:08 UTC (rev 739)
+++ pkg/pomp/tests/sir.R 2012-06-29 21:12:06 UTC (rev 740)
@@ -18,6 +18,7 @@
po <- pomp(
times=1/52*seq.int(length=4*52),
data=rbind(reports=numeric(52*4)),
+ params=params,
t0=0,
tcovar=tbasis,
covar=basis,
@@ -148,7 +149,7 @@
set.seed(3049953)
## simulate from the model
tic <- Sys.time()
-x <- simulate(po,params=params,nsim=3)
+x <- simulate(po,nsim=3)
toc <- Sys.time()
print(toc-tic)
@@ -157,14 +158,14 @@
plot(x[[1]],variables=c("S","I","R","cases","W"))
t1 <- seq(0,4/52,by=1/52/25)
-X1 <- simulate(po,params=params,nsim=10,states=TRUE,obs=TRUE,times=t1)
+X1 <- simulate(po,nsim=10,states=TRUE,obs=TRUE,times=t1)
t2 <- seq(0,2,by=1/52)
-X2 <- simulate(po,params=params,nsim=1,states=TRUE,obs=TRUE,times=t2)
+X2 <- simulate(po,nsim=1,states=TRUE,obs=TRUE,times=t2)
t3 <- seq(0,20,by=1/52)
tic <- Sys.time()
-X3 <- trajectory(po,params=params,times=t3,hmax=1/52)
+X3 <- trajectory(po,times=t3,hmax=1/52)
toc <- Sys.time()
print(toc-tic)
plot(t3,X3['I',1,],type='l')
More information about the pomp-commits
mailing list