I want to get 10 random numbers drawn from a Poisson distribution with mean 1. But I do not want to include 0 in this. When I do

RandomVariate[PoissonDistribution[1], 10]

it gives me 10 random numbers with zero. Is there any workaround?

  • $\begingroup$ DeleteCases[..., 0]? Note that excluding numbers from a random distribution via any mechanism will almost certainly change the mean. You could also just add 1 to the list returned by RandomVariate, which will obviously increase the mean by 1 (but won't alter the variance). $\endgroup$ – eyorble Apr 3 '18 at 15:50
  • 1
    $\begingroup$ Maybe RandomVariate[ CensoredDistribution[{1, \[Infinity]}, PoissonDistribution[1]], 10] ? $\endgroup$ – b.gates.you.know.what Apr 3 '18 at 16:04
  • 2
    $\begingroup$ or truncate .. RandomVariate[ TruncatedDistribution[{0, Infinity}, PoissonDistribution[1]], 10] $\endgroup$ – george2079 Apr 3 '18 at 17:10
  • $\begingroup$ incidentally... Truncate appears to be equivalent to simply deleting zeros. "censoring" weights the result to give relatively more 1's. $\endgroup$ – george2079 Apr 3 '18 at 17:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.