r - Draw random numbers from distribution within a certain range -
i want draw number of random variables series of distributions. however, values returned have no higher threshold. let’s want use gamma distribution , threshold 10 , need n=100 random numbers. want 100 random number between 0 , 10. (say scale , shape 1.)
getting 100 random variables easy...
rgamma(100, shape = 1, rate = 1)
but how can accomplish these values range 0 100?
edit make question clearer. 100 values drawn should scaled beween 0 , 10. highest drawn value 10 , lowest 0. sorry if not clear...
edit no2 add context random numbers need: want draw "system repair times" follow distributions. however, within system simulation there binomial probability of repairs beeing "simple" (i.e. short repair time) , "complicated" (i.e. long repair time). need function provides "short repair times" , 1 provides "long repair times". threshold differentiation between short , long repair times. again, hope makes question little clearer.
this not possible gamma distribution. support of distribution determine range of sample data drawn it. support of gamma distribution (0,inf)
not possible.(see https://en.wikipedia.org/wiki/gamma_distribution).
if want have gamma distribution take rejection sampling approach alex reynolds suggests.
otherwise distribution bounded/finite support (see https://en.wikipedia.org/wiki/list_of_probability_distributions)
e.g. uniform or binomial
Comments
Post a Comment