This project has moved. For the latest updates, please go here.

Help for Weibull Distribution

Aug 20, 2009 at 8:44 PM

Hi,

Is there anyway to implent weibull distribution in Math.Net? I appreicate any help or suggestion. Thanks,

Harbin2010

Coordinator
Aug 20, 2009 at 9:09 PM

It hasn't been implemented by Iridium nor dnA so we need to implement it from scratch. I will take care of it by the end of the weekend.

Cheers, J

Coordinator
Aug 20, 2009 at 9:10 PM

Hi

Wikipedia: Weibull_distribution

This distribution is not implemented yet. If you're mainly looking for generating random numbers with such a distribution, you can derive them in the meantime easily from uniformly distributed numbers (according to the linked article):

X ~ uniform(0,1)

-> Y = lambda * (-ln(X))^(1/k) ~ weibull(lambda, k)

Thanks,
Chris

Aug 20, 2009 at 10:34 PM

Hi, Jvangael and cdrnet

Thank you for your reply.

Jvangael: So, in the end of this week new version MathNet will be released and it has weibull distribution function call?

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Cdrnet: One of my project needs to generate a number based on the mtbf value and the distribution type. I checked the NormalDistribution class of MathNet.  

public override double  NextDouble( ) { return _mu + _standard.NextDouble() * _sigma; }

So, what fomula I should use in order to generate NextDouble value for weibull distribution based on mtbf value?  Would you please give me a hint?

Appreciate your helps, I mean it.

Harbin2010<font size="2">

 

</font>

 

 

Coordinator
Aug 21, 2009 at 7:56 PM

Hi Harbin2010,

I've implemented the Weibull distribution today. I will write some unit tests tomorrow to make sure it is correctly implemented. You will have to download it from the sources at GitHub as we will not be releasing the new library very soon.

Cheers, Jurgen

Aug 21, 2009 at 8:27 PM

Hi, J

Looking forward to downloading it. Thank you for your hard works.

Harbin2010

Coordinator
Aug 22, 2009 at 11:07 AM

Alright; checked in. Enjoy.

Aug 22, 2009 at 5:22 PM

J,

Got the source code. But I do have a question. If my question is stupid, please forgive me since I am not good at Math.  I found no NextDouble() method included in Weibull class.

My project needs to generate a weibull random number based on MTBF, scale and shape.  If I use SampleWeibull(mtbf, scale, shape), it will not return me the desired random number.

for example, MTBF=5000hours, scale=2 and shape=2: how to generate a random number?

@ NormalDistribution Class, there is a method called NextDouble() I can use. NextDouble( ) { return _mu + _standard.NextDouble() * _sigma; } So, I can just set _mu=MTBF and _sigma=MTBF/7. Then everytime I called NextDouble(), it will return me a resonable random number. How can I achieve this goal in Weibull class?

Looking forward to receiving your reply,

Harbin2010

Coordinator
Aug 24, 2009 at 8:17 AM

Hi Harbin2010,

What we've implemented now is the two parameter Weibull distribution. I will have to extend to 3 parameters (including the MTBF) as I wasn't aware of this distribution. However, I believe you can just sample from the Weibull we have now using Weibull.Sample(Random NUmber Generator, shape, scale) and add the MTBF (as it represents the mean).

Cheers, Jurgen

PS I am a little busy this week so the three parameter Weibull might not end up in the library for a few days/weeks?