[Pomp-commits] r855 - in pkg/pomp: . R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue May 14 21:47:30 CEST 2013


Author: kingaa
Date: 2013-05-14 21:47:29 +0200 (Tue, 14 May 2013)
New Revision: 855

Modified:
   pkg/pomp/DESCRIPTION
   pkg/pomp/R/profile-design.R
   pkg/pomp/inst/NEWS
   pkg/pomp/man/profile-design.Rd
Log:
- 'profileDesign' can now handle arguments of mixed type


Modified: pkg/pomp/DESCRIPTION
===================================================================
--- pkg/pomp/DESCRIPTION	2013-04-22 12:02:38 UTC (rev 854)
+++ pkg/pomp/DESCRIPTION	2013-05-14 19:47:29 UTC (rev 855)
@@ -1,8 +1,8 @@
 Package: pomp
 Type: Package
 Title: Statistical inference for partially observed Markov processes
-Version: 0.44-4
-Date: 2013-04-17
+Version: 0.45-1
+Date: 2013-05-14
 Maintainer: Aaron A. King <kingaa at umich.edu>
 Authors at R: c(person(given=c("Aaron","A."),family="King",role=c("aut","cre"),email="kingaa at umich.edu"),
 	  person(given=c("Edward","L."),family="Ionides",role=c("aut")),

Modified: pkg/pomp/R/profile-design.R
===================================================================
--- pkg/pomp/R/profile-design.R	2013-04-22 12:02:38 UTC (rev 854)
+++ pkg/pomp/R/profile-design.R	2013-05-14 19:47:29 UTC (rev 855)
@@ -1,4 +1,5 @@
-profileDesign <- function (..., lower, upper, nprof) {
+profileDesign <- function (..., lower, upper, nprof,
+                           stringsAsFactors = default.stringsAsFactors()) {
   prof <- list(...)
   pvars <- names(prof)
   if (any(pvars==""))
@@ -7,16 +8,16 @@
   if (!all(sort(ovars)==sort(names(upper))))
     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(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
-  for (j in seq_len(nrow(x))) {
-    for (k in seq_len(nrow(y))) {
-      z[i,] <- c(x[j,],y[k,])
-      i <- i+1
-    }
+  x <- expand.grid(...,stringsAsFactors=stringsAsFactors)
+  y <- sobolDesign(lower=lower,upper=upper,nseq=nprof)
+  z <- vector(mode='list',length=nrow(x)*nprof)
+  for (i in seq_len(nrow(x))) {
+    z[[i]] <- data.frame(
+                         x[i,,drop=FALSE],y,
+                         check.rows=FALSE,
+                         check.names=FALSE,
+                         row.names=seq_len(nprof)
+                         )
   }
-  as.data.frame(z)
+  do.call(rbind,z)
 }

Modified: pkg/pomp/inst/NEWS
===================================================================
--- pkg/pomp/inst/NEWS	2013-04-22 12:02:38 UTC (rev 854)
+++ pkg/pomp/inst/NEWS	2013-05-14 19:47:29 UTC (rev 855)
@@ -1,4 +1,7 @@
 NEWS
+0.45-1
+     o	'profileDesign' can now handle variables of mixed type.
+
 0.44-1
      o	New 'mif2' option for 'mif'.
 

Modified: pkg/pomp/man/profile-design.Rd
===================================================================
--- pkg/pomp/man/profile-design.Rd	2013-04-22 12:02:38 UTC (rev 854)
+++ pkg/pomp/man/profile-design.Rd	2013-05-14 19:47:29 UTC (rev 855)
@@ -5,7 +5,8 @@
   \code{profileDesign} generates a data-frame where each row can be used as the starting point for a profile likelihood calculation.
 }
 \usage{
-profileDesign(\dots, lower, upper, nprof)
+profileDesign(\dots, lower, upper, nprof,
+              stringsAsFactors = default.stringsAsFactors())
 }
 \arguments{
   \item{\dots}{
@@ -17,6 +18,9 @@
   \item{nprof}{
     The number of starts per profile point.
   }
+  \item{stringsAsFactors}{
+    should character vectors be converted to factors?
+  }
 }
 \value{
   \code{profileDesign} returns a data frame with \code{nprof} points per profile point.



More information about the pomp-commits mailing list