[Numpy-discussion] weibull distribution has only one parameter?
Robert Kern
robert.kern at gmail.com
Mon Nov 12 12:58:57 EST 2007
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_Weibull-distributed_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(1-U) 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).
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the NumPy-Discussion
mailing list