[Pomp-commits] r1089 - pkg/pomp/tests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Feb 22 20:43:39 CET 2015


Author: kingaa
Date: 2015-02-22 20:43:39 +0100 (Sun, 22 Feb 2015)
New Revision: 1089

Modified:
   pkg/pomp/tests/ou2-abc.R
   pkg/pomp/tests/ou2-abc.Rout.save
   pkg/pomp/tests/ou2-pmcmc.R
   pkg/pomp/tests/ou2-pmcmc.Rout.save
Log:
- update tests

Modified: pkg/pomp/tests/ou2-abc.R
===================================================================
--- pkg/pomp/tests/ou2-abc.R	2015-02-22 19:43:32 UTC (rev 1088)
+++ pkg/pomp/tests/ou2-abc.R	2015-02-22 19:43:39 UTC (rev 1089)
@@ -58,10 +58,11 @@
 abc3 <- continue(abc3,Nabc=3000)
 plot(abc3)
 
-sig <- matrix(c(0.01,0.005,0.005,0.01),
-              2,2,
-              dimnames=list(c("alpha.1","alpha.2"),
-                c("alpha.1","alpha.2")))
+sig <- array(data=c(0.1,0.02,0,0.1),
+             dim=c(2,2),
+             dimnames=list(c("alpha.1","alpha.2"),
+               c("alpha.1","alpha.2")))
+sig <- crossprod(sig)
 
 abc4 <- abc(probe(po,probes=probes.good,nsim=200),
             Nabc=2000,

Modified: pkg/pomp/tests/ou2-abc.Rout.save
===================================================================
--- pkg/pomp/tests/ou2-abc.Rout.save	2015-02-22 19:43:32 UTC (rev 1088)
+++ pkg/pomp/tests/ou2-abc.Rout.save	2015-02-22 19:43:39 UTC (rev 1089)
@@ -82,10 +82,11 @@
 > abc3 <- continue(abc3,Nabc=3000)
 > plot(abc3)
 > 
-> sig <- matrix(c(0.01,0.005,0.005,0.01),
-+               2,2,
-+               dimnames=list(c("alpha.1","alpha.2"),
-+                 c("alpha.1","alpha.2")))
+> sig <- array(data=c(0.1,0.02,0,0.1),
++              dim=c(2,2),
++              dimnames=list(c("alpha.1","alpha.2"),
++                c("alpha.1","alpha.2")))
+> sig <- crossprod(sig)
 > 
 > abc4 <- abc(probe(po,probes=probes.good,nsim=200),
 +             Nabc=2000,
@@ -138,4 +139,4 @@
 > 
 > proc.time()
    user  system elapsed 
- 12.322   0.033  12.359 
+ 11.422   0.073  11.497 

Modified: pkg/pomp/tests/ou2-pmcmc.R
===================================================================
--- pkg/pomp/tests/ou2-pmcmc.R	2015-02-22 19:43:32 UTC (rev 1088)
+++ pkg/pomp/tests/ou2-pmcmc.R	2015-02-22 19:43:39 UTC (rev 1089)
@@ -80,5 +80,27 @@
 plot(window(conv.rec(ff[2:3],c("alpha.3")),thin=3,start=2))
 plot(conv.rec(ff[[3]],c("alpha.3")))
 
+sig <- array(data=c(0.1,-0.1,0,0.01),
+             dim=c(2,2),
+             dimnames=list(
+               c("alpha.2","alpha.3"),
+               c("alpha.2","alpha.3")))
+sig <- crossprod(sig)
+
+f7 <- pmcmc(
+            pomp(ou2,
+                 dprior=function (params, log, ...) {
+                   f <- sum(dnorm(params,mean=coef(ou2),sd=1,log=TRUE))
+                   if (log) f else exp(f)
+                 }
+                 ),
+            Nmcmc=30,
+            proposal=mvn.rw(sig),
+            Np=100,
+            max.fail=100, 
+            verbose=FALSE
+            )
+plot(f7)
+
 dev.off()
 

Modified: pkg/pomp/tests/ou2-pmcmc.Rout.save
===================================================================
--- pkg/pomp/tests/ou2-pmcmc.Rout.save	2015-02-22 19:43:32 UTC (rev 1088)
+++ pkg/pomp/tests/ou2-pmcmc.Rout.save	2015-02-22 19:43:39 UTC (rev 1089)
@@ -109,6 +109,28 @@
 > plot(window(conv.rec(ff[2:3],c("alpha.3")),thin=3,start=2))
 > plot(conv.rec(ff[[3]],c("alpha.3")))
 > 
+> sig <- array(data=c(0.1,-0.1,0,0.01),
++              dim=c(2,2),
++              dimnames=list(
++                c("alpha.2","alpha.3"),
++                c("alpha.2","alpha.3")))
+> sig <- crossprod(sig)
+> 
+> f7 <- pmcmc(
++             pomp(ou2,
++                  dprior=function (params, log, ...) {
++                    f <- sum(dnorm(params,mean=coef(ou2),sd=1,log=TRUE))
++                    if (log) f else exp(f)
++                  }
++                  ),
++             Nmcmc=30,
++             proposal=mvn.rw(sig),
++             Np=100,
++             max.fail=100, 
++             verbose=FALSE
++             )
+> plot(f7)
+> 
 > dev.off()
 null device 
           1 
@@ -116,4 +138,4 @@
 > 
 > proc.time()
    user  system elapsed 
- 28.001   0.048  28.080 
+ 28.662   0.057  28.743 



More information about the pomp-commits mailing list