[Pomp-commits] r113 - in pkg: data man tests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Apr 28 14:03:31 CEST 2009


Author: kingaa
Date: 2009-04-28 14:03:31 +0200 (Tue, 28 Apr 2009)
New Revision: 113

Added:
   pkg/data/rw2.rda
   pkg/man/rw2.Rd
Modified:
   pkg/tests/rw2.R
   pkg/tests/rw2.Rout.save
Log:
add a new data()-accessible pomp object, coding a very simple 2D random walk

Added: pkg/data/rw2.rda
===================================================================
(Binary files differ)


Property changes on: pkg/data/rw2.rda
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: pkg/man/rw2.Rd
===================================================================
--- pkg/man/rw2.Rd	                        (rev 0)
+++ pkg/man/rw2.Rd	2009-04-28 12:03:31 UTC (rev 113)
@@ -0,0 +1,19 @@
+\name{rw2}
+\alias{rw2}
+\docType{data}
+\title{Two-dimensional random-walk process}
+\description{
+  \code{rw2} is a \code{pomp} object encoding a 2-D normal random walk.
+}
+\usage{data(rw2)}
+\details{
+  The random-walk process is fully but noisily observed.
+}
+\examples{
+data(rw2)
+plot(rw2)
+x <- simulate(rw2,nsim=10,seed=20348585L,params=c(x1.0=0,x2.0=0,s1=1,s2=3,tau=1))
+plot(x[[1]])
+}
+\seealso{\code{\link{pomp-class}} and the vignettes}
+\keyword{datasets}

Modified: pkg/tests/rw2.R
===================================================================
--- pkg/tests/rw2.R	2009-04-28 12:02:31 UTC (rev 112)
+++ pkg/tests/rw2.R	2009-04-28 12:03:31 UTC (rev 113)
@@ -121,37 +121,7 @@
 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)
 
-po <- pomp(
-           rprocess = euler.simulate,
-           dprocess = euler.density,
-           delta.t = 1,
-           step.fun = function(x, t, params, dt, ...) {
-             c(
-               y1=rnorm(n=1,mean=x['x1'],sd=params['s1']),
-               y2=rnorm(n=1,mean=x['x2'],sd=params['s2'])
-               )
-           },
-           dens.fun = function (x1, t1, x2, t2, params, ...) {
-             sum(
-                 dnorm(
-                       x=x2[c('x1','x2')],
-                       mean=x1[c('x1','x2')],
-                       sd=params[c('s1','s2')]
-                       ),
-                 na.rm=TRUE
-                 )
-           },
-           measurement.model=list(
-             y1 ~ norm(mean=x1,sd=tau),
-             y2 ~ norm(mean=x2,sd=tau)
-             ),
-           times=1:100,
-           data=rbind(
-             y1=rep(0,100),
-             y2=rep(0,100)
-             ),
-           t0=0
-           )
+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)

Modified: pkg/tests/rw2.Rout.save
===================================================================
--- pkg/tests/rw2.Rout.save	2009-04-28 12:02:31 UTC (rev 112)
+++ pkg/tests/rw2.Rout.save	2009-04-28 12:03:31 UTC (rev 113)
@@ -1,6 +1,6 @@
 
-R version 2.6.1 (2007-11-26)
-Copyright (C) 2007 The R Foundation for Statistical Computing
+R version 2.8.1 (2008-12-22)
+Copyright (C) 2008 The R Foundation for Statistical Computing
 ISBN 3-900051-07-0
 
 R is free software and comes with ABSOLUTELY NO WARRANTY.
@@ -16,6 +16,8 @@
 Type 'q()' to quit R.
 
 > library(pomp)
+Loading required package: deSolve
+Loading required package: subplex
 > 
 > set.seed(45768683)
 > 
@@ -178,37 +180,7 @@
 [2,]  -5.556753  -7.28100  -5.747134  -5.499941
 [3,]        Inf       Inf        Inf        Inf
 > 
-> po <- pomp(
-+            rprocess = euler.simulate,
-+            dprocess = euler.density,
-+            delta.t = 1,
-+            step.fun = function(x, t, params, dt, ...) {
-+              c(
-+                y1=rnorm(n=1,mean=x['x1'],sd=params['s1']),
-+                y2=rnorm(n=1,mean=x['x2'],sd=params['s2'])
-+                )
-+            },
-+            dens.fun = function (x1, t1, x2, t2, params, ...) {
-+              sum(
-+                  dnorm(
-+                        x=x2[c('x1','x2')],
-+                        mean=x1[c('x1','x2')],
-+                        sd=params[c('s1','s2')]
-+                        ),
-+                  na.rm=TRUE
-+                  )
-+            },
-+            measurement.model=list(
-+              y1 ~ norm(mean=x1,sd=tau),
-+              y2 ~ norm(mean=x2,sd=tau)
-+              ),
-+            times=1:100,
-+            data=rbind(
-+              y1=rep(0,100),
-+              y2=rep(0,100)
-+              ),
-+            t0=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]



More information about the pomp-commits mailing list