weibull distribution has only one parameter?
According to (for instance) http://en.wikipedia.org/wiki/Weibull_distribution the Weibull distribution has two parameters: lambda > 0 is the scale parameter (real) and k > 0 is the shape parameter (real). However, the numpy.random.weibull function has only a single 'a' parameter (except for the size parameter which indicates the size of the array to fill with values  this is NOT a parameter of the distribution itself). My question is how this 'a' parameter translates to the Weibull distribution as it 'normally' is and how to sample the distribution when I have the lambda and k parameters?
D.Hendriks (Dennis) wrote:
According to (for instance) http://en.wikipedia.org/wiki/Weibull_distribution the Weibull distribution has two parameters: lambda > 0 is the scale parameter (real) and k > 0 is the shape parameter (real). However, the numpy.random.weibull function has only a single 'a' parameter (except for the size parameter which indicates the size of the array to fill with values  this is NOT a parameter of the distribution itself). My question is how this 'a' parameter translates to the Weibull distribution as it 'normally' is and how to sample the distribution when I have the lambda and k parameters?
lambda * numpy.random.weibull(k)
Robert Kern wrote:
D.Hendriks (Dennis) wrote:
According to (for instance) http://en.wikipedia.org/wiki/Weibull_distribution the Weibull distribution has two parameters: lambda > 0 is the scale parameter (real) and k > 0 is the shape parameter (real). However, the numpy.random.weibull function has only a single 'a' parameter (except for the size parameter which indicates the size of the array to fill with values  this is NOT a parameter of the distribution itself). My question is how this 'a' parameter translates to the Weibull distribution as it 'normally' is and how to sample the distribution when I have the lambda and k parameters?
lambda * numpy.random.weibull(k)
Thanks for the quick replay. However, when I look at the image of the probability density function at http://en.wikipedia.org/wiki/Weibull_distribution I see a red line and a green line, both with k=2. The red line is for lambda=0.5 and the green for lambda=1.0. The green line is not only half the height of the red one (while double the lambda factor!), but also has its mean a bit more to the right. Looking at the formulas on the same page, this makes sense. All of this makes me doubt the correctness of the formula you proposed...
On Mon, 12 Nov 2007, "D.Hendriks (Dennis)" apparently wrote:
All of this makes me doubt the correctness of the formula you proposed.
It is always a good idea to hesitate before doubting Robert. URL:http://en.wikipedia.org/wiki/Weibull_distribution#Generating_Weibulldistributed_random_variates
hth, Alan Isaac
Alan G Isaac wrote:
On Mon, 12 Nov 2007, "D.Hendriks (Dennis)" apparently wrote:
All of this makes me doubt the correctness of the formula you proposed.
It is always a good idea to hesitate before doubting Robert. URL:http://en.wikipedia.org/wiki/Weibull_distribution#Generating_Weibulldistributed_random_variates
hth, Alan Isaac
So, you are saying that it was indeed correct? That still leaves the question why I can't seem to confirm that in the figure I mentioned (red and green lines). Also, if you refer to X = lambda*(ln(U))^(1/k) as 'proof' for the validity of the formula, I have to ask if Weibull(a,Size) does actually correspond to (ln(U))^(1/a)?
D.Hendriks (Dennis) wrote:
Alan G Isaac wrote:
On Mon, 12 Nov 2007, "D.Hendriks (Dennis)" apparently wrote:
All of this makes me doubt the correctness of the formula you proposed.
It is always a good idea to hesitate before doubting Robert. URL:http://en.wikipedia.org/wiki/Weibull_distribution#Generating_Weibulldistributed_random_variates
hth, Alan Isaac
So, you are saying that it was indeed correct? That still leaves the question why I can't seem to confirm that in the figure I mentioned (red and green lines). Also, if you refer to X = lambda*(ln(U))^(1/k) as 'proof' for the validity of the formula, I have to ask if Weibull(a,Size) does actually correspond to (ln(U))^(1/a)?
Have you actually looked at a histogram of the random variates generated this way to see if they are wrong?
Multiplying the the individual random values by a number changes the distribution differently than multiplying the distribution/density function by a number.
Ryan
D.Hendriks (Dennis) wrote:
Alan G Isaac wrote:
On Mon, 12 Nov 2007, "D.Hendriks (Dennis)" apparently wrote:
All of this makes me doubt the correctness of the formula you proposed.
It is always a good idea to hesitate before doubting Robert. URL:http://en.wikipedia.org/wiki/Weibull_distribution#Generating_Weibulldistributed_random_variates
hth, Alan Isaac
So, you are saying that it was indeed correct? That still leaves the question why I can't seem to confirm that in the figure I mentioned (red and green lines). Also, if you refer to X = lambda*(ln(U))^(1/k) as 'proof' for the validity of the formula, I have to ask if Weibull(a,Size) does actually correspond to (ln(U))^(1/a)?
double rk_standard_exponential(rk_state *state) { /* We use log(1U) since U is [0, 1) */ return log(1.0  rk_double(state)); }
double rk_weibull(rk_state *state, double a) { return pow(rk_standard_exponential(state), 1./a); }
Like Ryan says, multiplying a random deviate by a number is different from multiplying the PDF by a number. Multiplying the random deviate by lambda is equivalent to transforming pdf(x) to pdf(x/lambda) not lambda*pdf(x).
participants (4)

Alan G Isaac

D.Hendriks (Dennis)

Robert Kern

Ryan May