[Pomp-commits] r554 - in pkg: . R inst man tests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Aug 31 16:12:41 CEST 2011


Author: kingaa
Date: 2011-08-31 16:12:40 +0200 (Wed, 31 Aug 2011)
New Revision: 554

Modified:
   pkg/NAMESPACE
   pkg/R/profile-design.R
   pkg/R/slice-design.R
   pkg/R/sobol.R
   pkg/inst/NEWS
   pkg/inst/TODO
   pkg/man/profile-design.Rd
   pkg/man/slice-design.Rd
   pkg/man/sobol.Rd
   pkg/tests/ou2-mif.R
   pkg/tests/ou2-mif.Rout.save
   pkg/tests/sir-icfit.R
Log:
- deprecate 'sobol.design' and 'slice.design' in favor of 'sobolDesign' and 'sliceDesign'


Modified: pkg/NAMESPACE
===================================================================
--- pkg/NAMESPACE	2011-08-31 13:51:08 UTC (rev 553)
+++ pkg/NAMESPACE	2011-08-31 14:12:40 UTC (rev 554)
@@ -66,7 +66,9 @@
        onestep.dens,
        gillespie.sim,
        sobol,
+       sobolDesign,
        sobol.design,
+       sliceDesign,
        slice.design,
        profileDesign,
        profile.design,

Modified: pkg/R/profile-design.R
===================================================================
--- pkg/R/profile-design.R	2011-08-31 13:51:08 UTC (rev 553)
+++ pkg/R/profile-design.R	2011-08-31 14:12:40 UTC (rev 554)
@@ -13,7 +13,7 @@
     stop(sQuote("profileDesign"),": names of ",sQuote("lower")," and ",sQuote("upper")," must match!")
   vars <- ovars[!(ovars%in%pvars)]
   x <- as.matrix(expand.grid(...))
-  y <- as.matrix(sobol.design(lower=lower,upper=upper,nseq=nprof))
+  y <- as.matrix(sobolDesign(lower=lower,upper=upper,nseq=nprof))
   z <- array(dim=c(nrow(x)*nrow(y),ncol(x)+ncol(y)))
   colnames(z) <- c(colnames(x),colnames(y))
   i <- 1

