Installing the pomp package

Homework questions

Please submit your solutions to Canvas as an Rmarkdown (.Rmd) file which the GSIs will compile into an HTML document. Your Rmd file can read in the Parus major data from the internet, e.g., by

dat <- read.csv("https://ionides.github.io/531w20/10/parus.csv")

Note: you will be using pomp version 2.x. There are some differences from pomp 1.x that may require attention if and when you look on the internet for pomp code.

Question 6.1 Reformulating the Ricker model

The Ricker equation can be reparameterized so that the scaling of \(P_n\) is explicit: \[ P_{n+1} = r\,P_{n}\,\exp\left(-\frac{P_{n}}{k}\right). \]

Modify the pomp object created in the notes to reflect this reparameterization. Also, Modify the measurement model so that the data \(y_n\) is modeled as \[ Y_n \mid P_n \sim \textrm{Negbin}(\phi\,P_n,\psi). \]

Here, \(\mathrm{Negbin}(\mu,\psi)\) is the negative binomial distribution with mean \(\mu\) and probability parameter \(\psi\), and therefore variance \(\mu/\psi\). This parameterization corresponds in R to rbinom(...,mu,prob). See ?rnbinom for documentation on the negative binomial distribution and the R Extensions Manual section on distribution functions for information on how to access these in C.

Try simulating from a few choices of the parameters, and present one simulation from a set of parameters that shows oscillatory behavior.

\(\mathbf{Solution.}\qquad\) First we show a time-series plot of the Great Tit population. We see that the population shows cyclical behavior over time.

Annual Great Tit Population.

Figure 1: Annual Great Tit Population.

As in lecture 10 notes, we plot the trajectory of the deterministic skeleton. With \(k=1\), we have the same model as in the notes.

Trajectory of Determnistic Process.

Figure 2: Trajectory of Determnistic Process.

Next we add the stochastic Ricker model to parus. Below we plot one possible realization of the process.

Simulating Ricker Equation.

Figure 3: Simulating Ricker Equation.

Finally, we complete the specification of the POMP by specifying the measurement model.

Plot of simulations.

Figure 4: Plot of simulations.

We set the initial value of N.0 equal to the initial value of the population. Next, we set \(\phi=1\) so that the mean of \(Y_n\) is equal to mean of \(P_n\). We determine \(\psi\) by setting it equal to the \(\frac{\mu_{pop}}{\sigma^2_{pop}}\). Finally, \(r\) and \(\sigma\) seem to control the volatility, so we set \(r=6\) and \(\sigma=0.05\), while \(k=100\) alters the level of the population.

Question 6.2 Coding a new POMP model

Construct a pomp object for the Parus major data modeled using the stochastic Beverton-Holt model, \[ P_{n+1} = \frac{a\,P_n}{1+b\,P_n}\,\varepsilon_n, \] where \(a\) and \(b\) are parameters and \[ \varepsilon_t \sim \mathrm{Lognormal}(-\tfrac{1}{2}\sigma^2,\sigma^2). \] Assume the same measurement model as we used for the Ricker model. Try simulating from a few choices of the parameters. What are the similarities and differences between simulations you obtain from the Beverton-Holt model and those from the Ricker model? Present one simulation to support your comments.

\(\mathbf{Solution.}\qquad\) Below we construct pomp object using the stochastic Beverton-Holt model and simulate one possible realization.

Simulating Beverton-Holt Model.

Figure 5: Simulating Beverton-Holt Model.

Finally we add the measurment model.

For both models we try initialize N.0, \(\phi\) and \(\psi\) in the same manner. However, we need to tune \(a\) and \(b\) differently so that the level of the population is estimated correctly.

Question 6.3 This feedback question is worth credit

  1. Explain which parts of your responses above made use of a source, meaning anything or anyone you consulted (including classmates or office hours) to help you write or check your answers. All sources are permitted. To encourage responsible use of these sources while maintaining class integrity, we require a response to this question, even if this may occasionally just say that you worked out everything entirely by yourself. See the syllabus for additional information on grading.
  2. How long did this homework take? Report on any technical difficulties that arose.
  1. I used lecture 10 notes as a source, and the user guide for pomp2 package.
  2. The homework took me about 5 hours, by reading through the lecture notes and pomp2 guide, fixing coding issues, and typing up the homework. I noticed that pomp package does not work well if files are opened from Google Drive File Stream. In other words, I had to move the homework documents to a local folder on my computer and run them from there.

Acknowledgements

The questions derive from material in a short course on Simulation-based Inference for Epidemiological Dynamics

Licensed under the Creative Commons attribution-noncommercial license, http://creativecommons.org/licenses/by-nc/3.0/. Please share and remix noncommercially, mentioning its origin.