2
$\begingroup$

https://www.rdocumentation.org/packages/MASS/versions/7.3-51.5/topics/theta.md

The above page says this.

Given the estimated mean vector, estimate theta of the Negative Binomial Distribution.

But it is not clear what the definition of theta is as there are different parameterization of NB. For example, wiki uses r and p.

https://en.wikipedia.org/wiki/Negative_binomial_distribution

I see this following is mentioned on https://data.library.virginia.edu/getting-started-with-negative-binomial-regression-modeling/

var(Y)=μ+μ^2/k

Is k here same as theta?

What is the relation between theta and r and p? Thanks.

$\endgroup$
2
  • 1
    $\begingroup$ hey this question has been asked before, maybe you can check this stats.stackexchange.com/questions/70619/… $\endgroup$
    – StupidWolf
    Commented Apr 12, 2020 at 22:54
  • $\begingroup$ so to answer your question, theta is size in rnbinom(...) and is k in what you cited $\endgroup$
    – StupidWolf
    Commented Apr 12, 2020 at 22:57

1 Answer 1

2
$\begingroup$

Is k here the same as theta?

I think so yes.

What is the relation between theta and r and p?

The major difference is how the negative binomial is written. Here the negative binomial is written as a Poisson mixture of gammas. See, e.g. here for the derivation if you are unfamiliar with this notion.

Then write the mean of the gamma as $\mu$ and the variance of the gamma $\mu^2/\theta$. Recall the gamma mixes the Poisson rate parameter so that to get the marginal mean and variance of the Negative binomial, you need to integration out the gamma variations. To do this you can use conditional expectations, e.g.

$\mathbb{E}(y_i) = \mathbb{E}(\mathbb{E}(y_i | \lambda))$ where the inner expection is the Poisson, e.g. $\mathbb{E}(y_i) = \mathbb{E}(\lambda) = \mu$ now the variance:

$$\mathbb{V}ar(y_i) = \mathbb{V}ar(\mathbb{E}(y_i | \lambda)) + \mathbb{E}(\mathbb{V}ar(y_i | \lambda))$$ now putting in the gamma values for the inner expectations and variances you see: $$\mathbb{V}ar(y_i) = \mathbb{V}ar(\lambda) + \mathbb{E}(\lambda)$$ and we may evaluate both the variance and the expectation on the right hand side as mean and variance of the gamma, to get: $$\mathbb{V}ar(y_i) =\frac{\mu^2}{\theta} + \mu$$ this is the parameterization that these packages appear to be using. If you want to map this parameterization to the more common negative binomial parameters, write: $p = \frac{\mu}{\mu + \theta}$ and $r=\theta$.

$\endgroup$

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.