1
$\begingroup$

I'm studying about the applications of bayesian inference to fitting dynamical systems to observations.

So the model itself is a deterministic SIR model:

$$ f(R_0,D_{inf})=\begin{cases} \frac{dS}{t}&=-\beta S\frac{I}{N} \\ \frac{dI}{t}&=\beta S\frac{I}{N}-\nu I \\ \frac{dR}{t}&=\nu I \\ \end{cases}\tag{1} $$ where $\beta=R_0/D_{inf}$, $\nu=1/D_{inf}$. The parameters we will calibrate/estimate will be $R_0$ and $D_{inf}$.

So the concept is finding the $R_0$ and $D_{inf}$ makes the model outputs, specifically the $I_t$ best fit the data, say $d_t$ and the uncertainty in the fit is captured by some probability distribution, i.e, Poisson:

$$d_t\sim Poisson(I_t)\tag{2}$$

meaning the actual observed time series $d_t$ follows some probability distribution around $I_t$.


Problem

In the case of $Poisson$ distribution, it is relatively easy to construct the likelihood for $R_0$ and $D_{inf}$ since all you have to do is to find $R_0$ and $D_{inf}$ that maximizes the likelihood generated from $(1)$ and $(2)$:

\begin{align*} L(R_0,D_{inf}|d_1,d_2,\dots,d_n) &= \prod_{t=1}^nL(I_t|d_t) \\ &= \prod_{t=1}^n\frac{\exp(-I_t)I_t^{d_t}}{d_t!} \end{align*}

then one could just use the following function for getting the likelihood

dpois(
   x = d_t,
   lambda = I_t
)

But how is this done for negative binomial? Generating likelihood we would have

\begin{align*} L(R_0,D_{inf}|d_1,d_2,\dots,d_n) &=\prod_{t=1}^n\frac{\Gamma (d_t+r_t)}{d_t!\Gamma (r_t)}p^{r_t}(1-p)^{d_t} \end{align*} where $I_t=\frac{r_t(1-p)}{p}$ would be the mean of the Negative binomial distribution.

how could I use dnbinom() for in this method of parameterization?

dnbinom(
 x=d_t,
 mu = I_t,
 size = ???
)

I'm slightly confused by the documentation and would like help on what should size be.

Please comment as well if this belongs to R Collective (StackOverflow) rather than CrossValidate rather than a straight downvote.

$\endgroup$
0

1 Answer 1

0
$\begingroup$

Checking ?dnbinom, the equivalent parameterisation is: your $d$ is R's x, your $p$ is R's prob, your $r$ is R's size, and your $I$ is R's mu.

mu is the mean, $I_t$ in your case. Then prob = size/(size+mu) (see docs). So

$$ \texttt{size} = r/(r + I_t) $$

according to your parameterisation.

$\endgroup$
4
  • $\begingroup$ so $r$ would be constant throughout the likelihood? $\endgroup$
    – Derf
    Commented Feb 20 at 12:47
  • $\begingroup$ I was lazy in my notation. What I meant was, where you see and $r_t$, that should be input into to size argument of dnbinom $\endgroup$
    – Alex J
    Commented Feb 20 at 22:06
  • $\begingroup$ But then $f(R_0,D_{inf})$ only gives us $I_t$. Does that mean $\left\{r_1,r_2,\dots,r_n\right\}$ would be another vector needed in the likelihood? $\endgroup$
    – Derf
    Commented Feb 20 at 23:50
  • $\begingroup$ Tbh, I have no idea what deterministic SIR models etc. are. But I do know how to parameterise dnbinom. You might be able to have the $r_t$ as nuisance variables or something in the likelihood but I can't remember how to do that off the top of my head $\endgroup$
    – Alex J
    Commented Feb 21 at 1:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.