[Pomp-commits] r194 - in pkg: . R inst inst/doc man tests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jan 19 13:36:24 CET 2010


Author: kingaa
Date: 2010-01-19 13:36:24 +0100 (Tue, 19 Jan 2010)
New Revision: 194

Modified:
   pkg/DESCRIPTION
   pkg/R/mif.R
   pkg/R/pfilter-mif.R
   pkg/R/pfilter.R
   pkg/inst/ChangeLog
   pkg/inst/doc/advanced_topics_in_pomp.pdf
   pkg/inst/doc/intro_to_pomp.pdf
   pkg/man/mif.Rd
   pkg/man/pfilter.Rd
   pkg/tests/ou2-mif.R
   pkg/tests/ou2-mif.Rout.save
Log:
- remove the 'warn' argument from pfilter and functions that call it.
  now 'verbose=TRUE' gives the same behavior.
  also, change the default of 'verbose' to 'getOption("verbose")'.
- minor improvements to the documentation


Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	2010-01-06 21:02:25 UTC (rev 193)
+++ pkg/DESCRIPTION	2010-01-19 12:36:24 UTC (rev 194)
@@ -1,8 +1,8 @@
 Package: pomp
 Type: Package
 Title: Statistical inference for partially observed Markov processes
-Version: 0.26-5
-Date: 2009-12-31
+Version: 0.27-1
+Date: 2010-01-15
 Author: Aaron A. King, Edward L. Ionides, Carles Breto, Steve Ellner, Bruce Kendall
 Maintainer: Aaron A. King <kingaa at umich.edu>
 Description: Inference methods for partially-observed Markov processes

Modified: pkg/R/mif.R
===================================================================
--- pkg/R/mif.R	2010-01-06 21:02:25 UTC (rev 193)
+++ pkg/R/mif.R	2010-01-19 12:36:24 UTC (rev 194)
@@ -21,7 +21,7 @@
                           particles = NULL,
                           rw.sd = NULL,
                           Np = NULL, cooling.factor = NULL, var.factor = NULL, ic.lag = NULL, 
-                          weighted = TRUE, tol = 1e-17, warn = TRUE, max.fail = 0,
+                          weighted = TRUE, tol = 1e-17, max.fail = 0,
                           verbose = FALSE, .ndone = 0) {
   is.mif <- is(object,"mif")
   if (is.null(start)) {
@@ -234,7 +234,6 @@
                               object=obj,
                               params=P,
                               tol=tol,
-                              warn=warn,
                               max.fail=max.fail,
                               pred.mean=(n==Nmif),
                               pred.var=(weighted||(n==Nmif)),
@@ -293,8 +292,8 @@
                     pars, ivps = character(0),
                     particles, rw.sd,
                     Np, ic.lag, var.factor, cooling.factor,
-                    weighted = TRUE, tol = 1e-17, warn = TRUE, max.fail = 0,
-                    verbose = FALSE)
+                    weighted = TRUE, tol = 1e-17, max.fail = 0,
+                    verbose = getOption("verbose"))
           {
             if (missing(start)) start <- NULL
             if (missing(rw.sd))
@@ -343,7 +342,7 @@
             mif.internal(object,Nmif=Nmif,start=start,pars=pars,ivps=ivps,particles=particles,
                          rw.sd=rw.sd,Np=Np,cooling.factor=cooling.factor,
                          var.factor=var.factor,ic.lag=ic.lag,
-                         weighted=weighted,tol=tol,warn=warn,max.fail=max.fail,
+                         weighted=weighted,tol=tol,max.fail=max.fail,
                          verbose=verbose,.ndone=0)
 
           }

