[Pomp-commits] r757 - pkg/pomp/tests
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Aug 3 18:19:10 CEST 2012
Author: kingaa
Date: 2012-08-03 18:19:10 +0200 (Fri, 03 Aug 2012)
New Revision: 757
Modified:
pkg/pomp/tests/fhn.R
pkg/pomp/tests/fhn.Rout.save
pkg/pomp/tests/ricker-spect.R
pkg/pomp/tests/ricker-spect.Rout.save
pkg/pomp/tests/ricker.R
pkg/pomp/tests/ricker.Rout.save
pkg/pomp/tests/rw2.R
pkg/pomp/tests/rw2.Rout.save
pkg/pomp/tests/sir.R
pkg/pomp/tests/sir.Rout.save
Log:
- more modifications to test files
Modified: pkg/pomp/tests/fhn.R
===================================================================
--- pkg/pomp/tests/fhn.R 2012-08-03 15:07:45 UTC (rev 756)
+++ pkg/pomp/tests/fhn.R 2012-08-03 16:19:10 UTC (rev 757)
@@ -24,7 +24,7 @@
params <- rbind(a=c(0.7,0.5),b=c(0.8,0.5),c=c(2,5),V.0=c(1,1),R.0=c(0,0),i=c(0.8,0))
skeleton(fhn,x,t=c(0,3),params=params)
y <- trajectory(fhn,params=params,hmax=0.1)
-y[,,599:601]
+invisible(y[,,599:601])
matplot(time(fhn),t(y["V",,]),type='l',lty=1)
plot(y[1,,],y[2,,],type='n')
points(y[1,1,],y[2,1,],pch='.',cex=3,col='black')
@@ -46,9 +46,9 @@
}
)
-skeleton(fhn,x,t=c(0,3),params=params)
+invisible(skeleton(fhn,x,t=c(0,3),params=params))
y <- trajectory(fhn,params=params,hmax=0.01)
-y[,,199:201]
+invisible(y[,,199:201])
matplot(time(fhn),t(y["V",,]),type='l',lty=1)
plot(y[1,,],y[2,,],type='n')
points(y[1,1,],y[2,1,],pch='.',cex=3,col='black')
Modified: pkg/pomp/tests/fhn.Rout.save
===================================================================
--- pkg/pomp/tests/fhn.Rout.save 2012-08-03 15:07:45 UTC (rev 756)
+++ pkg/pomp/tests/fhn.Rout.save 2012-08-03 16:19:10 UTC (rev 757)
@@ -1,5 +1,5 @@
-R version 2.15.0 (2012-03-30)
+R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-unknown-linux-gnu (64-bit)
@@ -57,25 +57,7 @@
R 0.4500000 0.2
> y <- trajectory(fhn,params=params,hmax=0.1)
-> y[,,599:601]
-, , 1
-
- [,1] [,2]
-V 1.7086515 -1.9257830
-R 0.9468273 0.4306572
-
-, , 2
-
- [,1] [,2]
-V 1.684666 -1.9136647
-R 1.027194 0.3981193
-
-, , 3
-
- [,1] [,2]
-V 1.654967 -1.9015481
-R 1.103084 0.3661463
-
+> invisible(y[,,599:601])
> matplot(time(fhn),t(y["V",,]),type='l',lty=1)
> plot(y[1,,],y[2,,],type='n')
> points(y[1,1,],y[2,1,],pch='.',cex=3,col='black')
@@ -97,39 +79,9 @@
+ }
+ )
>
-> skeleton(fhn,x,t=c(0,3),params=params)
-, , 1
-
- [,1] [,2]
-V -2.00 -6.666667
-R -0.05 0.100000
-
-, , 2
-
- [,1] [,2]
-V -0.6666667 5.0
-R 0.4500000 0.2
-
+> invisible(skeleton(fhn,x,t=c(0,3),params=params))
> y <- trajectory(fhn,params=params,hmax=0.01)
-> y[,,199:201]
-, , 1
-
- [,1] [,2]
-V -1.3052919 1.27398107
-R -0.5591608 -0.00692014
-
-, , 2
-
- [,1] [,2]
-V -1.4459045 1.19170161
-R -0.5707824 0.02732499
-
-, , 3
-
- [,1] [,2]
-V -1.4714039 1.32437192
-R -0.5861061 0.06164339
-
+> invisible(y[,,199:201])
> matplot(time(fhn),t(y["V",,]),type='l',lty=1)
> plot(y[1,,],y[2,,],type='n')
> points(y[1,1,],y[2,1,],pch='.',cex=3,col='black')
@@ -141,4 +93,4 @@
>
> proc.time()
user system elapsed
- 0.948 0.032 1.095
+ 1.016 0.044 1.198
Modified: pkg/pomp/tests/ricker-spect.R
===================================================================
--- pkg/pomp/tests/ricker-spect.R 2012-08-03 15:07:45 UTC (rev 756)
+++ pkg/pomp/tests/ricker-spect.R 2012-08-03 16:19:10 UTC (rev 757)
@@ -13,11 +13,11 @@
seed=838775L
)
plot(sp)
-summary(sp)
+invisible(summary(sp))
spp <- spect.match(sp,eval.only=TRUE)
plot(spp)
-summary(spp)
+invisible(summary(sp))
po <- ricker
coef(po,"r") <- 5
@@ -28,7 +28,7 @@
seed=838775L
)
plot(sp)
-summary(sp)
+invisible(summary(sp))
po <- ricker
coef(po,"phi") <- 30
@@ -39,7 +39,7 @@
seed=838775L
)
plot(sp)
-summary(sp)
+invisible(summary(sp))
plot(simulate(sp),variables="y")
Modified: pkg/pomp/tests/ricker-spect.Rout.save
===================================================================
--- pkg/pomp/tests/ricker-spect.Rout.save 2012-08-03 15:07:45 UTC (rev 756)
+++ pkg/pomp/tests/ricker-spect.Rout.save 2012-08-03 16:19:10 UTC (rev 757)
@@ -1,5 +1,5 @@
-R version 2.15.0 (2012-03-30)
+R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-unknown-linux-gnu (64-bit)
@@ -34,48 +34,11 @@
+ seed=838775L
+ )
> plot(sp)
-> summary(sp)
-$coef
- r sigma phi N.0 e.0
-44.70118 0.30000 10.00000 7.00000 0.00000
-
-$nsim
-[1] 1000
-
-$pvals
- y all
-0.6113886 0.6113886
-
+> invisible(summary(sp))
>
> spp <- spect.match(sp,eval.only=TRUE)
> plot(spp)
-> summary(spp)
-$coef
- r sigma phi N.0 e.0
-44.70118 0.30000 10.00000 7.00000 0.00000
-
-$nsim
-[1] 1000
-
-$pvals
- y all
-0.6423576 0.6423576
-
-$est
-character(0)
-
-$value
-[1] 3.242017
-
-$eval
-[1] 1 0
-
-$convergence
-[1] NA
-
-$msg
-[1] "no optimization performed"
-
+> invisible(summary(sp))
>
> po <- ricker
> coef(po,"r") <- 5
@@ -86,18 +49,7 @@
+ seed=838775L
+ )
> plot(sp)
-> summary(sp)
-$coef
- r sigma phi N.0 e.0
- 5.0 0.3 10.0 7.0 0.0
-
-$nsim
-[1] 1000
-
-$pvals
- y all
-0.000999001 0.000999001
-
+> invisible(summary(sp))
>
> po <- ricker
> coef(po,"phi") <- 30
@@ -108,18 +60,7 @@
+ seed=838775L
+ )
> plot(sp)
-> summary(sp)
-$coef
- r sigma phi N.0 e.0
-44.70118 0.30000 30.00000 7.00000 0.00000
-
-$nsim
-[1] 1000
-
-$pvals
- y all
-0.000999001 0.000999001
-
+> invisible(summary(sp))
>
> plot(simulate(sp),variables="y")
>
@@ -129,4 +70,4 @@
>
> proc.time()
user system elapsed
- 2.176 0.056 2.378
+ 2.264 0.064 2.509
Modified: pkg/pomp/tests/ricker.R
===================================================================
--- pkg/pomp/tests/ricker.R 2012-08-03 15:07:45 UTC (rev 756)
+++ pkg/pomp/tests/ricker.R 2012-08-03 16:19:10 UTC (rev 757)
@@ -8,7 +8,7 @@
plot(time(ricker),tj.1[1,,],type='l')
tj.2 <- trajectory(ricker,times=c(30:50),t0=0)
lines(30:50,tj.2[1,,],col='red',lwd=2)
-max(abs(tj.1[,,time(ricker)>=30]-tj.2[,,]))
+stopifnot(max(abs(tj.1[,,time(ricker)>=30]-tj.2[,,]))==0)
tj.3 <- trajectory(ricker,as.data.frame=TRUE)
plot(tj.3)
@@ -22,18 +22,16 @@
stopifnot(max(abs(as.matrix(sm1[names(sm)])-as.matrix(sm)))==0)
sm1 <- simulate(ricker,nsim=3,seed=343995,as.data.frame=TRUE)
-print(names(sm1))
-print(dim(sm1))
+stopifnot(all(names(sm1)==c("time","y","N","e","sim")))
+stopifnot(all(dim(sm1)==c(153,5)))
sm1 <- simulate(ricker,nsim=3,states=T,seed=343995,as.data.frame=TRUE)
-print(names(sm1))
-print(dim(sm1))
-print(tail(sm1))
+stopifnot(all(names(sm1)==c("N","e","sim","time")))
+stopifnot(all(dim(sm1)==c(153,4)))
sm1 <- simulate(ricker,nsim=3,obs=T,seed=343995,as.data.frame=TRUE)
-print(names(sm1))
-print(dim(sm1))
-print(tail(sm1))
+stopifnot(all(names(sm1)==c("y","sim","time")))
+stopifnot(all(dim(sm1)==c(153,3)))
po <- ricker
try(
Modified: pkg/pomp/tests/ricker.Rout.save
===================================================================
--- pkg/pomp/tests/ricker.Rout.save 2012-08-03 15:07:45 UTC (rev 756)
+++ pkg/pomp/tests/ricker.Rout.save 2012-08-03 16:19:10 UTC (rev 757)
@@ -1,5 +1,5 @@
-R version 2.15.0 (2012-03-30)
+R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-unknown-linux-gnu (64-bit)
@@ -29,8 +29,7 @@
> plot(time(ricker),tj.1[1,,],type='l')
> tj.2 <- trajectory(ricker,times=c(30:50),t0=0)
> lines(30:50,tj.2[1,,],col='red',lwd=2)
-> max(abs(tj.1[,,time(ricker)>=30]-tj.2[,,]))
-[1] 0
+> stopifnot(max(abs(tj.1[,,time(ricker)>=30]-tj.2[,,]))==0)
>
> tj.3 <- trajectory(ricker,as.data.frame=TRUE)
> plot(tj.3)
@@ -44,38 +43,16 @@
> stopifnot(max(abs(as.matrix(sm1[names(sm)])-as.matrix(sm)))==0)
>
> sm1 <- simulate(ricker,nsim=3,seed=343995,as.data.frame=TRUE)
-> print(names(sm1))
-[1] "time" "y" "N" "e" "sim"
-> print(dim(sm1))
-[1] 153 5
+> stopifnot(all(names(sm1)==c("time","y","N","e","sim")))
+> stopifnot(all(dim(sm1)==c(153,5)))
>
> sm1 <- simulate(ricker,nsim=3,states=T,seed=343995,as.data.frame=TRUE)
-> print(names(sm1))
-[1] "N" "e" "sim" "time"
-> print(dim(sm1))
-[1] 153 4
-> print(tail(sm1))
- N e sim time
-138 4.0116869 0.05723792 3 45
-141 4.2497654 0.26933885 3 46
-144 2.9300053 0.07790589 3 47
-147 7.1162605 0.01738347 3 48
-150 0.2366483 -0.08730222 3 49
-153 18.9946973 0.82198849 3 50
+> stopifnot(all(names(sm1)==c("N","e","sim","time")))
+> stopifnot(all(dim(sm1)==c(153,4)))
>
> sm1 <- simulate(ricker,nsim=3,obs=T,seed=343995,as.data.frame=TRUE)
-> print(names(sm1))
-[1] "y" "sim" "time"
-> print(dim(sm1))
-[1] 153 3
-> print(tail(sm1))
- y sim time
-138 36 3 45
-141 44 3 46
-144 27 3 47
-147 73 3 48
-150 1 3 49
-153 218 3 50
+> stopifnot(all(names(sm1)==c("y","sim","time")))
+> stopifnot(all(dim(sm1)==c(153,3)))
>
> po <- ricker
> try(
@@ -106,4 +83,4 @@
>
> proc.time()
user system elapsed
- 0.552 0.032 0.678
+ 0.508 0.028 0.665
Modified: pkg/pomp/tests/rw2.R
===================================================================
--- pkg/pomp/tests/rw2.R 2012-08-03 15:07:45 UTC (rev 756)
+++ pkg/pomp/tests/rw2.R 2012-08-03 16:19:10 UTC (rev 757)
@@ -91,7 +91,7 @@
useless=23
)
-show(rw2)
+invisible(show(rw2))
try(
simulate(rw2,params=p)
@@ -145,8 +145,8 @@
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)
+stopifnot(max(abs(c1-d1),na.rm=T)<.Machine$double.eps*100)
+stopifnot(max(abs(e1-f1),na.rm=T)<.Machine$double.eps*100)
po <- pomp(
rw2,
@@ -160,13 +160,13 @@
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)
+stopifnot(max(abs(c2-d2),na.rm=T)<.Machine$double.eps*100)
+stopifnot(max(abs(e2-f2),na.rm=T)<.Machine$double.eps*100)
-max(abs(a1-a2))
-max(abs(b1-b2))
-max(abs(d1-d2),na.rm=T)
-max(abs(e1-e2),na.rm=T)
+stopifnot(max(abs(a1-a2),na.rm=T)<.Machine$double.eps*100)
+stopifnot(max(abs(b1-b2),na.rm=T)<.Machine$double.eps*100)
+stopifnot(max(abs(d1-d2),na.rm=T)<.Machine$double.eps*100)
+stopifnot(max(abs(e1-e2),na.rm=T)<.Machine$double.eps*100)
data(rw2)
@@ -176,24 +176,24 @@
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)
+stopifnot(max(abs(c3-d3),na.rm=T)<.Machine$double.eps*100)
+stopifnot(max(abs(e3-f3),na.rm=T)<.Machine$double.eps*100)
-max(abs(a2-a3))
-max(abs(b2-b3))
-max(abs(d2-d3),na.rm=T)
-max(abs(e2-e3),na.rm=T)
+stopifnot(max(abs(a2-a3),na.rm=T)<.Machine$double.eps*100)
+stopifnot(max(abs(b2-b3),na.rm=T)<.Machine$double.eps*100)
+stopifnot(max(abs(d2-d3),na.rm=t)<.Machine$double.eps*100)
+stopifnot(max(abs(e2-e3),na.rm=t)<.Machine$double.eps*100)
new <- window(rw2,start=20,end=30)
new <- simulate(new)
-timezero(new)
+invisible(timezero(new))
timezero(new) <- 19
print(simulate(new))
time(rw2) <- seq(1,1000,by=20)
x <- simulate(rw2)
-states(x)[,1:5]
+invisible(states(x)[,1:5])
try(
time(rw2) <- seq(-20,1000,by=20)
)
@@ -206,5 +206,3 @@
time(rw2,t0=TRUE) <- c(0,20,25.8,50,60)
time(rw2,t0=TRUE) <- c(0,0,20,25.8,50,60)
time(rw2) <- c(0,20,25.8,50,60)
-
-
Modified: pkg/pomp/tests/rw2.Rout.save
===================================================================
--- pkg/pomp/tests/rw2.Rout.save 2012-08-03 15:07:45 UTC (rev 756)
+++ pkg/pomp/tests/rw2.Rout.save 2012-08-03 16:19:10 UTC (rev 757)
@@ -1,5 +1,5 @@
-R version 2.15.0 (2012-03-30)
+R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-unknown-linux-gnu (64-bit)
@@ -112,7 +112,7 @@
+ useless=23
+ )
>
-> show(rw2)
+> invisible(show(rw2))
data and states:
time y1 y2
1 1 0 0
@@ -260,7 +260,7 @@
}
y
}
-<environment: 0x20ff908>
+<environment: 0x216d088>
measurement model density, dmeasure =
function (y, x, t, params, log, covars, ...)
{
@@ -273,11 +273,11 @@
f
else exp(f)
}
-<environment: 0x20ff908>
+<environment: 0x216d088>
skeleton ( map ) =
function (x, t, params, covars, ...)
stop(sQuote("skeleton"), " not specified")
-<environment: 0x10f26a0>
+<environment: 0x2181870>
initializer =
function (params, t0, ...)
{
@@ -352,10 +352,8 @@
> 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] 1.110223e-16
+> stopifnot(max(abs(c1-d1),na.rm=T)<.Machine$double.eps*100)
+> stopifnot(max(abs(e1-f1),na.rm=T)<.Machine$double.eps*100)
>
> po <- pomp(
+ rw2,
@@ -369,19 +367,13 @@
> 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] 1.110223e-16
+> stopifnot(max(abs(c2-d2),na.rm=T)<.Machine$double.eps*100)
+> stopifnot(max(abs(e2-f2),na.rm=T)<.Machine$double.eps*100)
>
-> 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
+> stopifnot(max(abs(a1-a2),na.rm=T)<.Machine$double.eps*100)
+> stopifnot(max(abs(b1-b2),na.rm=T)<.Machine$double.eps*100)
+> stopifnot(max(abs(d1-d2),na.rm=T)<.Machine$double.eps*100)
+> stopifnot(max(abs(e1-e2),na.rm=T)<.Machine$double.eps*100)
>
> data(rw2)
>
@@ -391,25 +383,18 @@
> 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] 1.110223e-16
+> stopifnot(max(abs(c3-d3),na.rm=T)<.Machine$double.eps*100)
+> stopifnot(max(abs(e3-f3),na.rm=T)<.Machine$double.eps*100)
>
-> 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
+> stopifnot(max(abs(a2-a3),na.rm=T)<.Machine$double.eps*100)
+> stopifnot(max(abs(b2-b3),na.rm=T)<.Machine$double.eps*100)
+> stopifnot(max(abs(d2-d3),na.rm=t)<.Machine$double.eps*100)
+> stopifnot(max(abs(e2-e3),na.rm=t)<.Machine$double.eps*100)
>
> new <- window(rw2,start=20,end=30)
> new <- simulate(new)
>
-> timezero(new)
-[1] 0
+> invisible(timezero(new))
> timezero(new) <- 19
> print(simulate(new))
data and states:
@@ -428,10 +413,7 @@
>
> time(rw2) <- seq(1,1000,by=20)
> x <- simulate(rw2)
-> states(x)[,1:5]
- [,1] [,2] [,3] [,4] [,5]
-x1 -0.7441705 17.50995 -9.474945 -0.9377728 16.73823
-x2 -0.2655504 -75.53129 65.187445 45.3769880 -55.62340
+> invisible(states(x)[,1:5])
> try(
+ time(rw2) <- seq(-20,1000,by=20)
+ )
@@ -449,8 +431,6 @@
> time(rw2,t0=TRUE) <- c(0,0,20,25.8,50,60)
> time(rw2) <- c(0,20,25.8,50,60)
>
->
->
> proc.time()
user system elapsed
- 0.840 0.016 0.872
+ 0.876 0.048 0.940
Modified: pkg/pomp/tests/sir.R
===================================================================
--- pkg/pomp/tests/sir.R 2012-08-03 15:07:45 UTC (rev 756)
+++ pkg/pomp/tests/sir.R 2012-08-03 16:19:10 UTC (rev 757)
@@ -234,13 +234,13 @@
)
print(h2[c("S","I","R"),,],digits=4)
-print(max(abs(g2-g1),na.rm=T),digits=4)
-print(max(abs(h2-h1),na.rm=T),digits=4)
+stopifnot(max(abs(g2-g1),na.rm=T)<.Machine$double.eps*100)
+stopifnot(max(abs(h2-h1),na.rm=T)<.Machine$double.eps*2^16)
-states(po)[,1:2]
+invisible(states(po)[,1:2])
time(po) <- seq(0,1,by=1/52)
-states(po)[,1:3]
-states(simulate(po))[,1:3]
+invisible(states(po)[,1:3])
+invisible(states(simulate(po))[,1:3])
po <- window(euler.sir,start=1,end=2)
plot(simulate(po))
Modified: pkg/pomp/tests/sir.Rout.save
===================================================================
--- pkg/pomp/tests/sir.Rout.save 2012-08-03 15:07:45 UTC (rev 756)
+++ pkg/pomp/tests/sir.Rout.save 2012-08-03 16:19:10 UTC (rev 757)
@@ -393,7 +393,7 @@
zeronames = zeronames, tcovar = tcovar, covar = covar,
args = pairlist(...))
}
-<environment: 0x28d9c78>
+<environment: 0x1528b48>
process model density, dprocess =
function (x, times, params, ..., statenames = character(0), paramnames = character(0),
covarnames = character(0), tcovar, covar, log = FALSE)
@@ -403,7 +403,7 @@
covarnames = covarnames, tcovar = tcovar, covar = covar,
log = log, args = pairlist(...))
}
-<environment: 0x18821e0>
+<environment: 0x1ecd438>
measurement model simulator, rmeasure =
function (x, t, params, covars, ...)
{
@@ -467,7 +467,7 @@
> x <- simulate(po,nsim=3)
> toc <- Sys.time()
> print(toc-tic)
-Time difference of 1.041633 secs
+Time difference of 1.111769 secs
>
> pdf(file='sir.pdf')
>
@@ -484,7 +484,7 @@
> X3 <- trajectory(po,times=t3,hmax=1/52)
> toc <- Sys.time()
> print(toc-tic)
-Time difference of 0.6949608 secs
+Time difference of 0.6951504 secs
> plot(t3,X3['I',1,],type='l')
>
> f1 <- dprocess(
@@ -534,7 +534,7 @@
> x <- simulate(po,nsim=100)
> toc <- Sys.time()
> print(toc-tic)
-Time difference of 1.300245 secs
+Time difference of 1.314703 secs
> plot(x[[1]],variables=c("S","I","R","cases","W"))
>
> t3 <- seq(0,20,by=1/52)
@@ -542,7 +542,7 @@
> X4 <- trajectory(po,times=t3,hmax=1/52)
> toc <- Sys.time()
> print(toc-tic)
-Time difference of 0.008083344 secs
+Time difference of 0.008133173 secs
> plot(t3,X4['I',1,],type='l')
>
> g2 <- dmeasure(
@@ -572,33 +572,13 @@
I 518.5 675.3 768.6 868.8 996.8 1074 1187 1278
R -31549.7 -30472.3 -30226.0 -29798.8 -29007.2 -28580 -27634 -26740
>
-> print(max(abs(g2-g1),na.rm=T),digits=4)
-[1] 7.105e-15
-> print(max(abs(h2-h1),na.rm=T),digits=4)
-[1] 7.276e-12
+> stopifnot(max(abs(g2-g1),na.rm=T)<.Machine$double.eps*100)
+> stopifnot(max(abs(h2-h1),na.rm=T)<.Machine$double.eps*2^16)
>
-> states(po)[,1:2]
- [,1] [,2]
-S 1.361160e+05 1.357770e+05
-I 2.066000e+03 2.074000e+03
-R 1.961786e+06 1.962120e+06
-cases 1.049000e+03 1.060000e+03
-W 6.596952e-02 9.166551e-02
+> invisible(states(po)[,1:2])
> time(po) <- seq(0,1,by=1/52)
-> states(po)[,1:3]
- [,1] [,2] [,3]
-S NA 1.361160e+05 1.357770e+05
-I NA 2.066000e+03 2.074000e+03
-R NA 1.961786e+06 1.962120e+06
-cases NA 1.049000e+03 1.060000e+03
-W NA 6.596952e-02 9.166551e-02
-> states(simulate(po))[,1:3]
- [,1] [,2] [,3]
-S 136364 1.360240e+05 1.357070e+05
-I 2098 2.164000e+03 2.218000e+03
-R 1961538 1.961821e+06 1.962178e+06
-cases 0 9.990000e+02 1.076000e+03
-W 0 -1.381354e-02 3.473754e-01
+> invisible(states(po)[,1:3])
+> invisible(states(simulate(po))[,1:3])
>
> po <- window(euler.sir,start=1,end=2)
> plot(simulate(po))
@@ -655,4 +635,4 @@
>
> proc.time()
user system elapsed
- 4.052 0.052 4.349
+ 4.176 0.040 4.452
More information about the pomp-commits
mailing list