[Pomp-commits] r752 - in pkg/pomp: . R tests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jul 13 18:40:56 CEST 2012


Author: kingaa
Date: 2012-07-13 18:40:56 +0200 (Fri, 13 Jul 2012)
New Revision: 752

Modified:
   pkg/pomp/DESCRIPTION
   pkg/pomp/NAMESPACE
   pkg/pomp/R/aaa.R
   pkg/pomp/R/mif.R
   pkg/pomp/R/pfilter-methods.R
   pkg/pomp/tests/gompertz.R
   pkg/pomp/tests/gompertz.Rout.save
   pkg/pomp/tests/ou2-mif.Rout.save
Log:
- add 'eff.sample.size' and 'cond.logLik' methods for 'pfilterd.pomp' objects
- make 'non-finite parameters' warning message more informative


Modified: pkg/pomp/DESCRIPTION
===================================================================
--- pkg/pomp/DESCRIPTION	2012-07-13 13:52:42 UTC (rev 751)
+++ pkg/pomp/DESCRIPTION	2012-07-13 16:40:56 UTC (rev 752)
@@ -2,7 +2,7 @@
 Type: Package
 Title: Statistical inference for partially observed Markov processes
 Version: 0.43-3
-Date: 2012-07-12
+Date: 2012-07-14
 Author: Aaron A. King, Edward L. Ionides, Carles Breto, Steve Ellner, Bruce Kendall, Helen Wearing, Matthew J. Ferrari, Michael Lavine, Daniel C. Reuman
 Maintainer: Aaron A. King <kingaa at umich.edu>
 URL: http://pomp.r-forge.r-project.org

Modified: pkg/pomp/NAMESPACE
===================================================================
--- pkg/pomp/NAMESPACE	2012-07-13 13:52:42 UTC (rev 751)
+++ pkg/pomp/NAMESPACE	2012-07-13 16:40:56 UTC (rev 752)
@@ -51,6 +51,7 @@
               dprocess,rprocess,rmeasure,dmeasure,init.state,skeleton,
               data.array,obs,partrans,coef,"coef<-",time,"time<-",timezero,"timezero<-",
               simulate,pfilter,
+              eff.sample.size,cond.logLik,
               particles,mif,continue,states,trajectory,
               pred.mean,pred.var,filter.mean,conv.rec,
               bsmc,

Modified: pkg/pomp/R/aaa.R
===================================================================
--- pkg/pomp/R/aaa.R	2012-07-13 13:52:42 UTC (rev 751)
+++ pkg/pomp/R/aaa.R	2012-07-13 16:40:56 UTC (rev 752)
@@ -17,6 +17,8 @@
 setGeneric("pred.mean",function(object,...)standardGeneric("pred.mean"))
 setGeneric("pred.var",function(object,...)standardGeneric("pred.var"))
 setGeneric("filter.mean",function(object,...)standardGeneric("filter.mean"))
