# Multinomial with missing data

**URL:** <https://discourse.mc-stan.org/t/multinomial-with-missing-data/20646>\
**Category:** Modeling\
**Created:** [February 6, 2021, 1:01am UTC](https://discourse.mc-stan.org/t/multinomial-with-missing-data/20646 "2021-02-06T01:01:59Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![stemangiola](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/stemangiola/32/260_2.png) [@stemangiola](https://discourse.mc-stan.org/u/stemangiola)\
**Post date:** [February 6, 2021, 1:01am UTC](https://discourse.mc-stan.org/t/multinomial-with-missing-data/20646/1 "2021-02-06T01:01:59Z")

</div>

I had a look at this [topic](https://discourse.mc-stan.org/t/marginalising-out-many-discrete-latent-variables-modelling-augmented-count-data/4251) but I could not figure out if applies directly to my issue.

I have a multinomial-like data (30 components, 20 observations, count range 0-1000), and some of those data points are missing (N~20).

Is there any approach I could use to model a multinomial with missing data?

* * *

I would like to point out the brms approach for discrete data

[https://cran.r-project.org/web/packages/brms/vignettes/brms\_missings.html](https://cran.r-project.org/web/packages/brms/vignettes/brms_missings.html)

---

<div class="post-metadata">

**Author:** ![olli0601](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/olli0601/32/7107_2.png) [@olli0601](https://discourse.mc-stan.org/u/olli0601)\
**Post date:** [February 6, 2021, 12:06pm UTC](https://discourse.mc-stan.org/t/multinomial-with-missing-data/20646/2 "2021-02-06T12:06:17Z")

</div>

Your outcomes are discrete. Do it in the generated quantities block, ie predict multinomial outcomes with the \_rng function according to the joint posterior of your probabilities?

---

<div class="post-metadata">

**Author:** ![stemangiola](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/stemangiola/32/260_2.png) [@stemangiola](https://discourse.mc-stan.org/u/stemangiola)\
**Post date:** [February 7, 2021, 12:07am UTC](https://discourse.mc-stan.org/t/multinomial-with-missing-data/20646/3 "2021-02-07T00:07:28Z")

</div>

Thanks Olli,

however I do not have a join posterior. The joint posterior is the thing I want to estimate.

I have a matrix of multinomial observations where there are some NAs in random spots.

---

<div class="post-metadata">

**Author:** ![olli0601](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/olli0601/32/7107_2.png) [@olli0601](https://discourse.mc-stan.org/u/olli0601)\
**Post date:** [February 7, 2021, 12:27am UTC](https://discourse.mc-stan.org/t/multinomial-with-missing-data/20646/4 "2021-02-07T00:27:28Z")

</div>

I see – you don t want to remove an entire observation simply because one of the components in that observation is missing, right?

Is it a good idea to model the margin N (sum of components for one observation row) fixed?

If there is no strong rationale for that, does the following help,

> Multinomial(y; N, pi ) \* Poisson( N; lambda) = \prod\_i Poisson(y\_i; pi\_i\*lambda)

which should allow you to look at each data point, and just ignore those missing ones.

---

<div class="post-metadata">

**Author:** ![stemangiola](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/stemangiola/32/260_2.png) [@stemangiola](https://discourse.mc-stan.org/u/stemangiola)\
**Post date:** [February 7, 2021, 12:34am UTC](https://discourse.mc-stan.org/t/multinomial-with-missing-data/20646/5 "2021-02-07T00:34:11Z")

</div>

> [@olli0601](#):
>
> model the margin N (sum of components for one observation row) fixed

This is not the case unfortunately, each observation can vary in their total counts

> [@olli0601](#):
>
> Multinomial(y; N, pi ) \* Poisson( N; lambda) = \prod\_i Poisson(y\_i; pi\_i\*lambda)

Sounds promising, if only I could understand what that is :)

Could you please be more explicit about what each term is in this case, and where are the missing/present observations, and why multinomial \* poisson?

---

<div class="post-metadata">

**Author:** ![olli0601](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/olli0601/32/7107_2.png) [@olli0601](https://discourse.mc-stan.org/u/olli0601)\
**Post date:** [February 7, 2021, 1:21am UTC](https://discourse.mc-stan.org/t/multinomial-with-missing-data/20646/6 "2021-02-07T01:21:35Z")

</div>

[Yes – see the paper here](https://arxiv.org/abs/2001.04343) :-)

So what I suggest is to model each of your observations as conditionally independent Poisson. It is almost the same as the Multinomial, and potentially you might not even want to consider the sum of your components fixed, given that you have missing values.

---

<div class="post-metadata">

**Author:** ![stemangiola](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/stemangiola/32/260_2.png) [@stemangiola](https://discourse.mc-stan.org/u/stemangiola)\
**Post date:** [February 7, 2021, 2:50am UTC](https://discourse.mc-stan.org/t/multinomial-with-missing-data/20646/7 "2021-02-07T02:50:13Z")

</div>

Thanks, very good source.

so how would a stan model would be according to

> Hence, a multinomial distribution is equivalent to a collection of independent  
> Poisson distributions conditioned on their sum.

In particular hot to express

> conditioned on their sum

I don’t think I can ignore the condition-by-their-sum because I don’t have so many component, they could be as few as 5. In this case the inverse relation would be too strong to ignore (using independent posisson), if this is what you mean.
