[Pomp-commits] r410 - in pkg: R inst src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Nov 7 15:40:36 CET 2010


Author: kingaa
Date: 2010-11-07 15:40:36 +0100 (Sun, 07 Nov 2010)
New Revision: 410

Modified:
   pkg/R/traj-match.R
   pkg/R/trajectory-pomp.R
   pkg/inst/ChangeLog
   pkg/src/sir.c
Log:

- fix traj-match objective function
- minor tweak to trajectory generic
- make the variables 'cases' in SIR trajectories integer-valued


Modified: pkg/R/traj-match.R
===================================================================
--- pkg/R/traj-match.R	2010-11-07 13:42:23 UTC (rev 409)
+++ pkg/R/traj-match.R	2010-11-07 14:40:36 UTC (rev 410)
@@ -91,9 +91,9 @@
     x <- trajectory(obj,params=p,t0=t0)
     d <- dmeasure(
                   obj,
-                  y=data.array(object),
+                  y=obs(obj),
                   x=trajectory(obj,params=p,t0=t0),
-                  times=time(object),
+                  times=time(obj),
                   params=as.matrix(p),
                   log=TRUE
                   )

Modified: pkg/R/trajectory-pomp.R
===================================================================
--- pkg/R/trajectory-pomp.R	2010-11-07 13:42:23 UTC (rev 409)
+++ pkg/R/trajectory-pomp.R	2010-11-07 14:40:36 UTC (rev 410)
@@ -1,7 +1,3 @@
-trajectory <- function (object, params, times, t0, ...)
-  stop("function ",sQuote("trajectory")," is undefined for objects of class ",sQuote(class(object)))
-setGeneric('trajectory')
-
 trajectory.internal <- function (object, params, times, t0, ...) {
 
   warn.condition <- missing(t0)
@@ -120,4 +116,6 @@
   x
 }
 
+setGeneric('trajectory',function(object,params,times,t0,...)standardGeneric("trajectory"))
+
 setMethod("trajectory",signature=signature(object="pomp"),definition=trajectory.internal)

Modified: pkg/inst/ChangeLog
===================================================================
--- pkg/inst/ChangeLog	2010-11-07 13:42:23 UTC (rev 409)
+++ pkg/inst/ChangeLog	2010-11-07 14:40:36 UTC (rev 410)
@@ -1,5 +1,34 @@
 2010-11-05  kingaa
 
+	* [r407] DESCRIPTION, R/mif-class.R, R/mif.R, R/particles-mif.R,
+	  R/pfilter-mif.R, R/pfilter.R, R/pmcmc.R, data/dacca.rda,
+	  data/euler.sir.rda, data/gillespie.sir.rda, data/ou2.rda,
+	  data/rw2.rda, data/verhulst.rda, inst/ChangeLog, inst/NEWS,
+	  inst/doc/advanced_topics_in_pomp.pdf, inst/doc/intro_to_pomp.pdf,
+	  inst/doc/ou2-first-mif.rda, inst/doc/ou2-trajmatch.rda,
+	  man/bsmc.Rd, man/mif-class.Rd, man/mif-methods.Rd, man/mif.Rd,
+	  man/pfilter.Rd, man/pmcmc-class.Rd, man/pmcmc-methods.Rd,
+	  man/pmcmc.Rd, man/probe.Rd, man/probed-pomp-methods.Rd,
+	  man/spect.Rd, man/traj-match.Rd, man/trajectory-pomp.Rd,
+	  tests/ou2-forecast.R, tests/ou2-forecast.Rout.save,
+	  tests/ou2-mif.R, tests/ou2-mif.Rout.save, tests/ou2-pmcmc.R,
+	  tests/ou2-pmcmc.Rout.save: - create new class 'pfilterd.pomp' to
+	  hold results of 'pfilter'
+	  - the classes 'mif' and 'pmcmc' now inherit from 'pfilterd.pomp'
+	  - changed the internal representation of 'mif' object (expanded
+	  'alg.pars' list to separate slots)
+	  - the arguments to the generic 'dprior' have changed
+	  - rearrange internal structure of 'mif' algorithm
+	  - rearrange internal structure of 'pmcmc' algorithm
+	  - add 'mif' and 'pmcmc' methods for 'pfilterd.pomp' objects
+	  - remove 'pfilter' method for 'mif' objects: the 'pfilter' method
+	  for 'pfilterd.pomp' objects does the job now
+	  - change output of 'pfilter' when 'save.states=TRUE': now states
+	  at final time are stored in slot 'last.states'
+	  - it is now allowed to call 'pfilter' with 'save.states=TRUE' on
+	  a 'mif' object.
+	  - the internal man pages for various of the classes have yet to
+	  be updated
 	* [r405] DESCRIPTION, NAMESPACE, R/aaa.R, R/probe-match.R,
 	  R/spect-match.R, R/traj-match.R, man/traj-match.Rd,
 	  tests/ou2-trajmatch.R, tests/ou2-trajmatch.Rout.save: - if

Modified: pkg/src/sir.c
===================================================================
--- pkg/src/sir.c	2010-11-07 13:42:23 UTC (rev 409)
+++ pkg/src/sir.c	2010-11-07 14:40:36 UTC (rev 410)
@@ -46,13 +46,13 @@
 void _sir_binom_dmeasure (double *lik, double *y, double *x, double *p, int give_log,
 			  int *obsindex, int *stateindex, int *parindex, int *covindex,
 			  int ncovars, double *covars, double t) {
-  *lik = dbinom(REPORTS,CASE,exp(LOGRHO),give_log);
+  *lik = dbinom(REPORTS,nearbyint(CASE),exp(LOGRHO),give_log);
 }
 
 void _sir_binom_rmeasure (double *y, double *x, double *p, 
 			  int *obsindex, int *stateindex, int *parindex, int *covindex,
 			  int ncovars, double *covars, double t) {
-  REPORTS = rbinom(CASE,exp(LOGRHO));
+  REPORTS = rbinom(nearbyint(CASE),exp(LOGRHO));
 }
 
 #undef REPORTS



More information about the pomp-commits mailing list