+setGeneric("cond.logLik",function(object,...)standardGeneric("cond.logLik"))
+setGeneric("eff.sample.size",function(object,...)standardGeneric("eff.sample.size"))
 
 if (!exists("paste0",where="package:base")) {
   paste0 <- function(...) paste(...,sep="")

Modified: pkg/pomp/R/mif.R
===================================================================
--- pkg/pomp/R/mif.R	2012-07-13 13:52:42 UTC (rev 751)
+++ pkg/pomp/R/mif.R	2012-07-13 16:40:56 UTC (rev 752)
@@ -195,7 +195,8 @@
   if (!all(is.finite(theta[c(pars,ivps)]))) {
     stop(
          sQuote("mif"),
-         " error: cannot estimate non-finite parameters: ",
+         " error: 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)])],
                collapse=","

Modified: pkg/pomp/R/pfilter-methods.R
===================================================================
--- pkg/pomp/R/pfilter-methods.R	2012-07-13 13:52:42 UTC (rev 751)
+++ pkg/pomp/R/pfilter-methods.R	2012-07-13 16:40:56 UTC (rev 752)
@@ -1,5 +1,7 @@
 setMethod("$",signature(x="pfilterd.pomp"),function (x,name) slot(x,name))
 setMethod("logLik",signature(object="pfilterd.pomp"),function(object,...)object at loglik)
+setMethod("eff.sample.size",signature(object="pfilterd.pomp"),function(object,...)object at eff.sample.size)
+setMethod("cond.logLik",signature(object="pfilterd.pomp"),function(object,...)object at cond.loglik)
 
 ## extract the prediction means
 setMethod(
@@ -31,4 +33,3 @@
             object at filter.mean[pars,]
           }
           )
-

Modified: pkg/pomp/tests/gompertz.R
===================================================================
--- pkg/pomp/tests/gompertz.R	2012-07-13 13:52:42 UTC (rev 751)
+++ pkg/pomp/tests/gompertz.R	2012-07-13 16:40:56 UTC (rev 752)
@@ -11,7 +11,20 @@
 coef(po,c("r","K")) <- c(0.2,1)
 coef(po)
 coef(po,transform=TRUE)
+guess <- coef(po)
+guess["r"] <- 0
 
+try(
+    mf <- mif(
+              po,
+              start=guess,
+              Nmif=5,Np=1000,
+              transform=TRUE,
+              ic.lag=1,var.factor=1,cooling.factor=0.99,
+              rw.sd=c(r=0.02,K=0.02)
+              )
+    )
+
 set.seed(93848585L)
 mf <- mif(
           po,

Modified: pkg/pomp/tests/gompertz.Rout.save
===================================================================
--- pkg/pomp/tests/gompertz.Rout.save	2012-07-13 13:52:42 UTC (rev 751)
+++ pkg/pomp/tests/gompertz.Rout.save	2012-07-13 16:40:56 UTC (rev 752)
@@ -1,5 +1,5 @@
 
-R version 2.15.0 (2012-03-30)
+R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows"
 Copyright (C) 2012 The R Foundation for Statistical Computing
 ISBN 3-900051-07-0
 Platform: x86_64-unknown-linux-gnu (64-bit)
@@ -44,7 +44,22 @@
 > coef(po,transform=TRUE)
      K      r  sigma    tau    X.0 
  0.000 -1.609 -2.303 -2.303  0.000 
+> guess <- coef(po)
+> guess["r"] <- 0
 > 
+> try(
++     mf <- mif(
++               po,
++               start=guess,
++               Nmif=5,Np=1000,
++               transform=TRUE,
++               ic.lag=1,var.factor=1,cooling.factor=0.99,
++               rw.sd=c(r=0.02,K=0.02)
++               )
++     )
+Error : 'mif' error: mif cannot estimate non-finite parameters.
+The following transformed parameters are non-finite: r
+> 
 > set.seed(93848585L)
 > mf <- mif(
 +           po,
@@ -116,4 +131,4 @@
 > 
 > proc.time()
    user  system elapsed 
-  1.448   0.048   1.509 
+  1.496   0.056   1.567 

Modified: pkg/pomp/tests/ou2-mif.Rout.save
===================================================================
--- pkg/pomp/tests/ou2-mif.Rout.save	2012-07-13 13:52:42 UTC (rev 751)
+++ pkg/pomp/tests/ou2-mif.Rout.save	2012-07-13 16:40:56 UTC (rev 752)
@@ -1,5 +1,5 @@
 
-R version 2.15.0 (2012-03-30)
+R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows"
 Copyright (C) 2012 The R Foundation for Statistical Computing
 ISBN 3-900051-07-0
 Platform: x86_64-unknown-linux-gnu (64-bit)
@@ -167,7 +167,8 @@
 +         Np=11,cooling.factor=0.95,ic.lag=10,var.factor=1
 +         )
 +     )
-Error : 'mif' error: cannot estimate non-finite parameters: alpha.4
+Error : 'mif' error: mif cannot estimate non-finite parameters.
+The following parameters are non-finite: alpha.4
 > 
 > try(
 +     mif(
@@ -179,7 +180,8 @@
 +         Np=11,cooling.factor=0.95,ic.lag=10,var.factor=1
 +         )
 +     )
-Error : 'mif' error: cannot estimate non-finite parameters: x2.0
+Error : 'mif' error: mif cannot estimate non-finite parameters.
+The following parameters are non-finite: x2.0
 > 
 > fit <- mif(
 +            ou2,
@@ -265,4 +267,4 @@
 > 
 > proc.time()
    user  system elapsed 
- 13.108   0.044  13.312 
+ 13.728   0.036  13.921 



More information about the pomp-commits mailing list