[Pomp-commits] r172 - in pkg: . R tests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Oct 12 17:52:43 CEST 2009


Author: kingaa
Date: 2009-10-12 17:52:42 +0200 (Mon, 12 Oct 2009)
New Revision: 172

Modified:
   pkg/DESCRIPTION
   pkg/R/mif.R
   pkg/tests/ou2-mif.R
Log:
- add error trap to prevent non-finite parameters from being estimated


Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	2009-10-07 20:40:38 UTC (rev 171)
+++ pkg/DESCRIPTION	2009-10-12 15:52:42 UTC (rev 172)
@@ -1,8 +1,8 @@
 Package: pomp
 Type: Package
 Title: Statistical inference for partially observed Markov processes
-Version: 0.25-5
-Date: 2009-10-06
+Version: 0.25-6
+Date: 2009-10-12
 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	2009-10-07 20:40:38 UTC (rev 171)
+++ pkg/R/mif.R	2009-10-12 15:52:42 UTC (rev 172)
@@ -147,6 +147,18 @@
                        )
                      )
   conv.rec[1,] <- c(NA,NA,theta)
+
+  if (!all(is.finite(theta[c(pars,ivps)]))) {
+    stop(
+         sQuote("mif"),
+         " error: cannot estimate non-finite parameters: ",
+         paste(
+               c(pars,ivps)[!is.finite(theta[c(pars,ivps)])],
+               collapse=","
+               ),
+         call.=FALSE
+         )
+  }
   
   for (n in seq(length=Nmif)) { # main loop
 

Modified: pkg/tests/ou2-mif.R
===================================================================
--- pkg/tests/ou2-mif.R	2009-10-07 20:40:38 UTC (rev 171)
+++ pkg/tests/ou2-mif.R	2009-10-12 15:52:42 UTC (rev 172)
@@ -112,6 +112,28 @@
         )
     )
 
+try(
+    mif(
+        ou2,
+        Nmif=2,
+        start=c(alpha.1=0.9,alpha.2=0,alpha.3=0,alpha.4=-Inf,sigma.1=1,sigma.2=0,sigma.3=2,tau=1,x1.0=50,x2.0=-50),
+        ivps=c("x1.0","x2.0"),
+        rw.sd=c(x1.0=5,x2.0=5,alpha.1=0,alpha.4=0.2,alpha.3=0),
+        Np=11,cooling.factor=0.95,ic.lag=10,var.factor=1
+        )
+    )
+
+try(
+    mif(
+        ou2,
+        Nmif=2,
+        start=c(alpha.1=0.9,alpha.2=0,alpha.3=0,alpha.4=0.99,sigma.1=1,sigma.2=0,sigma.3=2,tau=1,x1.0=50,x2.0=NaN),
+        ivps=c("x1.0","x2.0"),
+        rw.sd=c(x1.0=5,x2.0=5,alpha.1=0,alpha.4=0.2,alpha.3=0),
+        Np=11,cooling.factor=0.95,ic.lag=10,var.factor=1
+        )
+    )
+
 fit <- mif(
            ou2,
            Nmif=0,



More information about the pomp-commits mailing list