mardi 16 mars 2021

Generate random numbers from a Poisson distribution with defined range [min, max]

I would like to draw 100 random numbers from a Poisson distribution with a mean of 0.5, ranging from 0 to 10.

Using the rpois(n = 100, lambda = 0.50) function, I can obtain the random numbers from the Poisson distribution, but I am unable to specify the min/max values.

Any way of doing this in R?

A bit more context: In a dataset, my dependent variable has the properties mentioned above (mean, min, max values), and I would like to estimate some models with simulated data for my dependent variable.

Edit: My dependent variable (for which I want to simulate the random numbers in addition to the observed values) is neither truncated nor censored. However, I should note that its standard deviation is 1, i.e., the variance is not equal to the mean of 0.5.

Thanks!




Aucun commentaire:

Enregistrer un commentaire