Modified: pkg/R/pfilter-mif.R
===================================================================
--- pkg/R/pfilter-mif.R	2010-01-06 21:02:25 UTC (rev 193)
+++ pkg/R/pfilter-mif.R	2010-01-19 12:36:24 UTC (rev 194)
@@ -2,7 +2,7 @@
           "pfilter",
           "mif",
           function (object, params, Np,
-                    tol = 1e-17, warn = TRUE, max.fail = 0,
+                    tol = 1e-17, max.fail = 0,
                     pred.mean = FALSE,
                     pred.var = FALSE,
                     filter.mean = FALSE,
@@ -22,7 +22,6 @@
                     params=params,
                     Np=Np,
                     tol=tol,
-                    warn=warn,
                     max.fail=max.fail,
                     pred.mean=pred.mean,
                     pred.var=pred.var,

Modified: pkg/R/pfilter.R
===================================================================
--- pkg/R/pfilter.R	2010-01-06 21:02:25 UTC (rev 193)
+++ pkg/R/pfilter.R	2010-01-19 12:36:24 UTC (rev 194)
@@ -4,7 +4,7 @@
 ## question: how much efficiency would be realized by eliminating the calls to 'apply' with something else?
 
 pfilter.internal <- function (object, params, Np,
-                              tol, warn, max.fail,
+                              tol, max.fail,
                               pred.mean, pred.var, filter.mean,
                               .rw.sd, verbose,
                               save.states) {
@@ -188,7 +188,7 @@
     failures <- weights < tol
     all.fail <- all(failures)
     if (all.fail) {                     # all particles are lost
-      if (warn)
+      if (verbose)
         message("filtering failure at time t = ",times[nt+1])
       nfail <- nfail+1
       if (nfail > max.fail)
@@ -250,19 +250,19 @@
           "pfilter",
           "pomp",
           function (object, params, Np,
-                    tol = 1e-17, warn = TRUE, max.fail = 0,
+                    tol = 1e-17,
+                    max.fail = 0,
                     pred.mean = FALSE,
                     pred.var = FALSE,
                     filter.mean = FALSE,
                     save.states = FALSE,
-                    verbose = FALSE,
+                    verbose = getOption("verbose"),
                     ...) {
             pfilter.internal(
                              object=object,
                              params=params,
                              Np=Np,
                              tol=tol,
-                             warn=warn,
                              max.fail=max.fail,
                              pred.mean=pred.mean,
                              pred.var=pred.var,

Modified: pkg/inst/ChangeLog
===================================================================
--- pkg/inst/ChangeLog	2010-01-06 21:02:25 UTC (rev 193)
+++ pkg/inst/ChangeLog	2010-01-19 12:36:24 UTC (rev 194)
@@ -1,3 +1,9 @@
+2010-01-06  kingaa
+
+	* [r193] inst/ChangeLog, inst/doc/advanced_topics_in_pomp.Rnw,
+	  inst/doc/advanced_topics_in_pomp.pdf, inst/doc/intro_to_pomp.pdf:
+	  - bug fix in Advanced Topics vignette
+
 2009-12-31  kingaa
 
 	* [r192] inst/ChangeLog: - version 0.26-5

Modified: pkg/inst/doc/advanced_topics_in_pomp.pdf
===================================================================
(Binary files differ)

Modified: pkg/inst/doc/intro_to_pomp.pdf
===================================================================
(Binary files differ)

Modified: pkg/man/mif.Rd
===================================================================
--- pkg/man/mif.Rd	2010-01-06 21:02:25 UTC (rev 193)
+++ pkg/man/mif.Rd	2010-01-19 12:36:24 UTC (rev 194)
@@ -16,8 +16,8 @@
 mif(object, \dots)
 \S4method{mif}{pomp}(object, Nmif = 1, start, pars, ivps = character(0),
     particles, rw.sd, Np, ic.lag, var.factor, cooling.factor,
-    weighted = TRUE, tol = 1e-17, warn = TRUE, max.fail = 0,
-    verbose = FALSE)
+    weighted = TRUE, tol = 1e-17, max.fail = 0,
+    verbose = getOption("verbose"))
 \S4method{mif}{mif}(object, Nmif, \dots)
 \S4method{continue}{mif}(object, Nmif = 1, \dots)
 }
@@ -74,19 +74,16 @@
     the exponential cooling factor, \code{alpha}.
   }
   \item{weighted}{
-    Should a weighted average be used?
-    If \code{weighted=F}, the MIF update is not used;
+    logical; if TRUE, the MIF update (a weighted average) is used.
+    If FALSE, the MIF update is not used;
     instead, an unweighed average of the filtering means is used for the update.
   }
   \item{tol}{
-    Particles with log likelihood below \code{tol} are considered to be "lost".
+    numeric scalar; particles with log likelihood below \code{tol} are considered to be "lost".
     A filtering failure occurs when, at some time point, all particles are lost.
   }
-  \item{warn}{
-    Should a warning be generated when a filtering failure occurs?
-  }
   \item{max.fail}{
-    Maximum number of filtering failures permitted.
+    integer; maximum number of filtering failures permitted.
     If the number of failures exceeds this number, execution will terminate with an error.
   }
   \item{verbose}{
@@ -98,7 +95,7 @@
 }
 \section{Re-running MIF Iterations}{
   To re-run a sequence of MIF iterations, one can use the \code{mif} method on a \code{mif} object.
-  By default, the same parameters used for the original MIF run are re-used (except for \code{weighted}, \code{tol}, \code{warn}, \code{max.fail}, and \code{verbose}, the defaults of which are shown above).
+  By default, the same parameters used for the original MIF run are re-used (except for \code{weighted}, \code{tol}, \code{max.fail}, and \code{verbose}, the defaults of which are shown above).
   If one does specify additional arguments, these will override the defaults.
 }
 \section{Continuing MIF Iterations}{

Modified: pkg/man/pfilter.Rd
===================================================================
--- pkg/man/pfilter.Rd	2010-01-06 21:02:25 UTC (rev 193)
+++ pkg/man/pfilter.Rd	2010-01-19 12:36:24 UTC (rev 194)
@@ -12,10 +12,11 @@
 \usage{
 pfilter(object, \dots)
 \S4method{pfilter}{pomp}(object, params, Np, tol = 1e-17,
-    warn = TRUE, max.fail = 0, pred.mean = FALSE, pred.var = FALSE,
-    filter.mean = FALSE, save.states = FALSE, verbose = FALSE, \dots)
-\S4method{pfilter}{mif}(object, params, Np, tol = 1e-17, warn = TRUE,
     max.fail = 0, pred.mean = FALSE, pred.var = FALSE,
+    filter.mean = FALSE, save.states = FALSE,
+    verbose = getOption("verbose"), \dots)
+\S4method{pfilter}{mif}(object, params, Np, tol = 1e-17,
+    max.fail = 0, pred.mean = FALSE, pred.var = FALSE,
     filter.mean = FALSE, \dots)
 }
 \arguments{
@@ -29,35 +30,32 @@
     In this case, all particles will inherit the same parameter values.
   }
   \item{Np}{
-    Number of particles to use.
+    integer; number of particles to use.
     When \code{object} is of class \code{mif}, this is by default the same number of particles used in the \code{mif} iterations.
   }
   \item{tol}{
-    Particles with log likelihood below \code{tol} are considered to be "lost".
+    positive numeric scalar; particles with log likelihood below \code{tol} are considered to be "lost".
     A filtering failure occurs when, at some time point, all particles are lost.
     When all particles are lost, the conditional log likelihood at that time point is set to be \code{log(tol)}.
   }
-  \item{warn}{
-    Should filtering failures generate warnings?
-  }
   \item{max.fail}{
-    The maximum number of filtering failures allowed.
+    integer; the maximum number of filtering failures allowed.
     If the number of filtering failures exceeds this number, execution will terminate with an error.
   }
   \item{pred.mean}{
-    If \code{TRUE}, the prediction means are calculated for the state variables and parameters.
+    logical; if \code{TRUE}, the prediction means are calculated for the state variables and parameters.
   }
   \item{pred.var}{
-    If \code{TRUE}, the prediction variances are calculated for the state variables and parameters.
+    logical; if \code{TRUE}, the prediction variances are calculated for the state variables and parameters.
   }
   \item{filter.mean}{
-    If \code{TRUE}, the filtering means are calculated for the state variables and parameters.
+    logical; if \code{TRUE}, the filtering means are calculated for the state variables and parameters.
   }
   \item{save.states}{
-    If \code{TRUE}, the state-vector for each particle is saved and returned.
+    logical; if \code{TRUE}, the state-vector for each particle is saved and returned.
   }
   \item{verbose}{
-    If \code{TRUE}, progress information is reported as \code{pfilter} works.
+    logical; if \code{TRUE}, progress information is reported as \code{pfilter} works.
   }
   \item{\dots}{
     Additional arguments unused at present.

Modified: pkg/tests/ou2-mif.R
===================================================================
--- pkg/tests/ou2-mif.R	2010-01-06 21:02:25 UTC (rev 193)
+++ pkg/tests/ou2-mif.R	2010-01-19 12:36:24 UTC (rev 194)
@@ -151,7 +151,7 @@
            )
 fit <- continue(fit)
 fit <- continue(fit,Nmif=2)
-ff <- pfilter(fit,pred.mean=T,filter.mean=T,pred.var=T,max.fail=100)
+ff <- pfilter(fit,pred.mean=T,filter.mean=T,pred.var=T,max.fail=100,verbose=T)
 fit <- mif(fit,rw.sd=c(x1.0=5,x2.0=5,alpha.1=0.1,alpha.4=0.1))
 fit <- continue(fit,Nmif=2,ivps=c("x1.0"),pars=c("alpha.1"))
 s <- coef(fit)

Modified: pkg/tests/ou2-mif.Rout.save
===================================================================
--- pkg/tests/ou2-mif.Rout.save	2010-01-06 21:02:25 UTC (rev 193)
+++ pkg/tests/ou2-mif.Rout.save	2010-01-19 12:36:24 UTC (rev 194)
@@ -1,5 +1,5 @@
 
-R version 2.9.1 (2009-06-26)
+R version 2.10.1 (2009-12-14)
 Copyright (C) 2009 The R Foundation for Statistical Computing
 ISBN 3-900051-07-0
 
@@ -187,16 +187,36 @@
 +            )
 > fit <- continue(fit)
 > fit <- continue(fit,Nmif=2)
-> ff <- pfilter(fit,pred.mean=T,filter.mean=T,pred.var=T,max.fail=100)
+> ff <- pfilter(fit,pred.mean=T,filter.mean=T,pred.var=T,max.fail=100,verbose=T)
 filtering failure at time t = 3
 filtering failure at time t = 4
 filtering failure at time t = 5
+pfilter timestep 5 of 100 finished
 filtering failure at time t = 6
 filtering failure at time t = 7
 filtering failure at time t = 8
 filtering failure at time t = 9
 filtering failure at time t = 10
+pfilter timestep 10 of 100 finished
 filtering failure at time t = 11
+pfilter timestep 15 of 100 finished
+pfilter timestep 20 of 100 finished
+pfilter timestep 25 of 100 finished
+pfilter timestep 30 of 100 finished
+pfilter timestep 35 of 100 finished
+pfilter timestep 40 of 100 finished
+pfilter timestep 45 of 100 finished
+pfilter timestep 50 of 100 finished
+pfilter timestep 55 of 100 finished
+pfilter timestep 60 of 100 finished
+pfilter timestep 65 of 100 finished
+pfilter timestep 70 of 100 finished
+pfilter timestep 75 of 100 finished
+pfilter timestep 80 of 100 finished
+pfilter timestep 85 of 100 finished
+pfilter timestep 90 of 100 finished
+pfilter timestep 95 of 100 finished
+pfilter timestep 100 of 100 finished
 > fit <- mif(fit,rw.sd=c(x1.0=5,x2.0=5,alpha.1=0.1,alpha.4=0.1))
 > fit <- continue(fit,Nmif=2,ivps=c("x1.0"),pars=c("alpha.1"))
 Warning message:



More information about the pomp-commits mailing list