[Pomp-commits] r326 - in pkg: . R src tests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Sep 26 01:34:54 CEST 2010


Author: kingaa
Date: 2010-09-26 01:34:53 +0200 (Sun, 26 Sep 2010)
New Revision: 326

Modified:
   pkg/DESCRIPTION
   pkg/R/probe-match.R
   pkg/R/probe.R
   pkg/src/probe.c
   pkg/tests/ricker-probe.R
Log:
- fix bug with unnamed probes


Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	2010-09-24 15:59:53 UTC (rev 325)
+++ pkg/DESCRIPTION	2010-09-25 23:34:53 UTC (rev 326)
@@ -2,7 +2,7 @@
 Type: Package
 Title: Statistical inference for partially observed Markov processes
 Version: 0.33-1
-Date: 2010-09-24
+Date: 2010-09-25
 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>

Modified: pkg/R/probe-match.R
===================================================================
--- pkg/R/probe-match.R	2010-09-24 15:59:53 UTC (rev 325)
+++ pkg/R/probe-match.R	2010-09-25 23:34:53 UTC (rev 326)
@@ -46,7 +46,7 @@
                   params=params,
                   seed=seed,
                   probes=probes,
-                  pnames=names(datval)
+                  datval=datval
                   )
   
   ## compute a measure of the discrepancies between simulations and data

Modified: pkg/R/probe.R
===================================================================
--- pkg/R/probe.R	2010-09-24 15:59:53 UTC (rev 325)
+++ pkg/R/probe.R	2010-09-25 23:34:53 UTC (rev 326)
@@ -44,7 +44,15 @@
             ## apply probes to data
             datval <- .Call(apply_probe_data,object,probes)
             ## apply probes to model simulations
-            simval <- .Call(apply_probe_sim,object,nsim,coef(object),seed,probes,names(datval))
+            simval <- .Call(
+                            apply_probe_sim,
+                            object,
+                            nsim,
+                            coef(object),
+                            seed,
+                            probes,
+                            datval
+                            )
                             
             nprobes <- length(datval)
             pvals <- numeric(nprobes)

Modified: pkg/src/probe.c
===================================================================
--- pkg/src/probe.c	2010-09-24 15:59:53 UTC (rev 325)
+++ pkg/src/probe.c	2010-09-25 23:34:53 UTC (rev 326)
@@ -26,9 +26,9 @@
   return retval;
 }
 
-SEXP apply_probe_sim (SEXP object, SEXP nsim, SEXP params, SEXP seed, SEXP probes, SEXP names) {
+SEXP apply_probe_sim (SEXP object, SEXP nsim, SEXP params, SEXP seed, SEXP probes, SEXP datval) {
   int nprotect = 0;
-  SEXP y, obs, call;
+  SEXP y, obs, call, names;
   SEXP retval, val, valnames, x;
   int nprobe, nsims, nvars, ntimes, nvals;
   int xdim[2];
@@ -42,8 +42,8 @@
   // 'names' holds the names of the probe values
   // we get these from a previous call to 'apply_probe_data'
   nprobe = LENGTH(probes);
-  nvals = LENGTH(names);
-  PROTECT(names = AS_CHARACTER(names)); nprotect++; 
+  nvals = LENGTH(datval);
+  PROTECT(names = GET_NAMES(datval)); nprotect++; 
 
   // call 'simulate' to get simulated data sets
   PROTECT(obs = NEW_LOGICAL(1)); nprotect++;

Modified: pkg/tests/ricker-probe.R
===================================================================
--- pkg/tests/ricker-probe.R	2010-09-24 15:59:53 UTC (rev 325)
+++ pkg/tests/ricker-probe.R	2010-09-25 23:34:53 UTC (rev 326)
@@ -10,6 +10,13 @@
 po <- ricker
 pb <- probe(
             po,
+            probes=probe.median("y"),
+            nsim=1000,
+            seed=838775L
+            )
+
+pb <- probe(
+            po,
             probes=probe.marginal(
               var="y",
               transform=sqrt,



More information about the pomp-commits mailing list