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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Feb 1 16:17:40 CET 2015


Author: kingaa
Date: 2015-02-01 16:17:40 +0100 (Sun, 01 Feb 2015)
New Revision: 1067

Modified:
   pkg/pomp/DESCRIPTION
   pkg/pomp/R/pfilter.R
Log:
- make sure that filter.mean, pred.mean, and pred.var have named dimnames (for optimum interaction with 'reshape2')

Modified: pkg/pomp/DESCRIPTION
===================================================================
--- pkg/pomp/DESCRIPTION	2015-01-31 15:59:49 UTC (rev 1066)
+++ pkg/pomp/DESCRIPTION	2015-02-01 15:17:40 UTC (rev 1067)
@@ -1,7 +1,7 @@
 Package: pomp
 Type: Package
 Title: Statistical Inference for Partially Observed Markov Processes
-Version: 0.58-8
+Version: 0.58-9
 Date: 2015-01-31
 Authors at R: c(person(given=c("Aaron","A."),family="King",
 		role=c("aut","cre"),email="kingaa at umich.edu"),

Modified: pkg/pomp/R/pfilter.R
===================================================================
--- pkg/pomp/R/pfilter.R	2015-01-31 15:59:49 UTC (rev 1066)
+++ pkg/pomp/R/pfilter.R	2015-02-01 15:17:40 UTC (rev 1067)
@@ -118,14 +118,16 @@
   ptsi.for <- FALSE
   
   ## set up storage for saving samples from filtering distributions
-  if (save.states)
-    xparticles <- vector(mode="list",length=ntimes)
-  else
+  if (save.states) {
+    xparticles <- setNames(vector(mode="list",length=ntimes),time(object))
+  } else {
     xparticles <- list()
-  if (save.params)
-    pparticles <- vector(mode="list",length=ntimes)
-  else
+  }
+  if (save.params) {
+    pparticles <- setNames(vector(mode="list",length=ntimes),time(object))
+  } else {
     pparticles <- list()
+  }
   
   random.walk <- !missing(.rw.sd)
   if (random.walk) {
@@ -155,7 +157,9 @@
                      data=0,
                      nrow=nvars+npars,
                      ncol=ntimes,
-                     dimnames=list(c(statenames,rw.names),NULL)
+                     dimnames=list(
+                       variable=c(statenames,rw.names),
+                       time=time(object))
                      )
   else
     pred.m <- array(data=numeric(0),dim=c(0,0))
@@ -165,7 +169,9 @@
                      data=0,
                      nrow=nvars+npars,
                      ncol=ntimes,
-                     dimnames=list(c(statenames,rw.names),NULL)
+                     dimnames=list(
+                       variable=c(statenames,rw.names),
+                       time=time(object))
                      )
   else
     pred.v <- array(data=numeric(0),dim=c(0,0))
@@ -176,14 +182,18 @@
                        data=0,
                        nrow=nvars+length(paramnames),
                        ncol=ntimes,
-                       dimnames=list(c(statenames,paramnames),NULL)
+                       dimnames=list(
+                         variable=c(statenames,paramnames),
+                         time=time(object))
                        )
     else
       filt.m <- matrix(
                        data=0,
                        nrow=nvars,
                        ncol=ntimes,
-                       dimnames=list(statenames,NULL)
+                       dimnames=list(
+                         variable=statenames,
+                         time=time(object))
                        )
   else
     filt.m <- array(data=numeric(0),dim=c(0,0))



More information about the pomp-commits mailing list