|
Brighton Webs Ltd. Data & Analysis Services for Industry & Education |
|||||||||
|
Home Index Feedback |
Weibull Distribution (Two Parameter) The Weibull distribution is a special case of the Generalized Extreme Value distribution. It has been extensively used as a model of time to failure of manufactured items and has become one of the principal tools of reliability engineering. The applications of the Weibull distribution have expanded and include finance and climatology. The distribution is named after the Swedish engineer Wallodi Weibull. Profile Parameters
Range The range is from greater than zero to positive infinity. However, in practice the right tail is classed as thin/light or bounded. Functions Properties Random Number Generation Random number generation (referred to as r) for a Weibull distribution can be performed by transforming a continuous uniform variable in the range 0 to 1 (referred to as u) with the distribution's inverse probability function:
which can be reduced to: Using Basic style code, the function would be similar to:
and in VB.net style:
Parameter Estimation The maximum likelihood equations can be expressed in the form: These can be solved to obtain the shape and scale factors. The vb.net code below uses successive bisection to solve the equation for shape factor which is plugged into the formula for scale. Anyone considering using this code, should first determine if it is fit for purpose, especially with regard to convergence, over-flow and computing efficiency: Some test code is included which generates an array of random numbers according to the scale and shape factors, weibullML is then called to estimate the parameters from the array of random numbers: Test Code: Dim intI As Integer = 0 'Declarations - Shape and Scale to test data Dim dblScale As Double = 100 Dim dblShape As Double = 2.0 'Array for random numbers Dim dblX(999) As Double 'RandomizeRandomize() 'Random Numbers For intI = 0 To dblX.GetUpperBound(0)
Next 'Successive Bisection If WeibullML(dblX, dblShape, dblScale) Then
Else End If Solution of Equations Function WeibullML(ByRef dblX() As Double, _ ByRef dblShape As Double, _ ByRef dblScale As Double) As Boolean 'Returns true if the equation for shape factor converges 'within the number of iterations set by IMax. 'Declarations - Loops, Dim intI As Integer = 0 'Interation Counter Dim intIMax As Integer = 20 'Maximum Interations Dim intJ As Integer = 0 'Declarations - Initial estimates of shape factor Dim dblL As Double = 0 Dim dblR As Double = 100 'Declarations - Tolerance Dim dblF As Double Dim dblTol As Double = 0.01 'Declarations - Intermediate variables Dim dblA As Double Dim dblB As Double Dim dblC As Double = 0 Dim dblP As Double 'Evaluate the term which does not depend on shape For intJ = 0 To dblX.GetUpperBound(0) dblC = dblC + Math.Log(dblX(intJ)) Next 'Successive Bisection Do While intI < intIMax'Initialise dblA = 0 dblB = 0 'Estimate of ShapedblShape = (dblL + dblR) / 2 'Intermediates For intJ = 0 To dblX.GetUpperBound(0)Next 'Evaluate function dblF = (dblB / dblA - dblC / (dblX.GetUpperBound(0) + 1) - 1 / dblShape) 'Swap If dblF > dblTol ThenElseIf dblF < -dblTol Then Else End If 'increment counter intI = intI + 1 Loop'Convergence did not take place Return FalseEnd function Page Updated: 12-May-2008 |
|||||||||
|
For more information: info@brighton-webs.co.uk |
||||||||||