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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jun 23 21:14:54 CEST 2009


Author: kingaa
Date: 2009-06-23 21:14:54 +0200 (Tue, 23 Jun 2009)
New Revision: 152

Modified:
   pkg/DESCRIPTION
   pkg/R/mif.R
   pkg/data/euler.sir.rda
   pkg/data/ou2.rda
   pkg/data/rw2.rda
   pkg/inst/ChangeLog
   pkg/inst/doc/advanced_topics_in_pomp.pdf
   pkg/inst/doc/intro_to_pomp.pdf
   pkg/man/mif.Rd
   pkg/tests/ou2-mif.R
   pkg/tests/ou2-mif.Rout.save
Log:
alg.pars has been removed as an argument to 'mif'

Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	2009-06-19 21:16:59 UTC (rev 151)
+++ pkg/DESCRIPTION	2009-06-23 19:14:54 UTC (rev 152)
@@ -1,8 +1,8 @@
 Package: pomp
 Type: Package
 Title: Statistical inference for partially observed Markov processes
-Version: 0.24-7
-Date: 2009-06-19
+Version: 0.25-1
+Date: 2009-06-23
 Author: Aaron A. King, Edward L. Ionides, Carles Martinez 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-06-19 21:16:59 UTC (rev 151)
+++ pkg/R/mif.R	2009-06-23 19:14:54 UTC (rev 152)
@@ -19,7 +19,7 @@
                           start = NULL,
                           pars = NULL, ivps = NULL,
                           particles = NULL,
