mardi 29 septembre 2015

Draw random numbers from distribution within a certain range

I want to draw a number of random variables from a series of distributions. However, the values returned have to be no higher than a certain threshold. Let’s say I want to use the gamma distribution and the threshold is 10 and I need n=100 random numbers. I now want 100 random number between 0 and 10. (Say scale and shape are 1.)

Getting 100 random variables is obviously easy...

rgamma(100, shape = 1, rate = 1)

But how can I accomplish that these values range from 0 to 100?




Aucun commentaire:

Enregistrer un commentaire