[Pomp-commits] r154 - pkg/tests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jun 24 17:48:22 CEST 2009


Author: kingaa
Date: 2009-06-24 17:48:22 +0200 (Wed, 24 Jun 2009)
New Revision: 154

Modified:
   pkg/tests/rw2.R
   pkg/tests/rw2.Rout.save
Log:
fix tests of 'rw2'

Modified: pkg/tests/rw2.R
===================================================================
--- pkg/tests/rw2.R	2009-06-24 15:19:12 UTC (rev 153)
+++ pkg/tests/rw2.R	2009-06-24 15:48:22 UTC (rev 154)
@@ -126,14 +126,15 @@
 x <- rprocess(rw2,xstart=x0,times=0:100,params=p)
 y <- rmeasure(rw2,x=x,times=0:100,params=p)
 
-log(dprocess(rw2,x[,,6:11],times=5:10,params=p))
-dprocess(rw2,x[,,6:11],times=5:10,params=p,log=T)
+a1 <- dmeasure(rw2,y=y[,1,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p)
+b1 <- dmeasure(rw2,y=y[,2,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p)
+c1 <- log(dmeasure(rw2,y=y[,3,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p))
+d1 <- dmeasure(rw2,y=y[,3,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p,log=T)
+e1 <- dprocess(rw2,x[,,6:11],times=5:10,params=p,log=T)
+f1 <- log(dprocess(rw2,x[,,6:11],times=5:10,params=p))
+max(abs(c1-d1),na.rm=T)
+max(abs(e1-f1),na.rm=T)
 
-dmeasure(rw2,y=y[,1,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p)
-dmeasure(rw2,y=y[,2,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p)
-log(dmeasure(rw2,y=y[,3,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p))
-dmeasure(rw2,y=y[,3,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p,log=T)
-
 po <- pomp(
            rprocess = rw.rprocess,
            dprocess = rw.dprocess,
@@ -147,15 +148,32 @@
            t0=0
            )
 
-dmeasure(po,y=y[,1,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p)
-dmeasure(po,y=y[,2,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p)
-log(dmeasure(po,y=y[,3,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p))
-dmeasure(po,y=y[,3,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p,log=T)
+a2 <- dmeasure(po,y=y[,1,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p)
+b2 <- dmeasure(po,y=y[,2,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p)
+c2 <- log(dmeasure(po,y=y[,3,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p))
+d2 <- dmeasure(po,y=y[,3,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p,log=T)
+e2 <- dprocess(po,x[,,6:11],times=5:10,params=p,log=T)
+f2 <- log(dprocess(rw2,x[,,6:11],times=5:10,params=p))
+max(abs(c2-d2),na.rm=T)
+max(abs(e2-f2),na.rm=T)
 
+max(abs(a1-a2))
+max(abs(b1-b2))
+max(abs(d1-d2),na.rm=T)
+max(abs(e1-e2),na.rm=T)
+
 data(rw2)
 
-dmeasure(po,y=y[,1,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p)
-dmeasure(po,y=y[,2,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p)
-dmeasure(po,y=y[,3,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p,log=T)
-dprocess(rw2,x[,,6:11],times=5:10,params=p,log=T)
+a3 <- dmeasure(po,y=y[,1,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p)
+b3 <- dmeasure(po,y=y[,2,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p)
+c3 <- log(dmeasure(po,y=y[,3,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p))
+d3 <- dmeasure(po,y=y[,3,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p,log=T)
+e3 <- dprocess(po,x[,,6:11],times=5:10,params=p,log=T)
+f3 <- log(dprocess(rw2,x[,,6:11],times=5:10,params=p))
+max(abs(c3-d3),na.rm=T)
+max(abs(e3-f3),na.rm=T)
 
+max(abs(a2-a3))
+max(abs(b2-b3))
+max(abs(d2-d3),na.rm=T)
+max(abs(e2-e3),na.rm=T)

Modified: pkg/tests/rw2.Rout.save
===================================================================
--- pkg/tests/rw2.Rout.save	2009-06-24 15:19:12 UTC (rev 153)
+++ pkg/tests/rw2.Rout.save	2009-06-24 15:48:22 UTC (rev 154)
@@ -320,38 +320,17 @@
 > x <- rprocess(rw2,xstart=x0,times=0:100,params=p)
 > y <- rmeasure(rw2,x=x,times=0:100,params=p)
 > 
-> log(dprocess(rw2,x[,,6:11],times=5:10,params=p))
-           [,1]       [,2]       [,3]       [,4]      [,5]
-[1,] -0.3528305 -0.2613777 -0.2447111 -0.2408028 -1.048260
-[2,] -3.0433899 -3.1306252 -2.6601367 -5.0275855 -2.596964
-[3,] -3.8848651 -4.1398497 -3.6984915 -3.8832277 -6.917348
-> dprocess(rw2,x[,,6:11],times=5:10,params=p,log=T)
-           [,1]       [,2]       [,3]       [,4]      [,5]
-[1,] -0.3528305 -0.2613777 -0.2447111 -0.2408028 -1.048260
-[2,] -3.0433899 -3.1306252 -2.6601367 -5.0275855 -2.596964
-[3,] -3.8848651 -4.1398497 -3.6984915 -3.8832277 -6.917348
+> a1 <- dmeasure(rw2,y=y[,1,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p)
+> b1 <- dmeasure(rw2,y=y[,2,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p)
+> c1 <- log(dmeasure(rw2,y=y[,3,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p))
+> d1 <- dmeasure(rw2,y=y[,3,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p,log=T)
+> e1 <- dprocess(rw2,x[,,6:11],times=5:10,params=p,log=T)
+> f1 <- log(dprocess(rw2,x[,,6:11],times=5:10,params=p))
+> max(abs(c1-d1),na.rm=T)
+[1] 0
+> max(abs(e1-f1),na.rm=T)
+[1] 5.551115e-17
 > 
-> dmeasure(rw2,y=y[,1,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p)
-            [,1]        [,2]       [,3]        [,4]
-[1,] 0.130009525 0.099538380 0.12701912 0.058909910
-[2,] 0.006314898 0.006087434 0.00545215 0.004457682
-[3,] 0.000000000 0.000000000 0.00000000 0.000000000
-> dmeasure(rw2,y=y[,2,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p)
-             [,1]         [,2]         [,3]         [,4]
-[1,] 9.495506e-19 4.639718e-07 0.0001862387 1.388155e-15
-[2,] 1.302891e-03 4.868953e-03 0.0062363554 3.532405e-03
-[3,] 0.000000e+00 0.000000e+00 0.0000000000 0.000000e+00
-> log(dmeasure(rw2,y=y[,3,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p))
-           [,1]      [,2]       [,3]       [,4]
-[1,] -14.337877 -36.84944 -38.275846 -42.466689
-[2,]  -5.556753  -7.28100  -5.747134  -5.499941
-[3,]        Inf       Inf        Inf        Inf
-> dmeasure(rw2,y=y[,3,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p,log=T)
-           [,1]      [,2]       [,3]       [,4]
-[1,] -14.337877 -36.84944 -38.275846 -42.466689
-[2,]  -5.556753  -7.28100  -5.747134  -5.499941
-[3,]        Inf       Inf        Inf        Inf
-> 
 > po <- pomp(
 +            rprocess = rw.rprocess,
 +            dprocess = rw.dprocess,
@@ -365,48 +344,45 @@
 +            t0=0
 +            )
 > 
-> dmeasure(po,y=y[,1,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p)
-            [,1]        [,2]       [,3]        [,4]
-[1,] 0.130009525 0.099538380 0.12701912 0.058909910
-[2,] 0.006314898 0.006087434 0.00545215 0.004457682
-[3,] 0.000000000 0.000000000 0.00000000 0.000000000
-> dmeasure(po,y=y[,2,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p)
-             [,1]         [,2]         [,3]         [,4]
-[1,] 9.495506e-19 4.639718e-07 0.0001862387 1.388155e-15
-[2,] 1.302891e-03 4.868953e-03 0.0062363554 3.532405e-03
-[3,] 0.000000e+00 0.000000e+00 0.0000000000 0.000000e+00
-> log(dmeasure(po,y=y[,3,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p))
-           [,1]      [,2]       [,3]       [,4]
-[1,] -14.337877 -36.84944 -38.275846 -42.466689
-[2,]  -5.556753  -7.28100  -5.747134  -5.499941
-[3,]        Inf       Inf        Inf        Inf
-> dmeasure(po,y=y[,3,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p,log=T)
-           [,1]      [,2]       [,3]       [,4]
-[1,] -14.337877 -36.84944 -38.275846 -42.466689
-[2,]  -5.556753  -7.28100  -5.747134  -5.499941
-[3,]        Inf       Inf        Inf        Inf
+> a2 <- dmeasure(po,y=y[,1,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p)
+> b2 <- dmeasure(po,y=y[,2,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p)
+> c2 <- log(dmeasure(po,y=y[,3,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p))
+> d2 <- dmeasure(po,y=y[,3,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p,log=T)
+> e2 <- dprocess(po,x[,,6:11],times=5:10,params=p,log=T)
+> f2 <- log(dprocess(rw2,x[,,6:11],times=5:10,params=p))
+> max(abs(c2-d2),na.rm=T)
+[1] 0
+> max(abs(e2-f2),na.rm=T)
+[1] 5.551115e-17
 > 
+> max(abs(a1-a2))
+[1] 0
+> max(abs(b1-b2))
+[1] 0
+> max(abs(d1-d2),na.rm=T)
+[1] 0
+> max(abs(e1-e2),na.rm=T)
+[1] 0
+> 
 > data(rw2)
 > 
-> dmeasure(po,y=y[,1,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p)
-            [,1]        [,2]       [,3]        [,4]
-[1,] 0.130009525 0.099538380 0.12701912 0.058909910
-[2,] 0.006314898 0.006087434 0.00545215 0.004457682
-[3,] 0.000000000 0.000000000 0.00000000 0.000000000
-> dmeasure(po,y=y[,2,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p)
-             [,1]         [,2]         [,3]         [,4]
-[1,] 9.495506e-19 4.639718e-07 0.0001862387 1.388155e-15
-[2,] 1.302891e-03 4.868953e-03 0.0062363554 3.532405e-03
-[3,] 0.000000e+00 0.000000e+00 0.0000000000 0.000000e+00
-> dmeasure(po,y=y[,3,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p,log=T)
-           [,1]      [,2]       [,3]       [,4]
-[1,] -14.337877 -36.84944 -38.275846 -42.466689
-[2,]  -5.556753  -7.28100  -5.747134  -5.499941
-[3,]        Inf       Inf        Inf        Inf
-> dprocess(rw2,x[,,6:11],times=5:10,params=p,log=T)
-           [,1]       [,2]       [,3]       [,4]      [,5]
-[1,] -0.3528305 -0.2613777 -0.2447111 -0.2408028 -1.048260
-[2,] -3.0433899 -3.1306252 -2.6601367 -5.0275855 -2.596964
-[3,] -3.8848651 -4.1398497 -3.6984915 -3.8832277 -6.917348
+> a3 <- dmeasure(po,y=y[,1,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p)
+> b3 <- dmeasure(po,y=y[,2,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p)
+> c3 <- log(dmeasure(po,y=y[,3,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p))
+> d3 <- dmeasure(po,y=y[,3,1:4],x=x[,,1:4,drop=F],times=time(rw2)[1:4],p,log=T)
+> e3 <- dprocess(po,x[,,6:11],times=5:10,params=p,log=T)
+> f3 <- log(dprocess(rw2,x[,,6:11],times=5:10,params=p))
+> max(abs(c3-d3),na.rm=T)
+[1] 0
+> max(abs(e3-f3),na.rm=T)
+[1] 5.551115e-17
 > 
+> max(abs(a2-a3))
+[1] 0
+> max(abs(b2-b3))
+[1] 0
+> max(abs(d2-d3),na.rm=T)
+[1] 0
+> max(abs(e2-e3),na.rm=T)
+[1] 0
 > 



More information about the pomp-commits mailing list