[Pomp-commits] r578 - in pkg/inst: doc examples

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Jan 7 17:24:11 CET 2012


Author: kingaa
Date: 2012-01-07 17:24:11 +0100 (Sat, 07 Jan 2012)
New Revision: 578

Modified:
   pkg/inst/doc/advanced_topics_in_pomp.Rnw
   pkg/inst/examples/sir.R
   pkg/inst/examples/sir.c
Log:
- update the examples 


Modified: pkg/inst/doc/advanced_topics_in_pomp.Rnw
===================================================================
--- pkg/inst/doc/advanced_topics_in_pomp.Rnw	2012-01-07 16:05:13 UTC (rev 577)
+++ pkg/inst/doc/advanced_topics_in_pomp.Rnw	2012-01-07 16:24:11 UTC (rev 578)
@@ -391,7 +391,8 @@
        "gamma","mu","iota","beta1","beta.sd",
        "pop","rho","nbasis","degree","period"
        ), 
-     ## reset cases to zero at each new observation:
+     ## designate 'cases' as an accumulator variable
+     ## i.e., set it to zero after each observation
      zeronames=c("cases"),      
      comp.names=c("S","I","R"),
      to.log.transform=c(
@@ -415,10 +416,7 @@
        x0 <- numeric(length(snames))
        names(x0) <- snames
        x0[comp.names] <- round(params['pop']*fracs/sum(fracs))
-       ## since 'cases' is in 'zeronames' above, the IC for this variable
-       ## will only matter in trajectory computations
-       ## In trajectory computations, however, 'cases' will be roughly the weekly number of new cases
-       x0["cases"] <- x0["I"]*exp(params["gamma"])/52 
+       x0["cases"] <- 0
        x0
      }
      ) -> sir

Modified: pkg/inst/examples/sir.R
===================================================================
--- pkg/inst/examples/sir.R	2012-01-07 16:05:13 UTC (rev 577)
+++ pkg/inst/examples/sir.R	2012-01-07 16:24:11 UTC (rev 578)
@@ -68,10 +68,7 @@
                x0 <- numeric(length(snames))
                names(x0) <- snames
                x0[comp.names] <- round(params['pop']*fracs/sum(fracs))
-               ## since 'cases' is in 'zeronames' above, the IC for this variable
-               ## will only matter in trajectory computations
-               ## In trajectory computations, however, 'cases' will be roughly the weekly number of new cases
-               x0["cases"] <- x0["I"]*exp(params["gamma"])/52 
+               x0["cases"] <- 0
                x0
              }
              )

Modified: pkg/inst/examples/sir.c
===================================================================
--- pkg/inst/examples/sir.c	2012-01-07 16:05:13 UTC (rev 577)
+++ pkg/inst/examples/sir.c	2012-01-07 16:24:11 UTC (rev 578)
@@ -199,10 +199,7 @@
   DSDT = term[0]-term[1]-term[2];
   DIDT = term[1]-term[3]-term[4];
   DRDT = term[3]-term[5];
-  // note that we cannot do the same accumulation trick using 'zeronames' 
-  // that we do in the stochastic simulator
-  // instead, we'll try to get roughly the number of new infections in a week using:
-  DCDT = DIDT*gamma/52;	// this assumes that the reporting rate is weekly!
+  DCDT = term[3];		// accumulate the new I->R transitions
 
 }
 



More information about the pomp-commits mailing list