[Pomp-commits] r1093 - in pkg/pompExamples: . inst inst/examples man tests vignettes

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Feb 25 13:18:36 CET 2015


Author: kingaa
Date: 2015-02-25 13:18:35 +0100 (Wed, 25 Feb 2015)
New Revision: 1093

Modified:
   pkg/pompExamples/DESCRIPTION
   pkg/pompExamples/inst/NEWS
   pkg/pompExamples/inst/NEWS.Rd
   pkg/pompExamples/inst/examples/parus.R
   pkg/pompExamples/man/parus.Rd
   pkg/pompExamples/tests/parus.R
   pkg/pompExamples/tests/parus.Rout.save
   pkg/pompExamples/vignettes/parus.Rmd
Log:
- reconfigure parus major example

Modified: pkg/pompExamples/DESCRIPTION
===================================================================
--- pkg/pompExamples/DESCRIPTION	2015-02-23 14:05:48 UTC (rev 1092)
+++ pkg/pompExamples/DESCRIPTION	2015-02-25 12:18:35 UTC (rev 1093)
@@ -1,8 +1,8 @@
 Package: pompExamples
 Type: Package
 Title: Additional pomp examples
-Version: 0.26-6
-Date: 2015-02-11
+Version: 0.27-1
+Date: 2015-02-25
 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"),

Modified: pkg/pompExamples/inst/NEWS
===================================================================
--- pkg/pompExamples/inst/NEWS	2015-02-23 14:05:48 UTC (rev 1092)
+++ pkg/pompExamples/inst/NEWS	2015-02-25 12:18:35 UTC (rev 1093)
@@ -1,5 +1,10 @@
 _N_e_w_s _f_o_r _P_a_c_k_a_g_e '_p_o_m_p_E_x_a_m_p_l_e_s'
 
+_C_h_a_n_g_e_s _i_n '_p_o_m_p_E_x_a_m_p_l_e_s' _v_e_r_s_i_o_n _0._2_7-_1:
+
+        • _Parus major_ example (‘pompExample(parus)’) reworked
+          slightly.
+
 _C_h_a_n_g_e_s _i_n '_p_o_m_p_E_x_a_m_p_l_e_s' _v_e_r_s_i_o_n _0._2_4-_1:
 
         • Examples included in the package can now be accessed using

Modified: pkg/pompExamples/inst/NEWS.Rd
===================================================================
--- pkg/pompExamples/inst/NEWS.Rd	2015-02-23 14:05:48 UTC (rev 1092)
+++ pkg/pompExamples/inst/NEWS.Rd	2015-02-25 12:18:35 UTC (rev 1093)
@@ -1,5 +1,10 @@
 \name{NEWS}
 \title{News for Package 'pompExamples'}
