[Pomp-commits] r125 - in pkg: . R data inst/examples man tests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed May 13 14:08:32 CEST 2009


Author: kingaa
Date: 2009-05-13 14:08:32 +0200 (Wed, 13 May 2009)
New Revision: 125

Modified:
   pkg/DESCRIPTION
   pkg/R/simulate-pomp.R
   pkg/data/euler.sir.rda
   pkg/data/ou2.rda
   pkg/data/rw2.rda
   pkg/inst/examples/logistic.R
   pkg/man/simulate-pomp.Rd
   pkg/tests/logistic.R
   pkg/tests/logistic.Rout.save
   pkg/tests/ou2-nlf.R
   pkg/tests/ou2-nlf.Rout.save
   pkg/tests/ou2-simulate.R
   pkg/tests/ou2-simulate.Rout.save
Log:
now when 'simulate' is called with nsim=1 (the default), a single 'pomp' object is returned rather than (per the old behavior) a list containing one 'pomp' object.

Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	2009-05-12 17:34:37 UTC (rev 124)
+++ pkg/DESCRIPTION	2009-05-13 12:08:32 UTC (rev 125)
@@ -1,8 +1,8 @@
 Package: pomp
 Type: Package
 Title: Statistical inference for partially observed Markov processes
-Version: 0.23-7
-Date: 2009-05-12
+Version: 0.24-1
+Date: 2009-05-13
 Author: Aaron A. King, Edward L. Ionides, Carles Martinez Breto, Steve Ellner, Bruce Kendall
 Maintainer: Aaron A. King <kingaa at umich.edu>
 Description: Inference methods for partially-observed Markov processes

Modified: pkg/R/simulate-pomp.R
===================================================================
--- pkg/R/simulate-pomp.R	2009-05-12 17:34:37 UTC (rev 124)
+++ pkg/R/simulate-pomp.R	2009-05-13 12:08:32 UTC (rev 125)
@@ -57,6 +57,9 @@
                                  po
                                }
                                )
