I am using Matlab's exprnd() to generate random exponential numbers from an exponential distribution with a certain x.From what i understand this returns values using the distribution's probability density function which for a cerain lambda has max value of that lambda.
So for exprnd(5) i excpect values <=5.However this gives greater values than 5(up to 20+).What am i missing here? Could someone please explain?
2 Answers
What the input parameter is, is the mean value of what the exprnd() function's distribution would be. So you can still get values larger than 5.
You should read the help document of exprnd in
r = exprnd(mu) generates a random number from the exponential distribution with mean mu.
For you case, exprnd(5) means that your mean value for generated random variables should be 5, which doesn't mean 5 is the upper limit of random variables. For example:
>> exprnd(5,20,1)
ans = 4.10770701 0.60208519 7.25872556 0.05434071 1.56567225 1.25327626 2.27920247 13.76730426 2.26669862 8.16033821 2.65390762 2.59892165 2.68864424 2.20960785 3.64418947 0.00052336 4.78444353 0.70408921 2.20180562 19.10507978When you have sufficiently large number of random variables, then the mean would approach 5, i.e.,
>> mean(exprnd(5,1e5,1))
ans = 5.0052