mardi 14 avril 2020

How to generate random number 1 & 2 instead of 0 & 1 from binomial distribution?

I would like to generate random number from binomial 1 or 2 instead of the usual 0 and 1. Normally we will use rbinom(10, 1, 0.4) to generate either 0 or 1, but is it possible to generate 1 and 2? Or is there any way to convert it? Any help will be greatly appreciated!




Aucun commentaire:

Enregistrer un commentaire