[Rcpp-commits] r3528 - in pkg/RcppSMC: . R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Mar 19 01:45:19 CET 2012


Author: edd
Date: 2012-03-19 01:45:18 +0100 (Mon, 19 Mar 2012)
New Revision: 3528

Modified:
   pkg/RcppSMC/ChangeLog
   pkg/RcppSMC/NAMESPACE
   pkg/RcppSMC/R/pfLineartBS.R
   pkg/RcppSMC/man/pfLineartBS.Rd
   pkg/RcppSMC/man/pfNonlinBS.Rd
Log:
helper functions for pfLineartBS renamed too


Modified: pkg/RcppSMC/ChangeLog
===================================================================
--- pkg/RcppSMC/ChangeLog	2012-03-19 00:07:50 UTC (rev 3527)
+++ pkg/RcppSMC/ChangeLog	2012-03-19 00:45:18 UTC (rev 3528)
@@ -1,3 +1,8 @@
+2012-03-18  Dirk Eddelbuettel  <edd at debian.org>
+
+	* R/pfLineartBS.R: Adjust naming of the two helper functions
+	* man/pfLineartBS.Rd: Idem
+
 2012-03-18 Adam Johansen <a.m.johansen at warwick.ac.uk>
 
 	* src/pfEx.cpp renamed to pflineartbs.cpp

Modified: pkg/RcppSMC/NAMESPACE
===================================================================
--- pkg/RcppSMC/NAMESPACE	2012-03-19 00:07:50 UTC (rev 3527)
+++ pkg/RcppSMC/NAMESPACE	2012-03-19 00:45:18 UTC (rev 3528)
@@ -3,6 +3,6 @@
 
 export(blockpfGaussianOpt,
        pfLineartBS,
-       pfExOnlinePlot,
+       pfLineartBSOnlinePlot,
        pfNonlinBS)
 

Modified: pkg/RcppSMC/R/pfLineartBS.R
===================================================================
--- pkg/RcppSMC/R/pfLineartBS.R	2012-03-19 00:07:50 UTC (rev 3527)
+++ pkg/RcppSMC/R/pfLineartBS.R	2012-03-19 00:45:18 UTC (rev 3528)
@@ -2,7 +2,7 @@
 pfLineartBS<- function(data, particles=1000, plot=FALSE, onlinePlot) {
 
     # if no data supplied, use default
-    if (missing(data)) data <- getEx1Data()
+    if (missing(data)) data <- getPfLineartBSData()
 
     if (missing(onlinePlot)) {
         useOnline <- FALSE
@@ -11,7 +11,7 @@
         useOnline <- TRUE
         # set up x11
         x11(width=3,height=3)
-        par(mar=c(3,3,1,1),cex=0.8, pch=19)
+        par(mar=c(3,3,1,1),cex=0.8, pch=19, ask=FALSE)
     }
 
     # more eloquent tests can be added
@@ -37,14 +37,18 @@
 
 # simple convenience function, should probably make the data a
 # data component of the package...
-getEx1Data <- function() {
+getPfLineartBSData <- function() {
     file <- system.file("sampleData", "pf-data.csv", package="RcppSMC")
     dat <- read.table(file, skip=1, header=FALSE, col.names=c("x","y"))
     invisible(dat)
 }
 
-pfExOnlinePlot <- function(xm, ym) {
+pfLineartBSOnlinePlot <- function(xm, ym) {
+    # FIXME: xlim and ylim should be dependent on data, but of course
+    # the online algorithm does not "know" the full dataset as it
+    # works its way through
     plot(xm, ym, xlim=c(-7,0), ylim=c(2,14))
+    # FIXME sleep time should also be a variable
     Sys.sleep(0.05)
 }
 

Modified: pkg/RcppSMC/man/pfLineartBS.Rd
===================================================================
--- pkg/RcppSMC/man/pfLineartBS.Rd	2012-03-19 00:07:50 UTC (rev 3527)
+++ pkg/RcppSMC/man/pfLineartBS.Rd	2012-03-19 00:45:18 UTC (rev 3528)
@@ -1,6 +1,6 @@
 \name{pfLineartBS}
 \alias{pfLineartBS}
-\alias{pfExOnlinePlot}
+\alias{pfLineartBSOnlinePlot}
 \title{Particle Filter Example}
 \description{
   The \code{pfLineartBS} function provides a simple example for
@@ -8,13 +8,13 @@
   the discussion in Section 5.1 of Johansen (2009). A simple 'vehicle
   tracking' problem of 100 observations is solved with 1000 particles.
 
-  The \code{pfExOnlinePlot} function provides a simple default
+  The \code{pfLineartBSOnlinePlot} function provides a simple default
   \sQuote{online} plotting function that is invoked during the
   estimation process. 
 }
 \usage{
   pfLineartBS(data, particles=1000, plot=FALSE, onlinePlot) 
-  pfExOnlinePlot(xm, ym)
+  pfLineartBSOnlinePlot(xm, ym)
 }
 \arguments{
   \item{data}{A two-column matrix or dataframe containing x and y
@@ -52,10 +52,8 @@
 }
 \seealso{The SMCTC paper and code at \url{http://www.jstatsoft.org/v30/i06/paper}.}
 \examples{
-\dontrun{
   res <- pfLineartBS(plot=TRUE)
-  res <- pfLineartBS(onlinePlot=pfExOnlinePlot)
+  res <- pfLineartBS(onlinePlot=pfLineartBSOnlinePlot)
 }
-}
 \author{Adam M. Johansen for SMCTC, Dirk Eddelbuettel for the RcppSMC wrapper.}
 \keyword{programming}

Modified: pkg/RcppSMC/man/pfNonlinBS.Rd
===================================================================
--- pkg/RcppSMC/man/pfNonlinBS.Rd	2012-03-19 00:07:50 UTC (rev 3527)
+++ pkg/RcppSMC/man/pfNonlinBS.Rd	2012-03-19 00:45:18 UTC (rev 3528)
@@ -1,9 +1,9 @@
 \name{pfNonlinBS}
 \alias{pfNonlinBS}
-\title{Block Sampling Particle Filter (Linear Gaussian Model; Optimal Proposal)}
+\title{Nonlinear Block Sampling Particle Filter (Non-Linear / Non-Gaussian State Space)}
 \description{
-  The \code{blockpfGaussianOpt} function provides a simple example for
-  \pkg{RcppSMC}. It is a simple "bootstrap" particle filter which employs
+  The \code{pfNonlinBS} function provides a simple example for
+  \pkg{RcppSMC}. It is a simple \dQuote{bootstrap} particle filter which employs
   multinomial resampling after each iteration applied to the common nonlinear
   state space model following Gordon, Salmond and Smith (1993).
 }



More information about the Rcpp-commits mailing list