[Pomp-commits] r105 - pkg/data

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Apr 26 18:04:58 CEST 2009


Author: kingaa
Date: 2009-04-26 18:04:56 +0200 (Sun, 26 Apr 2009)
New Revision: 105

Added:
   pkg/data/euler.sir.rda
   pkg/data/ou2.rda
Removed:
   pkg/data/euler.sir.R
   pkg/data/ou2.R
Log:
It turns out not to work to use R files in the 'data' directory if these involve actual computations.  It appears that, during the package check process, the shared-object library is loaded *after* the data files are read.  Consequently, the simulations used to generate the pomp objects in 'ou2.R' and 'euler.sir.R' will not work.  As a temporary fix, I have replaced these with binary files containing the objects.  I do not yet have a satisfactory way of including the code used to generate these into the package yet.

Deleted: pkg/data/euler.sir.R
===================================================================
--- pkg/data/euler.sir.R	2009-04-24 20:58:10 UTC (rev 104)
+++ pkg/data/euler.sir.R	2009-04-26 16:04:56 UTC (rev 105)
@@ -1,54 +0,0 @@
-require(pomp)
-
-euler.sir <- simulate(
-                      pomp(
-                           times=seq(1/52,4,by=1/52),
-                           data=rbind(measles=numeric(52*4)),
-                           t0=0,
-                           tcovar=seq(0,25,by=1/52),
-                           covar=matrix(
-                             periodic.bspline.basis(seq(0,25,by=1/52),nbasis=3,period=1,degree=3),
-                             ncol=3,
-                             dimnames=list(NULL,paste("seas",1:3,sep=''))
-                             ),
-                           delta.t=1/52/20,
-                           statenames=c("S","I","R","cases","W","B","dW"),
-                           paramnames=c("gamma","mu","iota","beta1","beta.sd","pop","rho"),
-                           covarnames=c("seas1"),
-                           zeronames=c("cases"),
-                           comp.names=c("S","I","R"),
-                           step.fun="sir_euler_simulator",
-                           rprocess=euler.simulate,
-                           dens.fun="sir_euler_density",
-                           dprocess=euler.density,
-                           skeleton.vectorfield="sir_ODE",
-                           rmeasure="binom_rmeasure",
-                           dmeasure="binom_dmeasure",
-                           PACKAGE="pomp",
-                           initializer=function(params, t0, comp.names, ...){
-                             p <- exp(params)
-                             snames <- c(
-                                         "S","I","R","cases","W","B",
-                                         "SI","SD","IR","ID","RD","dW"
-                                         )
-                             fracs <- p[paste(comp.names,"0",sep=".")]
-                             x0 <- numeric(length(snames))
-                             names(x0) <- snames
-                             x0[comp.names] <- round(p['pop']*fracs/sum(fracs))
-                             x0
-                           }
-                           ),
-                      params=log(
-                        c(
-                          gamma=26,mu=0.02,iota=0.01,
-                          beta1=1200,beta2=1800,beta3=600,
-                          beta.sd=1e-3,
-                          pop=2.1e6,
-                          rho=0.6,
-                          S.0=26/1200,I.0=0.001,R.0=1-0.001-26/1200
-                          )
-                        ),
-                      nsim=1,
-                      seed=329348545L
-                      )
-euler.sir <- euler.sir[[1]]

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


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

Deleted: pkg/data/ou2.R
===================================================================
--- pkg/data/ou2.R	2009-04-24 20:58:10 UTC (rev 104)
+++ pkg/data/ou2.R	2009-04-26 16:04:56 UTC (rev 105)
@@ -1,77 +0,0 @@
-require(pomp)
-ou2 <- pomp( 
-	    times=seq(1,100),
-	    data=rbind(
-	      y1=rep(0,100),
-	      y2=rep(0,100)
-	      ),
-	    t0=0,
-            rprocess = function (xstart, times, params, paramnames, ...) {
-              nvar <- nrow(xstart)
-              npar <- nrow(params)
-              nrep <- ncol(xstart)
-              ntimes <- length(times)
-              ## get indices of the various parameters in the 'params' matrix
-              ## C uses zero-based indexing!
-              parindex <- match(paramnames,rownames(params))-1
-              array(
-                    .C("ou2_adv",
-                       X = double(nvar*nrep*ntimes),
-                       xstart = as.double(xstart),
-                       par = as.double(params),
-                       times = as.double(times),
-                       n = as.integer(c(nvar,npar,nrep,ntimes)),
-                       parindex = as.integer(parindex),
-                       DUP = FALSE,
-                       NAOK = TRUE,
-                       PACKAGE = "pomp"
-                       )$X,
-                    dim=c(nvar,nrep,ntimes),
-                    dimnames=list(rownames(xstart),NULL,NULL)
-                    )
-            },
-            dprocess = function (x, times, params, log, ...) {
-              nvar <- nrow(x)
-              npar <- nrow(params)
-              nrep <- ncol(x)
-              ntimes <- length(times)
-              parindex <- match(paramnames,rownames(params))-1
-              array(
-                    .C("ou2_pdf",
-                       d = double(nrep*(ntimes-1)),
-                       X = as.double(x),
-                       par = as.double(params),
-                       times = as.double(times),
-                       n = as.integer(c(nvar,npar,nrep,ntimes)),
-                       parindex = as.integer(parindex),
-                       give_log=as.integer(log),
-                       DUP = FALSE,
-                       NAOK = TRUE,
-                       PACKAGE = "pomp"
-                       )$d,
-                    dim=c(nrep,ntimes-1)
-                    )
-            },
-	    dmeasure = "normal_dmeasure",
-	    rmeasure = "normal_rmeasure",
-            obsnames = c("y1","y2"),
-            paramnames = c(
-              "alpha.1","alpha.2","alpha.3","alpha.4",
-              "sigma.1","sigma.2","sigma.3",
-              "tau"
-              ),
-            statenames = c("x1","x2")
-	    )
-
-ou2 <- simulate(
-                ou2,
-                params=c(
-                  alpha.1=0.9,alpha.2=0,alpha.3=0,alpha.4=0.99,
-                  sigma.1=1,sigma.2=0,sigma.3=2,
-                  tau=1,x1.0=50,x2.0=-50
-                  ),
-                nsim=1,
-                seed=377456545L
-                )
-
-ou2 <- ou2[[1]]

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


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



More information about the pomp-commits mailing list