<?xml version="1.0" encoding="UTF-8"?>

<!--
 *
 * This help file was generated from distfun_wblplot.sci using help_from_sci().
 *
 -->

<refentry version="5.0-subset Scilab" xml:id="distfun_wblplot" xml:lang="en"
          xmlns="http://docbook.org/ns/docbook"
          xmlns:xlink="http://www.w3.org/1999/xlink"
          xmlns:svg="http://www.w3.org/2000/svg"
          xmlns:ns3="http://www.w3.org/1999/xhtml"
          xmlns:mml="http://www.w3.org/1998/Math/MathML"
          xmlns:scilab="http://www.scilab.org"
          xmlns:db="http://docbook.org/ns/docbook">

  <refnamediv>
    <refname>distfun_wblplot</refname>
    <refpurpose>Weibull plot</refpurpose>
  </refnamediv>


<refsynopsisdiv>
   <title>Calling Sequence</title>
   <synopsis>
   distfun_wblplot(data)
   y = distfun_wblplot(data)
   [y,a,b] = distfun_wblplot(data)
   
   </synopsis>
</refsynopsisdiv>

<refsection>
   <title>Parameters</title>
   <variablelist>
   <varlistentry><term>data :</term>
      <listitem><para> a n-by-1 matrix of doubles, the data</para></listitem></varlistentry>
   <varlistentry><term>y :</term>
      <listitem><para> a n-by-1 matrix of doubles, -log(1-p), where p is the</para></listitem></varlistentry>
   <varlistentry><term>a :</term>
      <listitem><para> a 1-by-1 matrix of doubles, the first estimated parameter</para></listitem></varlistentry>
   <varlistentry><term>b :</term>
      <listitem><para> a 1-by-1 matrix of doubles, the second estimated parameter</para></listitem></varlistentry>
   </variablelist>
</refsection>

<refsection>
   <title>Description</title>
   <para>
Plots the data vs its probability with log-log axes, assuming that is is
Weibull distributed.
   </para>
   <para>
In the Weibull plot, we plot x against -log(1-p),
where p is the empirical cumulated probability and x is the
data.
If the data is Weibull distributed, the points
are approximately on a line (see below), and this is why we
add the regression line on the plot.
The coefficients of the Weibull distribution can then be
estimated from the coefficients of the regression.
   </para>
   <para>
For a Weibull CDF, we have:
   </para>
   <para>
<latex>
\begin{eqnarray}
b\log(x)-b\log(a)=\log(-\log(1-p))
\end{eqnarray}
</latex>
   </para>
   <para>
where p is the cumulated distribution function
and a and b are the parameters of the Weibull distribution.
We notice that this is a linear relationship between
log(x) and log(-log(1-p)).
   </para>
   <para>
The data is first sorted in increasing order,
then the empirical cumulated probability p is computed
from
   </para>
   <para>
<latex>
\begin{eqnarray}
p=\frac{i-0.3}{n+0.4},
\end{eqnarray}
</latex>
   </para>
   <para>
where i=1,2,...,n is the rank of the data,
and n is the number of values.
   </para>
   <para>
Then the data is plotted in logarithmic
scale, and the best linear fit is computed
by regression.
The estimated coefficients a and b are
then inferred from the best linear fit.
   </para>
   <para>
</para>
</refsection>

<refsection>
   <title>Examples</title>
   <programlisting role="example"><![CDATA[
// Reference
// NIST/SEMATECH e-Handbook of Statistical Methods
// http://www.itl.nist.gov/div898/handbook/
// 5th October 2012
// 1.4.2.9. Fatigue Life of Aluminum Alloy Specimens
// http://www.itl.nist.gov/div898/handbook/eda/section4/eda4291.htm
data = [
370 1016 1235 1419 1567 1820 ..
706 1018 1238 1420 1578 1868 ..
716 1020 1252 1420 1594 1881 ..
746 1055 1258 1450 1602 1890 ..
785 1085 1262 1452 1604 1893 ..
797 1102 1269 1475 1608 1895 ..
844 1102 1270 1478 1630 1910 ..
855 1108 1290 1481 1642 1923 ..
858 1115 1293 1485 1674 1940 ..
886 1120 1300 1502 1730 1945 ..
886 1134 1310 1505 1750 2023 ..
930 1140 1313 1513 1750 2100 ..
960 1199 1315 1522 1763 2130 ..
988 1200 1330 1522 1768 2215 ..
990 1200 1355 1530 1781 2268 ..
1000 1203 1390 1540 1782 2440 ..
1010 1222 1416 1560 1792];
data=data(:);
[y,a,b]=distfun_wblplot(data);
disp([a,b])

// Test with random numbers
data = distfun_wblrnd(123,4,1000,1);
scf();
[y,a,b]=distfun_wblplot(data);
disp([a,b])

   ]]></programlisting>
</refsection>

<refsection>
   <title>Bibliography</title>
   <para>Probability Plot, NIST/SEMATECH e-Handbook of Statistical Methods, 5th October 2012, section 1.3.3.22, http://www.itl.nist.gov/div898/handbook/eda/section3/probplot.htm</para>
</refsection>
</refentry>
