Skip to content

Fit deterministic model using pomp #188

Answered by kingaa
Fuhan-Yang asked this question in Q&A
Discussion options

You must be logged in to vote

I saw two errors in your code. First, you loaded tidyverse after pomp, thus masking the map function. To avoid this problem, you can either load tidyverse before pomp, or explicitly specify the call to pomp::map().

The second error was that, in your skeleton component, you were not specifying how the H variable maps under the dynamics.

Compare the following.

library(pomp)
library(tidyverse)

read_csv(
  "https://kingaa.github.io/sbied/stochsim/Measles_Consett_1948.csv"
) |>
  select(week,reports=cases) -> meas

sir_rinit <- Csnippet("
  S = nearbyint(eta*N);
  I = 1;
  R = nearbyint((1-eta)*N);
  H = 0;
  ")

sir_dmeas <- Csnippet("
  lik = dnbinom_mu(reports,k,rho*H,give_log);
  ")

meas…

Replies: 4 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@Fuhan-Yang
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by Fuhan-Yang
Comment options

You must be logged in to vote
2 replies
@kingaa
Comment options

@Fuhan-Yang
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants