example: Examples of the construction of POMP models

Description Usage Arguments Details Value Author(s) See Also Examples

Description

pompExample loads pre-built example pomp objects.

Usage

1

Arguments

example

example to load given as a name or literal character string. Evoked without an argument, pompExample lists all available examples.

...

additional arguments define symbols in the environment within which the example code is executed.

envir

the environment into which the objects should be loaded. If envir=NULL, then the created objects are returned in a list.

Details

Directories listed in the global option pomp.examples (which can be changed using options()) are searched for file named ‘<example>.R’. If found, this file will be sourced in a temporary environment. Additional arguments to pompExample define variables within this environment and will therefore be available when the code in ‘<example>.R’ is sourced.

The codes that construct these pomp objects can be found in the ‘examples’ directory in the installed package. Do system.file("examples",package="pomp")) to find this directory.

Value

By default, pompExample has the side effect of creating one or more objects in the global workspace. If envir=NULL, there are no side effects; rather, the objects are returned as a list.

Author(s)

Aaron A. King kingaa at umich dot edu

See Also

blowflies, dacca, gompertz, ou2, ricker, rw2, euler.sir, gillespie.sir, bbs

Examples

1
2
3
4
5
6
7
8
  pompExample()
  pompExample(euler.sir)
  pompExample("gompertz")
  pompExample(ricker,envir=NULL)
## Not run: 
  file.show(system.file("examples/bbs.R",package="pomp"))

## End(Not run)

Example output

examples in /usr/lib/R/site-library/pomp/examples:
[1] "bbs"           "blowflies"     "dacca"         "euler.sir"    
[5] "gillespie.sir" "gompertz"      "ou2"           "ricker"       
[9] "rw2"          
In 'pomp': the following unrecognized argument(s) will be stored for use by user-defined functions: 'nbasis','degree','period'
newly created object(s):
 euler.sir 
newly created object(s):
 gompertz 
library(pomp)

flu <- read.csv2(text="
day;reports
1;3
2;8
3;28
4;76
5;222
6;293
7;257
8;237
9;192
10;126
11;70
12;28
13;12
14;5
")

pomp(
     data=flu,
     times="day",
     t0=0,
     params=c(
       gamma=1/3,mu=0.0,iota=0.0,
       beta=1.4,
       beta.sd=0,
       pop=1400,
       rho=0.9,sigma=3.6,
       S_0=0.999,I_0=0.001,R_0=0
       ),
     rprocess=euler.sim(
       step.fun="_sir_euler_simulator",
       delta.t=1/12,
       PACKAGE="pomp"
       ),
     skeleton=vectorfield("_sir_ODE"),
     measurement.model=reports~nbinom(mu=rho*cases,size=1/sigma^2),
     PACKAGE="pomp",
     statenames=c("S","I","R","cases","W"),
     paramnames=c(
       "gamma","mu","iota",
       "beta","beta.sd","pop","rho",
       "S_0","I_0","R_0"
       ),
     zeronames=c("cases"),
     nbasis=1L,
     degree=0L,
     period=1.0,
     logvar=c(
       "beta","gamma","mu","iota","sigma","beta.sd",
       "S_0","I_0","R_0"
       ),
     logitvar="rho",
     toEstimationScale=function (params, logvar, logitvar, ...) {
       params[logvar] <- log(params[logvar])
       params[logitvar] <- qlogis(params[logitvar])
       params
     },
     fromEstimationScale=function (params, logvar, logitvar, ...) {
       params[logvar] <- exp(params[logvar])
       params[logitvar] <- plogis(params[logitvar])
       params
     },
     initializer="_sir_init"
     ) -> bbs

c("bbs")

pomp documentation built on May 2, 2019, 4:09 p.m.

Related to example in pomp...