-                          rw.sd = NULL, alg.pars = 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,
                           verbose = FALSE, .ndone = 0) {
@@ -90,41 +90,25 @@
   if (is.null(particles))
     particles <- object at particles
 
-  if (is.null(alg.pars)) {
-    if (is.null(Np))
-      Np <- object at alg.pars$Np
-    Np <- as.integer(Np)
-    if ((length(Np)!=1)||(Np < 1))
-      stop("mif error: ",sQuote("Np")," must be a positive integer",call.=FALSE)
-    if (is.null(ic.lag))
-      ic.lag <- object at alg.pars$ic.lag
-    ic.lag <- as.integer(ic.lag)
-    if ((length(ic.lag)!=1)||(ic.lag < 1))
-      stop("mif error: ",sQuote("ic.lag")," must be a positive integer",call.=FALSE)
-    if (is.null(cooling.factor))
-      cooling.factor <- object at alg.pars$cooling.factor
-    if ((length(cooling.factor)!=1)||(cooling.factor < 0)||(cooling.factor>1))
-      stop("mif error: ",sQuote("cooling.factor")," must be a number between 0 and 1",call.=FALSE)
-    if (is.null(var.factor))
-      var.factor <- object at alg.pars$var.factor
-    if ((length(var.factor)!=1)||(var.factor < 0))
-      stop("mif error: ",sQuote("var.factor")," must be a positive number",call.=FALSE)
-  } else {                       # use of 'alg.pars' is now deprecated
-    warning("mif warning: use of ",sQuote("alg.pars")," is deprecated; see the documentation for ",sQuote("mif"),".",call.=FALSE)
-    if (!all(c('Np','cooling.factor','ic.lag','var.factor')%in%names(alg.pars)))
-      stop(
-           "mif error: ",sQuote("alg.pars"),
-           " must be a named list with elements ",
-           sQuote("Np"),",",sQuote("cooling.factor"),",",sQuote("ic.lag"),
-           ",and ",sQuote("var.factor"),
-           call.=FALSE
-           )
-    Np <- alg.pars$Np
-    cooling.factor <- alg.pars$cooling.factor
-    var.factor <- alg.pars$var.factor
-    ic.lag <- alg.pars$ic.lag
-  }
-
+  if (is.null(Np))
+    Np <- object at alg.pars$Np
+  Np <- as.integer(Np)
+  if ((length(Np)!=1)||(Np < 1))
+    stop("mif error: ",sQuote("Np")," must be a positive integer",call.=FALSE)
+  if (is.null(ic.lag))
+    ic.lag <- object at alg.pars$ic.lag
+  ic.lag <- as.integer(ic.lag)
+  if ((length(ic.lag)!=1)||(ic.lag < 1))
+    stop("mif error: ",sQuote("ic.lag")," must be a positive integer",call.=FALSE)
+  if (is.null(cooling.factor))
+    cooling.factor <- object at alg.pars$cooling.factor
+  if ((length(cooling.factor)!=1)||(cooling.factor < 0)||(cooling.factor>1))
+    stop("mif error: ",sQuote("cooling.factor")," must be a number between 0 and 1",call.=FALSE)
+  if (is.null(var.factor))
+    var.factor <- object at alg.pars$var.factor
+  if ((length(var.factor)!=1)||(var.factor < 0))
+    stop("mif error: ",sQuote("var.factor")," must be a positive number",call.=FALSE)
+  
   if (verbose) {
     cat("performing",Nmif,"MIF iteration(s) to estimate parameter(s)",
         paste(pars,collapse=", "))
@@ -269,8 +253,7 @@
           function (object, Nmif = 1,
                     start,
                     pars, ivps = character(0),
-                    particles,
-                    rw.sd, alg.pars,
+                    particles, rw.sd,
                     Np, ic.lag, var.factor, cooling.factor,
                     weighted = TRUE, tol = 1e-17, warn = TRUE, max.fail = 0,
                     verbose = FALSE)
@@ -282,6 +265,15 @@
               rw.names <- names(rw.sd)[rw.sd>0]
               pars <- rw.names[!(rw.names%in%ivps)]
             }
+            if (missing(Np))
+              stop("mif error: ",sQuote("Np")," must be specified",call.=FALSE)
+            if (missing(ic.lag))
+              stop("mif error: ",sQuote("ic.lag")," must be specified",call.=FALSE)
+            if (missing(var.factor))
+              stop("mif error: ",sQuote("var.factor")," must be specified",call.=FALSE)
+            if (missing(cooling.factor))
+              stop("mif error: ",sQuote("cooling.factor")," must be specified",call.=FALSE)
+              
             if (missing(particles)) {         # use default: normal distribution
               particles <- function (Np, center, sd, ...) {
                 matrix(
@@ -309,10 +301,9 @@
                      call.=FALSE
                      )
             }
-            if (missing(alg.pars)) alg.pars <- NULL # alg.pars is now deprecated
               
             mif.internal(object,Nmif=Nmif,start=start,pars=pars,ivps=ivps,particles=particles,
-                         rw.sd=rw.sd,alg.pars=alg.pars,Np=Np,cooling.factor=cooling.factor,
+                         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,
                          verbose=verbose,.ndone=0)

Modified: pkg/data/euler.sir.rda
===================================================================
(Binary files differ)

Modified: pkg/data/ou2.rda
===================================================================
(Binary files differ)

Modified: pkg/data/rw2.rda
===================================================================
(Binary files differ)

Modified: pkg/inst/ChangeLog
===================================================================
--- pkg/inst/ChangeLog	2009-06-19 21:16:59 UTC (rev 151)
+++ pkg/inst/ChangeLog	2009-06-23 19:14:54 UTC (rev 152)
@@ -1,5 +1,8 @@
 2009-06-19  kingaa
 
+	* [r151] DESCRIPTION, inst/ChangeLog,
+	  inst/doc/advanced_topics_in_pomp.pdf, inst/doc/intro_to_pomp.pdf:
+	  version 0.24-7
 	* [r150] src/initstate.c: check for duplication of names between
 	  states and parameters
 	  manage the pointer protection stack more sensibly

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	2009-06-19 21:16:59 UTC (rev 151)
+++ pkg/man/mif.Rd	2009-06-23 19:14:54 UTC (rev 152)
@@ -15,7 +15,7 @@
 \usage{
 mif(object, \dots)
 \S4method{mif}{pomp}(object, Nmif = 1, start, pars, ivps = character(0),
-    particles, rw.sd, alg.pars, Np, ic.lag, var.factor, cooling.factor,
+    particles, rw.sd, Np, ic.lag, var.factor, cooling.factor,
     weighted = TRUE, tol = 1e-17, warn = TRUE, max.fail = 0,
     verbose = FALSE)
 \S4method{mif}{mif}(object, Nmif, \dots)
@@ -56,11 +56,6 @@
     \code{rw.sd} must be non-negative (zeros are simply ignored),
     the name of every positive element of \code{rw.sd} must be in either \code{pars} or \code{ivps}.
   }
-  \item{alg.pars}{
-    optional; a named list of the algorithm parameters \code{Np}, \code{cooling.factor}, \code{var.factor}, \code{ic.lag}.
-    The use of \code{alg.pars} is now deprecated and generates a warning.
-    It will be removed in the near future.
-  }
   \item{Np}{
     a positive integer;
     the number of particles to use in filtering

Modified: pkg/tests/ou2-mif.R
===================================================================
--- pkg/tests/ou2-mif.R	2009-06-19 21:16:59 UTC (rev 151)
+++ pkg/tests/ou2-mif.R	2009-06-23 19:14:54 UTC (rev 152)
@@ -61,14 +61,6 @@
            )
 fit <- mif(
            ou2,
-           Nmif=1,
-           pars=c("alpha.1","alpha.4"),
-           ivps=c("x1.0","x2.0"),
-           rw.sd=c(x1.0=5,x2.0=5,alpha.1=0.1,alpha.4=0.2,alpha.3=0),
-           alg.pars=list(Np=1000,cooling.factor=0.95,ic.lag=10,var.factor=1)
-           )
-fit <- mif(
-           ou2,
            Nmif=2,
            ivps=c("x1.0","x2.0"),
            rw.sd=c(x1.0=5,x2.0=5,alpha.1=0.1,alpha.4=0.2),

Modified: pkg/tests/ou2-mif.Rout.save
===================================================================
--- pkg/tests/ou2-mif.Rout.save	2009-06-19 21:16:59 UTC (rev 151)
+++ pkg/tests/ou2-mif.Rout.save	2009-06-23 19:14:54 UTC (rev 152)
@@ -18,6 +18,7 @@
 > library(pomp)
 Loading required package: deSolve
 Loading required package: subplex
+Loading required package: mvtnorm
 > 
 > data(ou2)
 > 
@@ -67,7 +68,7 @@
 > mif.fit <- continue(mif.fit,Nmif=70,max.fail=100)
 > toc <- Sys.time()
 > print(toc-tic)
-Time difference of 1.020114 mins
+Time difference of 56.82802 secs
 > cat("PF estimated log likelihood at MIF MLE\n")
 PF estimated log likelihood at MIF MLE
 > print(pfilter(mif.fit)$loglik,digits=4)
@@ -100,16 +101,6 @@
 +            )
 > fit <- mif(
 +            ou2,
-+            Nmif=1,
-+            pars=c("alpha.1","alpha.4"),
-+            ivps=c("x1.0","x2.0"),
-+            rw.sd=c(x1.0=5,x2.0=5,alpha.1=0.1,alpha.4=0.2,alpha.3=0),
-+            alg.pars=list(Np=1000,cooling.factor=0.95,ic.lag=10,var.factor=1)
-+            )
-Warning message:
-mif warning: use of ‘alg.pars’ is deprecated; see the documentation for ‘mif’. 
-> fit <- mif(
-+            ou2,
 +            Nmif=2,
 +            ivps=c("x1.0","x2.0"),
 +            rw.sd=c(x1.0=5,x2.0=5,alpha.1=0.1,alpha.4=0.2),
@@ -118,7 +109,7 @@
 > fit <- continue(fit,Nmif=40)
 > ff <- pfilter(fit,pred.mean=T,filter.mean=T,pred.var=T,max.fail=100)
 > print(ff$loglik)
-[1] -441.1279
+[1] -495.7194
 > 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