[Pomp-commits] r818 - pkg/pomp/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jan 16 12:50:17 CET 2013


Author: kingaa
Date: 2013-01-16 12:50:16 +0100 (Wed, 16 Jan 2013)
New Revision: 818

Modified:
   pkg/pomp/R/mif.R
   pkg/pomp/R/pfilter.R
Log:
- 'pfilter' now warns when filtering failures occur (needed because default is to ignore failures)
- better errors and warnings (using 'ngettext')


Modified: pkg/pomp/R/mif.R
===================================================================
--- pkg/pomp/R/mif.R	2013-01-15 15:26:18 UTC (rev 817)
+++ pkg/pomp/R/mif.R	2013-01-16 11:50:16 UTC (rev 818)
@@ -105,11 +105,14 @@
   if (!all(rw.names%in%c(pars,ivps))) {
     extra.rws <- rw.names[!(rw.names%in%c(pars,ivps))]
     warning(
-            "mif warning: the variable(s) ",
-            paste(extra.rws,collapse=", "),
-            " have positive random-walk SDs specified, but are included in neither ",
+            ngettext(length(extra.rws),"mif warning: the variable ",
+                     "mif warning: the variables "),
+            paste(sQuote(extra.rws),collapse=", "),
+            ngettext(length(extra.rws)," has positive random-walk SD specified, but is included in neither ",
+                     " have positive random-walk SDs specified, but are included in neither "),
             sQuote("pars")," nor ",sQuote("ivps"),
-            ". These random walk SDs are ignored.",
+            ngettext(length(extra.rws),". This random walk SD will be ignored.",
+                     ". These random walk SDs will be ignored."),
             call.=FALSE
             )
   }
@@ -220,7 +223,7 @@
          sQuote("mif")," cannot estimate non-finite parameters.\n",
          "The following ",if (transform) "transformed ", "parameters are non-finite: ",
          paste(
-               c(pars,ivps)[!is.finite(theta[c(pars,ivps)])],
+               sQuote(c(pars,ivps)[!is.finite(theta[c(pars,ivps)])]),
                collapse=","
                ),
          call.=FALSE

Modified: pkg/pomp/R/pfilter.R
===================================================================
--- pkg/pomp/R/pfilter.R	2013-01-15 15:26:18 UTC (rev 817)
+++ pkg/pomp/R/pfilter.R	2013-01-16 11:50:16 UTC (rev 818)
@@ -318,6 +318,11 @@
     seed <- save.seed
   }
 
+  if (nfail>0)
+    warning(sprintf(ngettext(nfail,msg1="%d filtering failure occurred in ",
+                             msg2="%d filtering failures occurred in "),nfail),
+            sQuote("pfilter"),call.=FALSE)
+
   new(
       "pfilterd.pomp",
       object,



More information about the pomp-commits mailing list