[Pomp-commits] r377 - in pkg: R tests
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Oct 11 17:26:01 CEST 2010
Author: kingaa
Date: 2010-10-11 17:26:01 +0200 (Mon, 11 Oct 2010)
New Revision: 377
Added:
pkg/tests/ricker-spect.Rout.save
Modified:
pkg/R/simulate-pomp.R
pkg/tests/ricker-probe.R
pkg/tests/ricker-spect.R
Log:
- fix bug in 'simulate' as applied to objects inheriting from 'pomp'
- add 'tests/ricker-spect.Rout.save'
Modified: pkg/R/simulate-pomp.R
===================================================================
--- pkg/R/simulate-pomp.R 2010-10-10 22:10:01 UTC (rev 376)
+++ pkg/R/simulate-pomp.R 2010-10-11 15:26:01 UTC (rev 377)
@@ -13,6 +13,8 @@
call.=FALSE
)
+ object <- as(object,"pomp")
+
if (missing(times))
times <- time(object,t0=FALSE)
else
@@ -38,7 +40,16 @@
}
retval <- try(
- .Call(simulation_computations,object,params,times,t0,nsim,obs,states),
+ .Call(
+ simulation_computations,
+ object,
+ params,
+ times,
+ t0,
+ nsim,
+ obs,
+ states
+ ),
silent=FALSE
)
Modified: pkg/tests/ricker-probe.R
===================================================================
--- pkg/tests/ricker-probe.R 2010-10-10 22:10:01 UTC (rev 376)
+++ pkg/tests/ricker-probe.R 2010-10-11 15:26:01 UTC (rev 377)
@@ -146,6 +146,8 @@
)
)
plot(pm)
+plot(as(pm,"pomp"),variables="y")
+plot(simulate(pm),variables="y")
cbind(truth=coef(ricker),est=coef(pm),guess=coef(po))
Modified: pkg/tests/ricker-spect.R
===================================================================
--- pkg/tests/ricker-spect.R 2010-10-10 22:10:01 UTC (rev 376)
+++ pkg/tests/ricker-spect.R 2010-10-11 15:26:01 UTC (rev 377)
@@ -37,4 +37,6 @@
plot(sp)
summary(sp)
+plot(simulate(sp),variables="y")
+
dev.off()
Added: pkg/tests/ricker-spect.Rout.save
===================================================================
--- pkg/tests/ricker-spect.Rout.save (rev 0)
+++ pkg/tests/ricker-spect.Rout.save 2010-10-11 15:26:01 UTC (rev 377)
@@ -0,0 +1,95 @@
+
+R version 2.11.1 (2010-05-31)
+Copyright (C) 2010 The R Foundation for Statistical Computing
+ISBN 3-900051-07-0
+
+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)
+>
+> data(ricker)
+>
+> pdf(file="ricker-spect.pdf")
+>
+> set.seed(6457673L)
+>
+> sp <- spect(
++ ricker,
++ kernel.width=3,
++ nsim=1000,
++ seed=838775L
++ )
+> plot(sp)
+> summary(sp)
+$coef
+ log.r log.sigma log.phi N.0 e.0
+ 3.800000 -1.203973 2.302585 7.000000 0.000000
+
+$nsim
+[1] 1000
+
+$pvals
+ y all
+0.6113886 0.6113886
+
+>
+> po <- ricker
+> coef(po,"log.r") <- log(5)
+> sp <- spect(
++ po,
++ kernel.width=3,
++ nsim=1000,
++ seed=838775L
++ )
+> plot(sp)
+> summary(sp)
+$coef
+ log.r log.sigma log.phi N.0 e.0
+ 1.609438 -1.203973 2.302585 7.000000 0.000000
+
+$nsim
+[1] 1000
+
+$pvals
+ y all
+0.000999001 0.000999001
+
+>
+> po <- ricker
+> coef(po,"log.phi") <- log(30)
+> sp <- spect(
++ po,
++ kernel.width=3,
++ nsim=1000,
++ seed=838775L
++ )
+> plot(sp)
+> summary(sp)
+$coef
+ log.r log.sigma log.phi N.0 e.0
+ 3.800000 -1.203973 3.401197 7.000000 0.000000
+
+$nsim
+[1] 1000
+
+$pvals
+ y all
+0.000999001 0.000999001
+
+>
+> plot(simulate(sp),variables="y")
+>
+> dev.off()
+null device
+ 1
+>
More information about the pomp-commits
mailing list