Modified: pkg/R/slice-design.R
===================================================================
--- pkg/R/slice-design.R	2011-08-31 13:51:08 UTC (rev 553)
+++ pkg/R/slice-design.R	2011-08-31 14:12:40 UTC (rev 554)
@@ -1,14 +1,19 @@
 slice.design <- function (center, ...) {
+  .Deprecated(new="sliceDesign",package="pomp")
+  sliceDesign(center,...)
+}
+
+sliceDesign <- function (center, ...) {
   slices <- list(...)
   if ((!is.numeric(center))||is.null(names(center)))
-    stop(sQuote("slice.design"),": ",sQuote("center")," must be a named numeric vector")
+    stop(sQuote("sliceDesign"),": ",sQuote("center")," must be a named numeric vector")
   slnm <- names(slices)
   if (any(slnm==""))
-    stop(sQuote("slice.design"),": you cannot slice along an unnamed parameter")
+    stop(sQuote("sliceDesign"),": you cannot slice along an unnamed parameter")
   if (!all(slnm%in%names(center))) {
     problems <- slnm[!(slnm%in%names(center))]
     stop(
-         sQuote("slice.design"),
+         sQuote("sliceDesign"),
          " error: variable(s) ",
          sQuote(paste(problems,collapse=",")),
          " do not appear in ",

Modified: pkg/R/sobol.R
===================================================================
--- pkg/R/sobol.R	2011-08-31 13:51:08 UTC (rev 553)
+++ pkg/R/sobol.R	2011-08-31 14:12:40 UTC (rev 554)
@@ -17,6 +17,11 @@
 }
 
 sobol.design <- function (lower = numeric(0), upper = numeric(0), nseq) {
+  .Deprecated(new="sobolDesign",package="pomp")
+  sobolDesign(lower,upper,nseq)
+}
+
+sobolDesign <- function (lower = numeric(0), upper = numeric(0), nseq) {
   if (length(lower)!=length(upper))
     stop(sQuote("lower")," and ",sQuote("upper")," must have same length")
   lnames <- names(lower)

Modified: pkg/inst/NEWS
===================================================================
--- pkg/inst/NEWS	2011-08-31 13:51:08 UTC (rev 553)
+++ pkg/inst/NEWS	2011-08-31 14:12:40 UTC (rev 554)
@@ -4,9 +4,12 @@
      	The latter are interpolated, if necessary, at the observation times.
 
      o	Bug fix: when 'pfilter' is called with a single parameter vector supplied in the 'params' argument, these parameters are copied into the 'params' slot of the resulting 'pfilterd.pomp' object.
+     	Before, this failed when the 'params' slot of the 'pomp' object was empty.
+	A similar bug existed in 'traj.match' and has likewise been fixed.
 
      o	To eliminate warnings and confusion during package check, 'profile.design' has been replaced by 'profileDesign'.
-     	The former is now deprecated and will be removed in a future release.
+     	For parallelism, 'slice.design' and 'sobol.design' have been replaced by 'sliceDesign' and 'sobolDesign', respectively.
+     	The older forms are now deprecated and will be removed in a future release.
 
 0.39-1
      o	New facilities for parameter transformation are provided.

Modified: pkg/inst/TODO
===================================================================
--- pkg/inst/TODO	2011-08-31 13:51:08 UTC (rev 553)
+++ pkg/inst/TODO	2011-08-31 14:12:40 UTC (rev 554)
@@ -20,3 +20,9 @@
 * Parallel 'pfilter' algorithm.
 
 * Add LPA model example.
+
+* Extended Kalman filter.
+
+* Plugin for compartmental models.
+
+* Adaptive particle numbers in pfilter.

Modified: pkg/man/profile-design.Rd
===================================================================
--- pkg/man/profile-design.Rd	2011-08-31 13:51:08 UTC (rev 553)
+++ pkg/man/profile-design.Rd	2011-08-31 14:12:40 UTC (rev 554)
@@ -23,7 +23,7 @@
 \value{
   \code{profileDesign} returns a data frame with \code{nprof} points per profile point.
   The other parameters in \code{vars} are sampled using \code{sobol}.
-  The second form (\code{profile.design}) is now deprecated.
+  The equivalent form (\code{profile.design}) is now deprecated.
 }
 \seealso{\code{\link{sobol}}}
 \author{Aaron A. King \email{kingaa at umich dot edu}}

Modified: pkg/man/slice-design.Rd
===================================================================
--- pkg/man/slice-design.Rd	2011-08-31 13:51:08 UTC (rev 553)
+++ pkg/man/slice-design.Rd	2011-08-31 14:12:40 UTC (rev 554)
@@ -1,10 +1,12 @@
-\name{slice.design}
+\name{sliceDesign}
+\alias{sliceDesign}
 \alias{slice.design}
 \title{Design matrices for likelihood slices.}
 \description{
-  \code{slice.design} generates a data-frame representing points taken along one or more slices through a point in a multidimensional space.
+  \code{sliceDesign} generates a data-frame representing points taken along one or more slices through a point in a multidimensional space.
 }
 \usage{
+sliceDesign(center, ...)
 slice.design(center, ...)
 }
 \arguments{
@@ -16,18 +18,19 @@
   }
 }
 \value{
-  \code{slice.design} returns a data frame with one row per point along a slice.
+  \code{sliceDesign} returns a data frame with one row per point along a slice.
   The column \code{slice} is a factor that tells which slice each point belongs to. 
+  The equivalent form (\code{slice.design}) is now deprecated.
 }
 \seealso{\code{\link{profile.design}}}
 \author{Aaron A. King \email{kingaa at umich dot edu}}
 \examples{
 ## A single 11-point slice through the point c(A=3,B=8,C=0) along the B direction.
-x <- slice.design(center=c(A=3,B=8,C=0),B=seq(0,10,by=1))
+x <- sliceDesign(center=c(A=3,B=8,C=0),B=seq(0,10,by=1))
 dim(x)
 plot(x)
 ## Two slices through the same point along the A and C directions.
-x <- slice.design(c(A=3,B=8,C=0),A=seq(0,5,by=1),C=seq(0,5,length=11))
+x <- sliceDesign(c(A=3,B=8,C=0),A=seq(0,5,by=1),C=seq(0,5,length=11))
 dim(x)
 plot(x)
 }

Modified: pkg/man/sobol.Rd
===================================================================
--- pkg/man/sobol.Rd	2011-08-31 13:51:08 UTC (rev 553)
+++ pkg/man/sobol.Rd	2011-08-31 14:12:40 UTC (rev 554)
@@ -1,5 +1,6 @@
 \name{sobol}
 \alias{sobol}
+\alias{sobolDesign}
 \alias{sobol.design}
 \title{Sobol' low-discrepancy sequence}
 \description{
@@ -7,6 +8,7 @@
 }
 \usage{
 sobol(vars, n)
+sobolDesign(lower, upper, nseq)
 sobol.design(lower, upper, nseq)
 }
 \arguments{
@@ -18,8 +20,9 @@
   \item{sobol}{
     Returns a data frame with \code{n} \sQuote{observations} of the variables in \code{vars}.
   }
-  \item{sobol.design}{
+  \item{sobolDesign}{
     Returns a data frame with \code{nseq} \sQuote{observations} of the variables over the range specified.
+    The equivalent form \code{sobol.design} is now deprecated and will be removed in a future release.
   }
 }
 \references{
@@ -27,10 +30,10 @@
   Numerical Recipes in C,
   Cambridge University Press, 1992
 }
-\seealso{\code{\link{slice.design}}, \code{\link{profile.design}}}
+\seealso{\code{\link{sliceDesign}}, \code{\link{profileDesign}}}
 \author{Aaron A. King \email{kingaa at umich dot edu}}
 \examples{
 plot(sobol(vars=list(a=c(0,1),b=c(100,200)),100))
-plot(sobol.design(lower=c(a=0,b=100),upper=c(b=200,a=1),100))
+plot(sobolDesign(lower=c(a=0,b=100),upper=c(b=200,a=1),100))
 }
 \keyword{design}

Modified: pkg/tests/ou2-mif.R
===================================================================
--- pkg/tests/ou2-mif.R	2011-08-31 13:51:08 UTC (rev 553)
+++ pkg/tests/ou2-mif.R	2011-08-31 14:12:40 UTC (rev 554)
@@ -194,18 +194,3 @@
            }
            )
 pp <- particles(fit,Np=10,center=coef(fit),sd=abs(0.1*coef(fit)))
-
-## mp <- mif.profile.design(
-##                          ou2,
-##                          profile=list(
-##                            alpha.1=seq(0.5,0.9,by=0.1),
-##                            alpha.4=seq(0.5,0.9,by=0.1),
-##                            sigma.1=1,sigma.2=0,sigma.3=1,
-##                            x1.0=0,x2.0=0
-##                            ),
-##                          lower=c(alpha.2=-1,alpha.3=-1,tau=0.01),
-##                          upper=c(alpha.2=1,alpha.3=1,tau=3),
-##                          nprof=5,
-##                          rw.sd=c(alpha.2=0.2,alpha.3=0.2,tau=0.1),
-##                          Np=100,cooling.factor=0.95,ic.lag=10,var.factor=1
-##                          )

Modified: pkg/tests/ou2-mif.Rout.save
===================================================================
--- pkg/tests/ou2-mif.Rout.save	2011-08-31 13:51:08 UTC (rev 553)
+++ pkg/tests/ou2-mif.Rout.save	2011-08-31 14:12:40 UTC (rev 554)
@@ -262,18 +262,3 @@
 +            )
 > pp <- particles(fit,Np=10,center=coef(fit),sd=abs(0.1*coef(fit)))
 > 
-> ## mp <- mif.profile.design(
-> ##                          ou2,
-> ##                          profile=list(
-> ##                            alpha.1=seq(0.5,0.9,by=0.1),
-> ##                            alpha.4=seq(0.5,0.9,by=0.1),
-> ##                            sigma.1=1,sigma.2=0,sigma.3=1,
-> ##                            x1.0=0,x2.0=0
-> ##                            ),
-> ##                          lower=c(alpha.2=-1,alpha.3=-1,tau=0.01),
-> ##                          upper=c(alpha.2=1,alpha.3=1,tau=3),
-> ##                          nprof=5,
-> ##                          rw.sd=c(alpha.2=0.2,alpha.3=0.2,tau=0.1),
-> ##                          Np=100,cooling.factor=0.95,ic.lag=10,var.factor=1
-> ##                          )
-> 

Modified: pkg/tests/sir-icfit.R
===================================================================
--- pkg/tests/sir-icfit.R	2011-08-31 13:51:08 UTC (rev 553)
+++ pkg/tests/sir-icfit.R	2011-08-31 14:12:40 UTC (rev 554)
@@ -105,7 +105,7 @@
 np <- 10000                              # number of particles to use
 pp <- array(coef(po),dim=c(length(coef(po)),np),dimnames=list(names(coef(po)),NULL))
 ## generate an array of guesses
-guesses <- sobol.design(lower=guess[est]-0.5,upper=guess[est]+0.5,nseq=np)
+guesses <- sobolDesign(lower=guess[est]-0.5,upper=guess[est]+0.5,nseq=np)
 nd <- length(time(po))
 
 ## fit the initial conditions using repeated filtering on the initial window of the data
@@ -118,11 +118,11 @@
     pf <- pfilter(po,params=pp,save.params=TRUE)
     pp <- pf at saved.params[[nd]]
   }
-  guesses <- sobol.design(
-                          lower=apply(pp[est,],1,min),
-                          upper=apply(pp[est,],1,max),
-                          nseq=np
-                          )
+  guesses <- sobolDesign(
+                         lower=apply(pp[est,],1,min),
+                         upper=apply(pp[est,],1,max),
+                         nseq=np
+                         )
 }
 
 pf.fit <- po



More information about the pomp-commits mailing list