+\section{Changes in \pkg{pompExamples} version 0.27-1}{
+  \itemize{
+    \item \emph{Parus major} example (\code{pompExample(parus)}) reworked slightly.
+  }
+}
 \section{Changes in \pkg{pompExamples} version 0.24-1}{
   \itemize{
     \item Examples included in the package can now be accessed using \pkg{pomp}'s \code{pompExample} function.

Modified: pkg/pompExamples/inst/examples/parus.R
===================================================================
--- pkg/pompExamples/inst/examples/parus.R	2015-02-23 14:05:48 UTC (rev 1092)
+++ pkg/pompExamples/inst/examples/parus.R	2015-02-25 12:18:35 UTC (rev 1093)
@@ -50,8 +50,8 @@
 
 dat <- read.csv(text=dat,comment.char="#")
 
-parus.example <- function (proc = c("Gompertz","Ricker"),
-                           meas = c("lognormal","Poisson","negbin")) {
+parus <- function (proc = c("Gompertz","Ricker"),
+                   meas = c("lognormal","Poisson","negbin")) {
 
   proc <- match.arg(proc)
   meas <- match.arg(meas)
@@ -101,6 +101,4 @@
        )
 }
 
-parus <- parus.example(proc,meas)
-
 c("parus")

Modified: pkg/pompExamples/man/parus.Rd
===================================================================
--- pkg/pompExamples/man/parus.Rd	2015-02-23 14:05:48 UTC (rev 1092)
+++ pkg/pompExamples/man/parus.Rd	2015-02-25 12:18:35 UTC (rev 1093)
@@ -3,10 +3,14 @@
 \alias{parus}
 \title{POMPs for time series of Parus major population counts from Wytham Wood}
 \description{
-  \code{pompExample(parus,proc,meas)} constructs a \code{pomp} object containing one of several population-dynamics models and abundance data from Parus major in Wytham Wood.
+  \code{pompExample(parus)} constructs a function that constructs \code{pomp} objects implementing each of several population-dynamics models and abundance data from Parus major in Wytham Wood.
 
-  The model has one state variables, \eqn{N_t}, the true abundance.
+  The model has one state variable, \eqn{N_t}, the true abundance.
   There is one observable, \eqn{\mathrm{pop}_t}.
+
+  The function defined is: \preformatted{
+  parus(proc = c("Gompertz", "Ricker"),
+        meas = c("lognormal","Poisson","negbin"))}
 }
 \section{State process}{
   If \code{proc="Gompertz"}, the state process is the stochastic Gompertz model
@@ -31,12 +35,14 @@
   \deqn{\mathrm{pop}_{t} \sim \mathrm{Lognormal}(\log(N_t),\theta).}
 }
 \examples{
-pompExample(parus,proc="Ricker",meas="negbin")
-plot(parus)
-plot(simulate(parus))
+pompExample(parus)
+p1 <- parus(proc="Ricker",meas="negbin") 
+plot(p1)
+plot(simulate(p1))
 
-pompExample(parus,proc="Gompertz",meas="lognormal")
-plot(simulate(parus))
+p2 <- parus(proc="Gompertz",meas="lognormal")
+plot(simulate(p2))
+pf <- pfilter(p2,Np=1000)
 }
 \seealso{\code{vignette("parus")}}
 \keyword{models,datasets}

Modified: pkg/pompExamples/tests/parus.R
===================================================================
--- pkg/pompExamples/tests/parus.R	2015-02-23 14:05:48 UTC (rev 1092)
+++ pkg/pompExamples/tests/parus.R	2015-02-25 12:18:35 UTC (rev 1093)
@@ -2,19 +2,21 @@
 
 set.seed(47575684L)
 
-po <- pompExample(parus,proc="Ricker",meas="lognormal",envir=NULL)
-pf <- pfilter(simulate(po$parus),Np=100,max.fail=Inf)
-tj <- trajectory(po$parus)
+pompExample(parus)
 
-po <- pompExample(parus,proc="Ricker",meas="negbin",envir=NULL)
-pf <- pfilter(simulate(po$parus),Np=100,max.fail=Inf)
+po <- parus(proc="Ricker",meas="lognormal")
+pf <- pfilter(simulate(po),Np=100,max.fail=Inf)
+tj <- trajectory(po)
 
-po <- pompExample(parus,proc="Ricker",meas="Poisson",envir=NULL)
-pf <- pfilter(simulate(po$parus),Np=100,max.fail=Inf)
+po <- parus(proc="Ricker",meas="negbin")
+pf <- pfilter(simulate(po),Np=100,max.fail=Inf)
 
-po <- pompExample(parus,proc="Gompertz",meas="Poisson",envir=NULL)
-pf <- pfilter(simulate(po[[1]]),Np=100,max.fail=Inf)
-tj <- trajectory(po[[1]])
+po <- parus(proc="Ricker",meas="Poisson")
+pf <- pfilter(simulate(po),Np=100,max.fail=Inf)
 
-po <- pompExample(parus,proc="Gompertz",meas="lognormal",envir=NULL)
-pf <- pfilter(simulate(po$parus),Np=100,max.fail=Inf)
+po <- parus(proc="Gompertz",meas="Poisson")
+pf <- pfilter(simulate(po),Np=100,max.fail=Inf)
+tj <- trajectory(po)
+
+po <- parus(proc="Gompertz",meas="lognormal")
+pf <- pfilter(simulate(po),Np=100,max.fail=Inf)

Modified: pkg/pompExamples/tests/parus.Rout.save
===================================================================
--- pkg/pompExamples/tests/parus.Rout.save	2015-02-23 14:05:48 UTC (rev 1092)
+++ pkg/pompExamples/tests/parus.Rout.save	2015-02-25 12:18:35 UTC (rev 1093)
@@ -22,23 +22,27 @@
 > 
 > set.seed(47575684L)
 > 
-> po <- pompExample(parus,proc="Ricker",meas="lognormal",envir=NULL)
-> pf <- pfilter(simulate(po$parus),Np=100,max.fail=Inf)
-> tj <- trajectory(po$parus)
+> pompExample(parus)
+newly created object(s):
+ parus 
 > 
-> po <- pompExample(parus,proc="Ricker",meas="negbin",envir=NULL)
-> pf <- pfilter(simulate(po$parus),Np=100,max.fail=Inf)
+> po <- parus(proc="Ricker",meas="lognormal")
+> pf <- pfilter(simulate(po),Np=100,max.fail=Inf)
+> tj <- trajectory(po)
 > 
-> po <- pompExample(parus,proc="Ricker",meas="Poisson",envir=NULL)
-> pf <- pfilter(simulate(po$parus),Np=100,max.fail=Inf)
+> po <- parus(proc="Ricker",meas="negbin")
+> pf <- pfilter(simulate(po),Np=100,max.fail=Inf)
 > 
-> po <- pompExample(parus,proc="Gompertz",meas="Poisson",envir=NULL)
-> pf <- pfilter(simulate(po[[1]]),Np=100,max.fail=Inf)
-> tj <- trajectory(po[[1]])
+> po <- parus(proc="Ricker",meas="Poisson")
+> pf <- pfilter(simulate(po),Np=100,max.fail=Inf)
 > 
-> po <- pompExample(parus,proc="Gompertz",meas="lognormal",envir=NULL)
-> pf <- pfilter(simulate(po$parus),Np=100,max.fail=Inf)
+> po <- parus(proc="Gompertz",meas="Poisson")
+> pf <- pfilter(simulate(po),Np=100,max.fail=Inf)
+> tj <- trajectory(po)
 > 
+> po <- parus(proc="Gompertz",meas="lognormal")
+> pf <- pfilter(simulate(po),Np=100,max.fail=Inf)
+> 
 > proc.time()
    user  system elapsed 
-  0.638   0.025   0.650 
+  0.575   0.033   0.596 

Modified: pkg/pompExamples/vignettes/parus.Rmd
===================================================================
--- pkg/pompExamples/vignettes/parus.Rmd	2015-02-23 14:05:48 UTC (rev 1092)
+++ pkg/pompExamples/vignettes/parus.Rmd	2015-02-25 12:18:35 UTC (rev 1093)
@@ -48,8 +48,9 @@
 ### Load and plot the data
 
 ```{r}
-pompExample(parus,proc='Gompertz',meas='Poisson')
-plot(parus)
+pompExample(parus)
+pGP <- parus(proc='Gompertz',meas='Poisson')
+plot(pGP)
 ```
 
 ## Model description
@@ -79,15 +80,15 @@
 $$\mathrm{pop}_{t} \sim \mathrm{Lognormal}(\log(N_t),\theta).$$
 
 ```{r}
-coef(parus)
+coef(pGP)
 ```
 
 ## Trajectory matching
 
 ```{r}
-logLik(traj.match(parus))
+logLik(traj.match(pGP))
 bake("parus-tm1.rds",{
-  tm <- parus
+  tm <- pGP
   coef(tm,c("sigma","theta")) <- c(0,NA)
   traj.match(tm,est=c("K","r"),transform=T) -> tm
   traj.match(tm,method='subplex') -> tm
@@ -95,7 +96,7 @@
   }) -> tm
 ```
 ```{r}
-ggplot(data=simulate(parus,params=unlist(tm),nsim=10,obs=TRUE,
+ggplot(data=simulate(pGP,params=unlist(tm),nsim=10,obs=TRUE,
                      as.data.frame=TRUE,include.data=TRUE),
        mapping=aes(x=time,y=pop,group=sim,alpha=sim=="data"))+
   geom_line()+
@@ -107,7 +108,7 @@
 
 ```{r}
 bake("parus-mf.rds",{
-  mf <- parus
+  mf <- pGP
   coef(mf,"theta") <- NA
   mif(mf,rw.sd=c(K=0.02,r=0.02,sigma=0.02),
       cooling.fraction=0.8,var.factor=2,
@@ -125,7 +126,7 @@
   }) -> mf
 ```
 ```{r}
-ggplot(data=simulate(parus,params=unlist(mf),nsim=10,obs=TRUE,
+ggplot(data=simulate(pGP,params=unlist(mf),nsim=10,obs=TRUE,
                      as.data.frame=TRUE,include.data=TRUE),
        mapping=aes(x=time,y=pop,group=sim,alpha=sim=="data"))+
   geom_line()+



More information about the pomp-commits mailing list