Suppose that I am working with an integer-valued variable $x$ and that all I know about my sample is as follows:
- Mean $\bar{x}$: 4.5
- Sample size $n$: 100
- I can safely assume that the underlying model for this data is Poisson. However, it is a truncated distribution as the variable can only take on values 1, 2, 3, 4 and 5 (think of the product ratings given by customers in their online reviews).
The end goal is to estimate the $\lambda$ parameter of that Poisson distribution and use it to simulate a predictive distribution for $x$.
If it wasn't a truncated Poisson distribution, I could assume that the prior of $\lambda$ is a Gamma distribution, $\Gamma(\alpha, \beta)$. Then the posterior distribution would be $\Gamma(\alpha + n \bar{x}, \beta + n)$. With a non-informative Gamma distribution, i.e. $\Gamma(0, 0)$, that would lead to $\lambda = \Gamma(450, 100)$ (see pp. 65-66 in this work for reasoning on the non-informative prior Gamma). Using this posterior, I could then easily simulate the predictive distribution in R as follows:
lambda <- rgamma(10000, 450, 100)
x <- rpois(10000, lambda)
However, plotting this simulated values immediately reveals that many of them are outside of the 1-5 interval:
plot(table(x),
type = "h", lwd = 5,
lend = 2,
col = gray(0.5),
bty = "n",
ylab = "")
Again, this plot doesn't come as a big surprise as the math used to produce it assumed a non-truncated Poisson distribution for $x$. Now the question is: how can I modify that math so that the resulting predictive distribution is bounded by 1 on the lower end and by 5 on the upper end? An answer with an example R code would be greatly appreciated.