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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Aug 19 18:28:00 CEST 2010


Author: kingaa
Date: 2010-08-19 18:27:59 +0200 (Thu, 19 Aug 2010)
New Revision: 291

Added:
   pkg/tests/ou2-probe-match.R
   pkg/tests/ou2-probe-match.Rout.save
Modified:
   pkg/DESCRIPTION
   pkg/NAMESPACE
   pkg/R/bsmc.R
Log:
- add in tests for probe matching


Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	2010-08-04 16:13:15 UTC (rev 290)
+++ pkg/DESCRIPTION	2010-08-19 16:27:59 UTC (rev 291)
@@ -2,7 +2,7 @@
 Type: Package
 Title: Statistical inference for partially observed Markov processes
 Version: 0.32-1
-Date: 2010-08-03
+Date: 2010-08-19
 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/NAMESPACE
===================================================================
--- pkg/NAMESPACE	2010-08-04 16:13:15 UTC (rev 290)
+++ pkg/NAMESPACE	2010-08-19 16:27:59 UTC (rev 291)
@@ -28,7 +28,7 @@
 exportMethods(
               'plot','show','print','coerce',
               'dprocess','rprocess','rmeasure','dmeasure','init.state','skeleton',
-              'data.array','coef','logLik','time','time<-','timezero','timezero<-','window',
+              'data.array','summary','coef','logLik','time','time<-','timezero','timezero<-','window',
               'simulate','pfilter',
               'particles','mif','continue','coef<-','states','trajectory',
               'pred.mean','pred.var','filter.mean','conv.rec',

Modified: pkg/R/bsmc.R
===================================================================
--- pkg/R/bsmc.R	2010-08-04 16:13:15 UTC (rev 290)
+++ pkg/R/bsmc.R	2010-08-19 16:27:59 UTC (rev 291)
@@ -264,7 +264,7 @@
 
               ## Matrix with samples (columns) from filtering distribution theta.t | Y.t
               if (!all.fail) {
-                ## smp <- .Call(systematic_resampling,weights,PACKAGE="pomp.devel")
+                ## smp <- .Call(systematic_resampling,weights)
                 smp <- sample.int(n=Np,size=Np,replace=TRUE,prob=weights)
                 x <- x[,smp,drop=FALSE]
                 params[estind,] <- params[estind,smp,drop=FALSE]

Added: pkg/tests/ou2-probe-match.R
===================================================================
--- pkg/tests/ou2-probe-match.R	                        (rev 0)
+++ pkg/tests/ou2-probe-match.R	2010-08-19 16:27:59 UTC (rev 291)
@@ -0,0 +1,45 @@
+library(pomp)
+set.seed(1066L)
+
+data(ou2)
+po <- ou2
+coef(po,c("x1.0","x2.0","alpha.1","alpha.4")) <- c(0,0,0.1,0.2)
+
+pm.ou2 <- probe(
+                ou2,
+                probes=list(
+                  y1.mean=probe.mean(var="y1"),
+                  y2.mean=probe.mean(var="y2"),
+                  y1.sd=probe.sd(var="y1"),
+                  y2.sd=probe.sd(var="y2")
+                  ),
+                nsim=500
+                )
+pm.po <- probe(
+               po,
+               probes=list(
+                 y1.mean=probe.mean(var="y1"),
+                 y2.mean=probe.mean(var="y2"),
+                 y1.sd=probe.sd(var="y1"),
+                 y2.sd=probe.sd(var="y2")
+                 ),
+               nsim=500
+               )
+
+summary(pm.ou2)
+summary(pm.po)
+
+plot(pm.ou2)
+plot(pm.po)
+
+pm.ou2 <- probe(
+                ou2,
+                probes=list(
+                  y1.lag3=probe.acf(var="y1",lag=3,type="corr"),
+                  y2.cov12=probe.cov(vars=c("y1"),lag=12,method="spearman"),
+                  y12.cov8=probe.cov(vars=c("y2","y1"),lag=8,method="pearson")
+                  ),
+                nsim=500
+                )
+                
+summary(pm.ou2)

Added: pkg/tests/ou2-probe-match.Rout.save
===================================================================
--- pkg/tests/ou2-probe-match.Rout.save	                        (rev 0)
+++ pkg/tests/ou2-probe-match.Rout.save	2010-08-19 16:27:59 UTC (rev 291)
@@ -0,0 +1,109 @@
+
+R version 2.12.0 Under development (unstable) (2010-08-18 r52775)
+Copyright (C) 2010 The R Foundation for Statistical Computing
+ISBN 3-900051-07-0
+Platform: x86_64-unknown-linux-gnu (64-bit)
+
+R is free software and comes with ABSOLUTELY NO WARRANTY.
+You are welcome to redistribute it under certain conditions.
+Type 'license()' or 'licence()' for distribution details.
+
+R is a collaborative project with many contributors.
+Type 'contributors()' for more information and
+'citation()' on how to cite R or R packages in publications.
+
+Type 'demo()' for some demos, 'help()' for on-line help, or
+'help.start()' for an HTML browser interface to help.
+Type 'q()' to quit R.
+
+> library(pomp)
+> set.seed(1066L)
+> 
+> data(ou2)
+> po <- ou2
+> coef(po,c("x1.0","x2.0","alpha.1","alpha.4")) <- c(0,0,0.1,0.2)
+> 
+> pm.ou2 <- probe(
++                 ou2,
++                 probes=list(
++                   y1.mean=probe.mean(var="y1"),
++                   y2.mean=probe.mean(var="y2"),
++                   y1.sd=probe.sd(var="y1"),
++                   y2.sd=probe.sd(var="y2")
++                   ),
++                 nsim=500
++                 )
+> pm.po <- probe(
++                po,
++                probes=list(
++                  y1.mean=probe.mean(var="y1"),
++                  y2.mean=probe.mean(var="y2"),
++                  y1.sd=probe.sd(var="y1"),
++                  y2.sd=probe.sd(var="y2")
++                  ),
++                nsim=500
++                )
+> 
+> summary(pm.ou2)
+$coef
+alpha.1 alpha.2 alpha.3 alpha.4 sigma.1 sigma.2 sigma.3     tau    x1.0    x2.0 
+    0.8    -0.5     0.3     0.9     3.0    -0.5     2.0     1.0    -3.0     4.0 
+
+$nsim
+[1] 500
+
+$quantiles
+y1.mean y2.mean   y1.sd   y2.sd 
+  0.100   0.530   0.024   0.052 
+
+$pvals
+   y1.mean    y2.mean      y1.sd      y2.sd 
+0.20359281 0.93812375 0.05189621 0.10778443 
+
+> summary(pm.po)
+$coef
+alpha.1 alpha.2 alpha.3 alpha.4 sigma.1 sigma.2 sigma.3     tau    x1.0    x2.0 
+    0.1    -0.5     0.3     0.2     3.0    -0.5     2.0     1.0     0.0     0.0 
+
+$nsim
+[1] 500
+
+$quantiles
+y1.mean y2.mean   y1.sd   y2.sd 
+  0.054   0.644   1.000   1.000 
+
+$pvals
+  y1.mean   y2.mean     y1.sd     y2.sd 
+0.1117764 0.7105788 0.0000000 0.0000000 
+
+> 
+> plot(pm.ou2)
+> plot(pm.po)
+> 
+> pm.ou2 <- probe(
++                 ou2,
++                 probes=list(
++                   y1.lag3=probe.acf(var="y1",lag=3,type="corr"),
++                   y2.cov12=probe.cov(vars=c("y1"),lag=12,method="spearman"),
++                   y12.cov8=probe.cov(vars=c("y2","y1"),lag=8,method="pearson")
++                   ),
++                 nsim=500
++                 )
+>                 
+> summary(pm.ou2)
+$coef
+alpha.1 alpha.2 alpha.3 alpha.4 sigma.1 sigma.2 sigma.3     tau    x1.0    x2.0 
+    0.8    -0.5     0.3     0.9     3.0    -0.5     2.0     1.0    -3.0     4.0 
+
+$nsim
+[1] 500
+
+$quantiles
+ y1.lag3 y2.cov12 y12.cov8 
+   0.110    0.726    0.462 
+
+$pvals
+  y1.lag3  y2.cov12  y12.cov8 
+0.2235529 0.5469062 0.9261477 
+
+> 



More information about the pomp-commits mailing list