+              if (nreps==1) {
+                retval <- retval[[1]]
+              }
             } else {
               if (!obs && states) {               # return states only
                 retval <- x

Modified: pkg/data/euler.sir.rda
===================================================================
(Binary files differ)

Modified: pkg/data/ou2.rda
===================================================================
(Binary files differ)

Modified: pkg/data/rw2.rda
===================================================================
(Binary files differ)

Modified: pkg/inst/examples/logistic.R
===================================================================
--- pkg/inst/examples/logistic.R	2009-05-12 17:34:37 UTC (rev 124)
+++ pkg/inst/examples/logistic.R	2009-05-13 12:08:32 UTC (rev 125)
@@ -40,7 +40,7 @@
 
 params <- c(n.0=10000,K=10000,r=0.9,sigma=0.4,tau=0.1)
 set.seed(73658676)
-po <- simulate(po,params=params)[[1]]
+po <- simulate(po,params=params)
 
 params <- cbind(c(n.0=100,K=10000,r=0.2,sigma=0.4,tau=0.1),c(n.0=1000,K=11000,r=0.1,sigma=0.4,tau=0.1))
 x <- trajectory(po,params=params)

Modified: pkg/man/simulate-pomp.Rd
===================================================================
--- pkg/man/simulate-pomp.Rd	2009-05-12 17:34:37 UTC (rev 124)
+++ pkg/man/simulate-pomp.Rd	2009-05-13 12:08:32 UTC (rev 125)
@@ -35,6 +35,8 @@
   Each has a simulated data set, together with the parameters used (in slot \code{params}) and the state trajectories also (in slot \code{states}).
   If \code{times} is specified, then the \code{t0} slot of the created `pomp' objects will be filled with \code{times[1]} and the simulated observations will be at times \code{times[-1]}.
 
+  If \code{nsim=1}, then a single \code{pomp} object is returned (and not a singleton list).
+
   If \code{states=TRUE} and \code{obs=FALSE}, simulated state trajectories are returned as a rank-3 array with dimensions \code{nvar} x \code{(ncol(params)*nsim)} x \code{ntimes}.
   Here, \code{nvar} is the number of state variables and \code{ntimes} the length of the argument \code{times}.
   The measurement process is not simulated in this case.   

Modified: pkg/tests/logistic.R
===================================================================
--- pkg/tests/logistic.R	2009-05-12 17:34:37 UTC (rev 124)
+++ pkg/tests/logistic.R	2009-05-13 12:08:32 UTC (rev 125)
@@ -39,7 +39,7 @@
 
 params <- c(n.0=10000,K=10000,r=0.9,sigma=0.4,tau=0.1)
 set.seed(73658676)
-po <- simulate(po,params=params)[[1]]
+po <- simulate(po,params=params)
 
 t <- seq(0,by=0.005,length=50)
 x <- simulate(po,times=t,states=T,obs=T)

Modified: pkg/tests/logistic.Rout.save
===================================================================
--- pkg/tests/logistic.Rout.save	2009-05-12 17:34:37 UTC (rev 124)
+++ pkg/tests/logistic.Rout.save	2009-05-13 12:08:32 UTC (rev 125)
@@ -1,6 +1,6 @@
 
-R version 2.8.1 (2008-12-22)
-Copyright (C) 2008 The R Foundation for Statistical Computing
+R version 2.10.0 Under development (unstable) (2009-05-07 r48492)
+Copyright (C) 2009 The R Foundation for Statistical Computing
 ISBN 3-900051-07-0
 
 R is free software and comes with ABSOLUTELY NO WARRANTY.
@@ -58,7 +58,7 @@
 > 
 > params <- c(n.0=10000,K=10000,r=0.9,sigma=0.4,tau=0.1)
 > set.seed(73658676)
-> po <- simulate(po,params=params)[[1]]
+> po <- simulate(po,params=params)
 > 
 > t <- seq(0,by=0.005,length=50)
 > x <- simulate(po,times=t,states=T,obs=T)

Modified: pkg/tests/ou2-nlf.R
===================================================================
--- pkg/tests/ou2-nlf.R	2009-05-12 17:34:37 UTC (rev 124)
+++ pkg/tests/ou2-nlf.R	2009-05-13 12:08:32 UTC (rev 125)
@@ -6,7 +6,7 @@
 
 po <- ou2
 coef(po,c("x1.0","x2.0","alpha.1","alpha.4")) <- c(0,0,0.1,0.2)
-po <- simulate(po,times=(1:10000))[[1]]
+po <- simulate(po,times=(1:10000))
 p.truth <- coef(po)
 guess <- p.truth
 ## guess[c('x1.0','x2.0','alpha.1','alpha.4')] <- c(45,-60,0.8,0.9)

Modified: pkg/tests/ou2-nlf.Rout.save
===================================================================
--- pkg/tests/ou2-nlf.Rout.save	2009-05-12 17:34:37 UTC (rev 124)
+++ pkg/tests/ou2-nlf.Rout.save	2009-05-13 12:08:32 UTC (rev 125)
@@ -1,6 +1,6 @@
 
-R version 2.7.2 (2008-08-25)
-Copyright (C) 2008 The R Foundation for Statistical Computing
+R version 2.10.0 Under development (unstable) (2009-05-07 r48492)
+Copyright (C) 2009 The R Foundation for Statistical Computing
 ISBN 3-900051-07-0
 
 R is free software and comes with ABSOLUTELY NO WARRANTY.
@@ -16,7 +16,8 @@
 Type 'q()' to quit R.
 
 > library(pomp)
-Loading required package: odesolve
+Loading required package: deSolve
+Loading required package: subplex
 > 
 > data(ou2)
 > 
@@ -24,7 +25,7 @@
 > 
 > po <- ou2
 > coef(po,c("x1.0","x2.0","alpha.1","alpha.4")) <- c(0,0,0.1,0.2)
-> po <- simulate(po,times=(1:10000))[[1]]
+> po <- simulate(po,times=(1:10000))
 > p.truth <- coef(po)
 > guess <- p.truth
 > ## guess[c('x1.0','x2.0','alpha.1','alpha.4')] <- c(45,-60,0.8,0.9)
@@ -61,8 +62,8 @@
     25 function evaluations used
 h in NLF =  0.1 
 epsilon in NLF = 0.4420236 0.2750263 
-Fitted param  1 -4.042142 -4.042142  up in  ‘nlf’ 
-Fitted param  1 -4.031832  down in  ‘NLF’ 
-Fitted param  2 -4.032517 -4.032517  up in  ‘nlf’ 
-Fitted param  2 -4.03145  down in  ‘NLF’ 
+Fitted param  1 -4.042142 -4.042142  up in  'nlf' 
+Fitted param  1 -4.031832  down in  'NLF' 
+Fitted param  2 -4.032517 -4.032517  up in  'nlf' 
+Fitted param  2 -4.03145  down in  'NLF' 
 > 

Modified: pkg/tests/ou2-simulate.R
===================================================================
--- pkg/tests/ou2-simulate.R	2009-05-12 17:34:37 UTC (rev 124)
+++ pkg/tests/ou2-simulate.R	2009-05-13 12:08:32 UTC (rev 125)
@@ -17,7 +17,7 @@
 
 coef(ou2,c('x1.0','x2.0')) <- c(-50,50)
 
-ou2.sim <- simulate(ou2)[[1]]
+ou2.sim <- simulate(ou2)
 x <- simulate(ou2,nsim=3,states=T)
 y <- simulate(ou2,nsim=3,obs=T)
 z <- simulate(ou2,nsim=3,obs=T,states=T)

Modified: pkg/tests/ou2-simulate.Rout.save
===================================================================
--- pkg/tests/ou2-simulate.Rout.save	2009-05-12 17:34:37 UTC (rev 124)
+++ pkg/tests/ou2-simulate.Rout.save	2009-05-13 12:08:32 UTC (rev 125)
@@ -1,6 +1,6 @@
 
-R version 2.6.1 (2007-11-26)
-Copyright (C) 2007 The R Foundation for Statistical Computing
+R version 2.10.0 Under development (unstable) (2009-05-07 r48492)
+Copyright (C) 2009 The R Foundation for Statistical Computing
 ISBN 3-900051-07-0
 
 R is free software and comes with ABSOLUTELY NO WARRANTY.
@@ -16,6 +16,8 @@
 Type 'q()' to quit R.
 
 > library(pomp)
+Loading required package: deSolve
+Loading required package: subplex
 > 
 > data(ou2)
 > 
@@ -31,11 +33,11 @@
 > ou2.sim <- simulate(ou2,params=p,nsim=100,seed=32043858)
 > toc <- Sys.time()
 > print(toc-tic)
-Time difference of 0.2832530 secs
+Time difference of 0.3552971 secs
 > 
 > coef(ou2,c('x1.0','x2.0')) <- c(-50,50)
 > 
-> ou2.sim <- simulate(ou2)[[1]]
+> ou2.sim <- simulate(ou2)
 > x <- simulate(ou2,nsim=3,states=T)
 > y <- simulate(ou2,nsim=3,obs=T)
 > z <- simulate(ou2,nsim=3,obs=T,states=T)



More information about the pomp-commits mailing list