<?xml-stylesheet type="text/xsl" href="../styles/pmathml.xsl"?>
<!-- saved from url=(0014)about:internet -->
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:dsi="http://www.w3.org/1999/xlink" xmlns:m="http://www.w3.org/1998/Math/MathML" xml:space="preserve"><head><meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"/><title>G07BEF : NAG Library, Mark 22</title><link rel="stylesheet" href="../styles/libdoc.css" type="text/css"/><script type="text/javascript">
   function showLevel(_levelId){
    var thisLevel = document.getElementById(_levelId);
    var thisplus = document.getElementById( _levelId.concat('plus'));
    var thisminus = document.getElementById( _levelId.concat('minus'));
    if(thisLevel.style.display != "block"){
     thisLevel.style.display = "block";
     thisplus.style.display = "none";
     thisminus.style.display = "inline";
     }
    else{
     thisLevel.style.display = "none";
     thisminus.style.display = "none";
     thisplus.style.display = "inline";
     }
    }
  </script></head><body><hr/><div><a class="rout" href="../../pdf/G07/g07bef.pdf">G07BEF (PDF version)</a></div><div><a class="chap" href="g07conts.xml">G07 Chapter Contents</a></div><div><a class="chapint" href="g07intro.xml">G07 Chapter Introduction</a></div>
<div><a class="htmltoc" href="../FRONTMATTER/manconts.xml">NAG Library Manual</a></div><hr/><h1 class="libdoc">NAG Library Routine Document<br/><br/>G07BEF</h1><div class="paramtext"><div class="header"><b>Note:</b>&#160; before using this routine, please read the Users' Note for your implementation to check the interpretation of <span class="bitalic">bold italicised</span> terms and other implementation-dependent details.</div></div> 
<div class="htmltoc">
<h2 class="htmltoc"><span class="htmltochead" onclick="showLevel('htmltoc');"><span class="htmltocplus" id="htmltocplus">+</span><span class="htmltocminus" id="htmltocminus">&#8722;</span></span>&#160;Contents</h2>
<div class="htmltocitem" id="htmltoc">
<div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#purpose">1&#160;&#160;<b>Purpose</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#specification">2&#160;&#160;<b>Specification</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#description">3&#160;&#160;<b>Description</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#references">4&#160;&#160;<b>References</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#parameters">5&#160;&#160;<b>Parameters</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#errors">6&#160;&#160;<b>Error Indicators and Warnings</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#accuracy">7&#160;&#160;<b>Accuracy</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#fcomments">8&#160;&#160;<b>Further Comments</b></a>
</div><div class="htmltoc">
<span class="htmltoc" onclick="showLevel('tocexample');"><span class="htmltocplus" id="tocexampleplus">+</span><span class="htmltocminus" id="tocexampleminus">&#8722;</span></span>
<a class="htmltoc" href="#example">9&#160;&#160;<b>Example</b></a>
<div class="htmltocitem" id="tocexample">
<div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#examtext">9.1&#160;&#160;<b>Program Text</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#examdata">9.2&#160;&#160;<b>Program Data</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#examresults">9.3&#160;&#160;<b>Program Results</b></a>
</div>
</div>
</div>
</div>
</div><h2 class="standard"><a class="sec" name="purpose" id="purpose"/>1&#160;&#160;Purpose</h2>
<div class="paramtext">G07BEF computes maximum likelihood estimates for parameters of the Weibull distribution from data which may be right-censored.</div><h2 class="standard"><a class="sec" name="specification" id="specification"/>2&#160;&#160;Specification</h2>
<table class="fspec"><tr><td class="tdfspec1">SUBROUTINE&#160;G07BEF&#160;(</td><td class="tdfspec2"><a class="arg" href="#CENS">CENS</a>, <a class="arg" href="#N">N</a>, <a class="arg" href="#X">X</a>, <a class="arg" href="#IC">IC</a>, <a class="arg" href="#BETA">BETA</a>, <a class="arg" href="#GAMMA">GAMMA</a>, <a class="arg" href="#TOL">TOL</a>, <a class="arg" href="#MAXIT">MAXIT</a>, <a class="arg" href="#SEBETA">SEBETA</a>, <a class="arg" href="#SEGAM">SEGAM</a>, <a class="arg" href="#CORR">CORR</a>, <a class="arg" href="#DEV">DEV</a>, <a class="arg" href="#NIT">NIT</a>, <a class="arg" href="#WK">WK</a>, <a class="arg" href="#IFAIL">IFAIL</a>)</td></tr><tr><td class="tdfspec1">INTEGER</td><td class="tdfspec2">N, IC(*), MAXIT, NIT, IFAIL</td></tr><tr><td class="tdfspec1"><b><i>double&#160;precision</i></b></td><td class="tdfspec2">X(N), BETA, GAMMA, TOL, SEBETA, SEGAM, CORR, DEV, WK(N)</td></tr><tr><td class="tdfspec1">CHARACTER*1</td><td class="tdfspec2">CENS</td></tr></table><h2 class="standard"><a class="sec" name="description" id="description"/>3&#160;&#160;Description</h2>
<div class="paramtext">G07BEF computes maximum likelihood estimates of the parameters of the Weibull distribution from exact or right-censored data.</div><div class="paramtext">For <m:math><m:mi>n</m:mi></m:math>&#160;realizations, <m:math><m:msub><m:mi>y</m:mi><m:mi>i</m:mi></m:msub></m:math>, from a Weibull distribution a value <m:math><m:msub><m:mi>x</m:mi><m:mi>i</m:mi></m:msub></m:math>&#160;is observed such that

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:msub><m:mi>x</m:mi><m:mi>i</m:mi></m:msub><m:mo>&#8804;</m:mo><m:msub><m:mi>y</m:mi><m:mi>i</m:mi></m:msub><m:mtext>.</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div>

There are two situations:
<table class="standard-100"><tr>
<td style="width:2.1em;" valign="baseline">(a)</td>
<td valign="top">exactly specified observations, when <m:math><m:msub><m:mi>x</m:mi><m:mi>i</m:mi></m:msub><m:mo>=</m:mo><m:msub><m:mi>y</m:mi><m:mi>i</m:mi></m:msub></m:math></td>
</tr><tr>
<td style="width:2.1em;" valign="baseline">(b)</td>
<td valign="top">right-censored observations, known by a lower bound, when <m:math><m:msub><m:mi>x</m:mi><m:mi>i</m:mi></m:msub><m:mo>&lt;</m:mo><m:msub><m:mi>y</m:mi><m:mi>i</m:mi></m:msub></m:math>.</td>
</tr></table>
</div><div class="paramtext">The probability density function of the Weibull distribution, and hence the contribution of an exactly specified observation to the likelihood, is given by:

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:mi>f</m:mi><m:mfenced separators=""><m:mrow><m:mi>x</m:mi><m:mo>;</m:mo><m:mi>&#955;</m:mi></m:mrow><m:mo>,</m:mo><m:mi>&#947;</m:mi></m:mfenced><m:mo>=</m:mo><m:mi>&#955;</m:mi><m:mi>&#947;</m:mi><m:msup><m:mi>x</m:mi><m:mrow><m:mi>&#947;</m:mi><m:mo>-</m:mo><m:mn>1</m:mn></m:mrow></m:msup><m:mrow><m:mi>exp</m:mi><m:mfenced separators=""><m:mo>-</m:mo><m:mi>&#955;</m:mi><m:msup><m:mi>x</m:mi><m:mi>&#947;</m:mi></m:msup></m:mfenced></m:mrow><m:mtext>, &#8195;</m:mtext><m:mi>x</m:mi><m:mo>&gt;</m:mo><m:mn>0</m:mn><m:mtext>, &#8195; for &#8203;</m:mtext><m:mi>&#955;</m:mi><m:mo>,</m:mo><m:mi>&#947;</m:mi><m:mo>&gt;</m:mo><m:mn>0</m:mn><m:mtext>;</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div>

while the survival function of the Weibull distribution, and hence the contribution of a right-censored observation to the likelihood, is given by:

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:mi>S</m:mi><m:mfenced separators=""><m:mrow><m:mi>x</m:mi><m:mo>;</m:mo><m:mi>&#955;</m:mi></m:mrow><m:mo>,</m:mo><m:mi>&#947;</m:mi></m:mfenced><m:mo>=</m:mo><m:mrow><m:mi>exp</m:mi><m:mfenced separators=""><m:mo>-</m:mo><m:mi>&#955;</m:mi> <m:msup><m:mi>x</m:mi><m:mi>&#947;</m:mi></m:msup></m:mfenced></m:mrow><m:mtext>, &#8195;</m:mtext> <m:mi>x</m:mi><m:mo>&gt;</m:mo> <m:mn>0</m:mn><m:mtext>, &#8195; for &#8203;</m:mtext> <m:mi>&#955;</m:mi> <m:mo>,</m:mo><m:mi>&#947;</m:mi><m:mo>&gt;</m:mo> <m:mn>0</m:mn><m:mtext>.</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div>

If <m:math><m:mi>d</m:mi></m:math>&#160;of the <m:math><m:mi>n</m:mi></m:math>&#160;observations are exactly specified and indicated by <m:math><m:mi>i</m:mi><m:mo>&#8712;</m:mo><m:mi>D</m:mi></m:math>&#160;and the remaining <m:math><m:mfenced separators=""><m:mi>n</m:mi><m:mo>-</m:mo><m:mi>d</m:mi></m:mfenced></m:math>&#160;are right-censored, then the likelihood function, <m:math><m:mtext>Like &#8203;</m:mtext><m:mfenced separators=""><m:mi>&#955;</m:mi><m:mo>,</m:mo><m:mi>&#947;</m:mi></m:mfenced></m:math>&#160;is given by

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:mi mathvariant="normal">Like</m:mi><m:mfenced separators=""><m:mi>&#955;</m:mi><m:mo>,</m:mo><m:mi>&#947;</m:mi></m:mfenced><m:mo>&#8733;</m:mo><m:msup><m:mfenced separators=""><m:mi>&#955;</m:mi><m:mi>&#947;</m:mi></m:mfenced><m:mi>d</m:mi></m:msup>
<m:mfenced separators=""><m:msub><m:mo>&#8719;</m:mo><m:mrow><m:mi>i</m:mi><m:mo>&#8712;</m:mo><m:mi>D</m:mi></m:mrow></m:msub><m:msubsup><m:mi>x</m:mi><m:mi>i</m:mi><m:mrow><m:mi>&#947;</m:mi><m:mo>-</m:mo><m:mn>1</m:mn></m:mrow></m:msubsup></m:mfenced>
<m:mrow><m:mi>exp</m:mi><m:mfenced separators=""><m:mo>-</m:mo><m:mi>&#955;</m:mi><m:munderover><m:mo>&#8721;</m:mo><m:mrow><m:mi>i</m:mi><m:mo>=</m:mo><m:mn>1</m:mn></m:mrow><m:mi>n</m:mi></m:munderover><m:msubsup><m:mi>x</m:mi><m:mi>i</m:mi><m:mi>&#947;</m:mi></m:msubsup></m:mfenced></m:mrow>
<m:mtext>.</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div>

To avoid possible numerical instability a different parameterization <m:math><m:mi>&#946;</m:mi><m:mo>,</m:mo><m:mi>&#947;</m:mi></m:math>&#160;is used, with <m:math><m:mi>&#946;</m:mi><m:mo>=</m:mo><m:mrow><m:mi>log</m:mi><m:mfenced separators=""><m:mi>&#955;</m:mi></m:mfenced></m:mrow></m:math>.  The kernel log-likelihood function, <m:math><m:mi>L</m:mi><m:mfenced separators=""><m:mi>&#946;</m:mi><m:mo>,</m:mo><m:mi>&#947;</m:mi></m:mfenced></m:math>, is then:

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:mi>L</m:mi><m:mfenced separators=""><m:mi>&#946;</m:mi><m:mo>,</m:mo><m:mi>&#947;</m:mi></m:mfenced><m:mo>=</m:mo><m:mi>d</m:mi><m:mrow><m:mi>log</m:mi><m:mfenced separators=""><m:mi>&#947;</m:mi></m:mfenced></m:mrow><m:mo>+</m:mo><m:mi>d</m:mi><m:mi>&#946;</m:mi><m:mo>+</m:mo><m:mfenced separators=""><m:mi>&#947;</m:mi><m:mo>-</m:mo><m:mn>1</m:mn></m:mfenced><m:msub><m:mo>&#8721;</m:mo><m:mrow><m:mi>i</m:mi><m:mo>&#8712;</m:mo><m:mi>D</m:mi></m:mrow></m:msub><m:mrow><m:mi>log</m:mi><m:mfenced separators=""><m:msub><m:mi>x</m:mi><m:mi>i</m:mi></m:msub></m:mfenced></m:mrow><m:mo>-</m:mo><m:msup><m:mi>e</m:mi><m:mi>&#946;</m:mi></m:msup><m:munderover><m:mo>&#8721;</m:mo><m:mrow><m:mi>i</m:mi><m:mo>=</m:mo><m:mn>1</m:mn></m:mrow><m:mi>n</m:mi></m:munderover><m:msubsup><m:mi>x</m:mi><m:mi>i</m:mi><m:mi>&#947;</m:mi></m:msubsup><m:mtext>.</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div>

If the derivatives <m:math>
 <m:mfrac other="display">
  <m:mrow><m:mo>&#8706;</m:mo><m:mi>L</m:mi></m:mrow>
  <m:mrow><m:mo>&#8706;</m:mo><m:mi>&#946;</m:mi></m:mrow>
 </m:mfrac>
</m:math>, <m:math>
 <m:mfrac other="display">
  <m:mrow><m:mo>&#8706;</m:mo><m:mi>L</m:mi></m:mrow>
  <m:mrow><m:mo>&#8706;</m:mo><m:mi>&#947;</m:mi></m:mrow>
 </m:mfrac>
</m:math>, <m:math>
 <m:mfrac other="display">
  <m:mrow><m:msup><m:mo>&#8706;</m:mo><m:mn>2</m:mn></m:msup><m:mi>L</m:mi></m:mrow>
  <m:msup><m:mrow><m:mo>&#8706;</m:mo><m:mi>&#946;</m:mi></m:mrow><m:mn>2</m:mn></m:msup>
 </m:mfrac>
</m:math>, <m:math>
 <m:mfrac other="display">
  <m:mrow><m:msup><m:mo>&#8706;</m:mo><m:mn>2</m:mn></m:msup><m:mi>L</m:mi></m:mrow>
  <m:mrow><m:mrow><m:mo>&#8706;</m:mo><m:mi>&#946;</m:mi></m:mrow>
  <m:mrow><m:mo>&#8706;</m:mo><m:mi>&#947;</m:mi></m:mrow></m:mrow>
 </m:mfrac>
</m:math>&#160;and <m:math>
 <m:mfrac other="display">
  <m:mrow><m:msup><m:mo>&#8706;</m:mo><m:mn>2</m:mn></m:msup><m:mi>L</m:mi></m:mrow>
  <m:msup><m:mrow><m:mo>&#8706;</m:mo><m:mi>&#947;</m:mi></m:mrow><m:mn>2</m:mn></m:msup>
 </m:mfrac>
</m:math>&#160;are denoted by <m:math><m:msub><m:mi>L</m:mi><m:mn>1</m:mn></m:msub></m:math>, <m:math><m:msub><m:mi>L</m:mi><m:mn>2</m:mn></m:msub></m:math>, <m:math><m:msub><m:mi>L</m:mi><m:mn>11</m:mn></m:msub></m:math>, <m:math><m:msub><m:mi>L</m:mi><m:mn>12</m:mn></m:msub></m:math>&#160;and <m:math><m:msub><m:mi>L</m:mi><m:mn>22</m:mn></m:msub></m:math>, respectively, then the maximum likelihood estimates, <m:math><m:mover><m:mi>&#946;</m:mi><m:mo>^</m:mo></m:mover></m:math>&#160;and <m:math><m:mover><m:mi>&#947;</m:mi><m:mo>^</m:mo></m:mover></m:math>, are the solution to the equations:

<div class="formula-eqn"><a name="eqn1" id="eqn1"/><table class="formula-eqn"><tr><td class="formula-eqn"><m:math display="block">
<m:msub><m:mi>L</m:mi><m:mn>1</m:mn></m:msub><m:mfenced separators=""><m:mover><m:mi>&#946;</m:mi><m:mo>^</m:mo></m:mover><m:mo>,</m:mo><m:mover><m:mi>&#947;</m:mi><m:mo>^</m:mo></m:mover></m:mfenced><m:mo>=</m:mo><m:mn>0</m:mn>
</m:math></td><td class="formula-eqn2">
      (1)
     </td></tr></table></div>

and

<div class="formula-eqn"><a name="eqn2" id="eqn2"/><table class="formula-eqn"><tr><td class="formula-eqn"><m:math display="block">
<m:msub><m:mi>L</m:mi><m:mn>2</m:mn></m:msub><m:mfenced separators=""><m:mover><m:mi>&#946;</m:mi><m:mo>^</m:mo></m:mover><m:mo>,</m:mo><m:mover><m:mi>&#947;</m:mi><m:mo>^</m:mo></m:mover></m:mfenced><m:mo>=</m:mo><m:mn>0</m:mn>
</m:math></td><td class="formula-eqn2">
      (2)
     </td></tr></table></div>

Estimates of the asymptotic standard errors of <m:math><m:mover><m:mi>&#946;</m:mi><m:mo>^</m:mo></m:mover></m:math>&#160;and <m:math><m:mover><m:mi>&#947;</m:mi><m:mo>^</m:mo></m:mover></m:math>&#160;are given by:

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:mrow><m:mi>se</m:mi><m:mfenced separators=""><m:mover><m:mi>&#946;</m:mi><m:mo>^</m:mo></m:mover></m:mfenced></m:mrow><m:mo>=</m:mo><m:msqrt><m:mfrac><m:mrow><m:mo>-</m:mo><m:msub><m:mi>L</m:mi><m:mn>22</m:mn></m:msub></m:mrow>
  <m:mrow><m:msub><m:mi>L</m:mi><m:mn>11</m:mn></m:msub><m:msub><m:mi>L</m:mi><m:mn>22</m:mn></m:msub><m:mo>-</m:mo><m:msup><m:msub><m:mi>L</m:mi><m:mn>12</m:mn></m:msub><m:mn>2</m:mn></m:msup></m:mrow>
 </m:mfrac></m:msqrt><m:mtext>, &#8195;</m:mtext><m:mrow><m:mi>se</m:mi><m:mfenced separators=""><m:mover><m:mi>&#947;</m:mi><m:mo>^</m:mo></m:mover></m:mfenced></m:mrow><m:mo>=</m:mo><m:msqrt><m:mfrac><m:mrow><m:mo>-</m:mo><m:msub><m:mi>L</m:mi><m:mn>11</m:mn></m:msub></m:mrow>
  <m:mrow><m:msub><m:mi>L</m:mi><m:mn>11</m:mn></m:msub><m:msub><m:mi>L</m:mi><m:mn>22</m:mn></m:msub><m:mo>-</m:mo><m:msup><m:msub><m:mi>L</m:mi><m:mn>12</m:mn></m:msub><m:mn>2</m:mn></m:msup></m:mrow>
 </m:mfrac></m:msqrt><m:mtext>.</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div>

An estimate of the correlation coefficient of <m:math><m:mover><m:mi>&#946;</m:mi><m:mo>^</m:mo></m:mover></m:math>&#160;and <m:math><m:mover><m:mi>&#947;</m:mi><m:mo>^</m:mo></m:mover></m:math>&#160;is given by:

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:mfrac><m:msub><m:mi>L</m:mi><m:mn>12</m:mn></m:msub><m:msqrt><m:msub><m:mi>L</m:mi><m:mn>12</m:mn></m:msub><m:msub><m:mi>L</m:mi><m:mn>22</m:mn></m:msub></m:msqrt>
 </m:mfrac><m:mtext>.</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div><b>Note:</b>&#160; if an estimate of the original parameter <m:math><m:mi>&#955;</m:mi></m:math>&#160;is required, then

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:mover><m:mi>&#955;</m:mi><m:mo>^</m:mo></m:mover><m:mo>=</m:mo><m:mrow><m:mi>exp</m:mi><m:mfenced separators=""><m:mover><m:mi>&#946;</m:mi><m:mo>^</m:mo></m:mover></m:mfenced></m:mrow><m:mtext>&#8195; and &#8195;</m:mtext><m:mrow><m:mi>se</m:mi><m:mfenced separators=""><m:mover><m:mi>&#955;</m:mi><m:mo>^</m:mo></m:mover></m:mfenced></m:mrow><m:mo>=</m:mo><m:mover><m:mi>&#955;</m:mi><m:mo>^</m:mo></m:mover><m:mrow><m:mi>se</m:mi><m:mfenced separators=""><m:mover><m:mi>&#946;</m:mi><m:mo>^</m:mo></m:mover></m:mfenced></m:mrow><m:mtext>.</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div>

The equations <a class="eqn" href="#eqn1">(1)</a> and <a class="eqn" href="#eqn2">(2)</a> are solved by the Newton&#8211;Raphson iterative method with adjustments made to ensure that <m:math><m:mover><m:mi>&#947;</m:mi><m:mo>^</m:mo></m:mover><m:mo>&gt;</m:mo><m:mn>0.0</m:mn></m:math>.</div><h2 class="standard"><a class="sec" name="references" id="references"/>4&#160;&#160;References</h2><div class="paramtext"><a name="ref390" id="ref390"/>Gross A J and Clark V A (1975)  <i>Survival Distributions: Reliability Applications in the Biomedical Sciences</i> Wiley </div>
<div class="paramtext"><a name="ref413" id="ref413"/>Kalbfleisch J D and Prentice R L (1980)  <i>The Statistical Analysis of Failure Time Data</i> Wiley </div><h2 class="standard"><a class="sec" name="parameters" id="parameters"/>5&#160;&#160;Parameters</h2>
<dl><dt class="paramhead"><a name="CENS" id="CENS"/>1: &#160;&#160;&#8194; CENS &#8211; CHARACTER*1<span class="pclass">Input</span></dt><dd><div class="paramtext"><i>On entry</i>: indicates whether the data is censored or non-censored.
<ul class="listind"><li class="listind">If <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#CENS"><m:mi mathcolor="#EE0000" mathvariant="bold">CENS</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'N'</m:mtext></m:math>, then each observation is assumed to be exactly specified. <a class="arg" href="#IC">IC</a> is not referenced.</li><li class="listind">If <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#CENS"><m:mi mathcolor="#EE0000" mathvariant="bold">CENS</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'C'</m:mtext></m:math>, then each observation is censored according to the value contained in <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#IC"><m:mi mathcolor="#EE0000" mathvariant="bold">IC</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>i</m:mi></m:mfenced></m:mrow></m:math>, for <m:math><m:mi>i</m:mi><m:mo>=</m:mo><m:mn>1</m:mn><m:mo>,</m:mo><m:mn>2</m:mn><m:mo>,</m:mo><m:mo>&#8230;</m:mo><m:mo>,</m:mo><m:mi>n</m:mi></m:math>.</li></ul>
</div><div class="paramtext"><i>Constraint</i>:
  <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#CENS"><m:mi mathcolor="#EE0000" mathvariant="bold">CENS</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'C'</m:mtext></m:math>&#160;or <m:math><m:mtext>'N'</m:mtext></m:math>.
</div></dd><dt class="paramhead"><a name="N" id="N"/>2: &#160;&#160;&#8194; N &#8211; INTEGER<span class="pclass">Input</span></dt><dd><div class="paramtext"><i>On entry</i>: 

<m:math><m:mi>n</m:mi></m:math>, the number of observations.</div><div class="paramtext"><i>Constraint</i>:
  <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction><m:mo>&#8805;</m:mo><m:mn>1</m:mn></m:math>.
</div></dd><dt class="paramhead"><a name="X" id="X"/>3: &#160;&#160;&#8194; X(<a class="arg" href="#N">N</a>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">Input</span></dt><dd><div class="paramtext"><i>On entry</i>: <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#X"><m:mi mathcolor="#EE0000" mathvariant="bold">X</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>i</m:mi></m:mfenced></m:mrow></m:math>&#160;contains the <m:math><m:mi>i</m:mi></m:math>th observation, <m:math><m:msub><m:mi>x</m:mi><m:mi>i</m:mi></m:msub></m:math>, for <m:math><m:mi>i</m:mi><m:mo>=</m:mo><m:mn>1</m:mn><m:mo>,</m:mo><m:mn>2</m:mn><m:mo>,</m:mo><m:mo>&#8230;</m:mo><m:mo>,</m:mo><m:mi>n</m:mi></m:math>.</div><div class="paramtext"><i>Constraint</i>:
  <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#X"><m:mi mathcolor="#EE0000" mathvariant="bold">X</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi mathvariant="italic">i</m:mi></m:mfenced></m:mrow><m:mo>&gt;</m:mo><m:mn>0.0</m:mn></m:math>,  for <m:math><m:mi mathvariant="italic">i</m:mi><m:mo>=</m:mo><m:mn>1</m:mn><m:mo>,</m:mo><m:mn>2</m:mn><m:mo>,</m:mo><m:mo>&#8230;</m:mo><m:mo>,</m:mo><m:mi>n</m:mi></m:math>.</div></dd><dt class="paramhead"><a name="IC" id="IC"/>4: &#160;&#160;&#8194; IC(<m:math><m:mo>*</m:mo></m:math>) &#8211; INTEGER array<span class="pclass">Input</span></dt><dd><div class="paramtext"><b>Note:</b> the dimension of the array <a class="arg" href="#IC">IC</a>
must be at least
<m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction></m:math>&#160;if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#CENS"><m:mi mathcolor="#EE0000" mathvariant="bold">CENS</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'C'</m:mtext></m:math>, and at least <m:math><m:mn>1</m:mn></m:math>&#160;otherwise.</div>
<div class="paramtext"><i>On entry</i>: if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#CENS"><m:mi mathcolor="#EE0000" mathvariant="bold">CENS</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'C'</m:mtext></m:math>, then <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#IC"><m:mi mathcolor="#EE0000" mathvariant="bold">IC</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>i</m:mi></m:mfenced></m:mrow></m:math>&#160;contains the censoring codes for the <m:math><m:mi>i</m:mi></m:math>th observation, for <m:math><m:mi>i</m:mi><m:mo>=</m:mo><m:mn>1</m:mn><m:mo>,</m:mo><m:mn>2</m:mn><m:mo>,</m:mo><m:mo>&#8230;</m:mo><m:mo>,</m:mo><m:mi>n</m:mi></m:math>.
<div class="paramtext">If <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#IC"><m:mi mathcolor="#EE0000" mathvariant="bold">IC</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>i</m:mi></m:mfenced></m:mrow><m:mo>=</m:mo><m:mn>0</m:mn></m:math>, the <m:math><m:mi>i</m:mi></m:math>th observation is exactly specified.</div>
<div class="paramtext">If <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#IC"><m:mi mathcolor="#EE0000" mathvariant="bold">IC</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>i</m:mi></m:mfenced></m:mrow><m:mo>=</m:mo><m:mn>1</m:mn></m:math>, the <m:math><m:mi>i</m:mi></m:math>th observation is right-censored.</div>
<div class="paramtext">If <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#CENS"><m:mi mathcolor="#EE0000" mathvariant="bold">CENS</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'N'</m:mtext></m:math>, then <a class="arg" href="#IC">IC</a> is not referenced.</div>
</div><div class="paramtext"><i>Constraint</i>:
  

if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#CENS"><m:mi mathcolor="#EE0000" mathvariant="bold">CENS</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'C'</m:mtext></m:math>, then <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#IC"><m:mi mathcolor="#EE0000" mathvariant="bold">IC</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>i</m:mi></m:mfenced></m:mrow><m:mo>=</m:mo><m:mn>0</m:mn></m:math>&#160;or <m:math><m:mn>1</m:mn></m:math>, for <m:math><m:mi>i</m:mi><m:mo>=</m:mo><m:mn>1</m:mn><m:mo>,</m:mo><m:mn>2</m:mn><m:mo>,</m:mo><m:mo>&#8230;</m:mo><m:mo>,</m:mo><m:mi>n</m:mi></m:math>.
</div></dd><dt class="paramhead"><a name="BETA" id="BETA"/>5: &#160;&#160;&#8194; BETA &#8211; <span class="bitalic">double precision</span><span class="pclass">Output</span></dt><dd><div class="paramtext"><i>On exit</i>: the maximum likelihood estimate, <m:math><m:mover><m:mi>&#946;</m:mi><m:mo>^</m:mo></m:mover></m:math>, of <m:math><m:mi>&#946;</m:mi></m:math>.</div></dd><dt class="paramhead"><a name="GAMMA" id="GAMMA"/>6: &#160;&#160;&#8194; GAMMA &#8211; <span class="bitalic">double precision</span><span class="pclass">Input/Output</span></dt><dd><div class="paramtext"><i>On entry</i>: indicates whether an initial estimate of <m:math><m:mi>&#947;</m:mi></m:math>&#160;is provided.
<div class="paramtext">If <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#GAMMA"><m:mi mathcolor="#EE0000" mathvariant="bold">GAMMA</m:mi></m:maction><m:mo>&gt;</m:mo><m:mn>0.0</m:mn></m:math>, it is taken as the initial estimate of <m:math><m:mi>&#947;</m:mi></m:math>&#160;and an initial estimate of <m:math><m:mi>&#946;</m:mi></m:math>&#160;is calculated from this value of <m:math><m:mi>&#947;</m:mi></m:math>.</div>
<div class="paramtext">If <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#GAMMA"><m:mi mathcolor="#EE0000" mathvariant="bold">GAMMA</m:mi></m:maction><m:mo>&#8804;</m:mo><m:mn>0.0</m:mn></m:math>, then initial estimates of <m:math><m:mi>&#947;</m:mi></m:math>&#160;and <m:math><m:mi>&#946;</m:mi></m:math>&#160;are calculated, internally, providing the data contains at least two distinct exact observations. (If there are only two distinct exact observations, then the largest observation must not be exactly specified.) See <a class="sec" href="#fcomments">Section 8</a> for further details.</div>
</div>
<div class="paramtext"><i>On exit</i>: contains the maximum likelihood estimate, <m:math><m:mover><m:mi>&#947;</m:mi><m:mo>^</m:mo></m:mover></m:math>, of <m:math><m:mi>&#947;</m:mi></m:math>.</div></dd><dt class="paramhead"><a name="TOL" id="TOL"/>7: &#160;&#160;&#8194; TOL &#8211; <span class="bitalic">double precision</span><span class="pclass">Input</span></dt><dd><div class="paramtext"><i>On entry</i>: the relative precision required for the final estimates of <m:math><m:mi>&#946;</m:mi></m:math>&#160;and <m:math><m:mi>&#947;</m:mi></m:math>. Convergence is assumed when the absolute relative changes in the estimates of both <m:math><m:mi>&#946;</m:mi></m:math>&#160;and <m:math><m:mi>&#947;</m:mi></m:math>&#160;are less than <a class="arg" href="#TOL">TOL</a>.
<div class="paramtext">If <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#TOL"><m:mi mathcolor="#EE0000" mathvariant="bold">TOL</m:mi></m:maction><m:mo>=</m:mo><m:mn>0.0</m:mn></m:math>, then a relative precision of <m:math><m:mn>0.000005</m:mn></m:math>&#160;is used.</div>
</div><div class="paramtext"><i>Constraint</i>:
  <m:math><m:mi mathvariant="bold-italic">machine&#160;precision</m:mi><m:mo>&#8804;</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#TOL"><m:mi mathcolor="#EE0000" mathvariant="bold">TOL</m:mi></m:maction><m:mo>&#8804;</m:mo><m:mn>1.0</m:mn></m:math>&#160;or <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#TOL"><m:mi mathcolor="#EE0000" mathvariant="bold">TOL</m:mi></m:maction><m:mo>=</m:mo><m:mn>0.0</m:mn></m:math>.
</div></dd><dt class="paramhead"><a name="MAXIT" id="MAXIT"/>8: &#160;&#160;&#8194; MAXIT &#8211; INTEGER<span class="pclass">Input</span></dt><dd><div class="paramtext"><i>On entry</i>: the maximum number of iterations allowed.
<div class="paramtext">If <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#MAXIT"><m:mi mathcolor="#EE0000" mathvariant="bold">MAXIT</m:mi></m:maction><m:mo>&#8804;</m:mo><m:mn>0</m:mn></m:math>, then a value of <m:math><m:mn>25</m:mn></m:math>&#160;is used.</div>
</div></dd><dt class="paramhead"><a name="SEBETA" id="SEBETA"/>9: &#160;&#160;&#8194; SEBETA &#8211; <span class="bitalic">double precision</span><span class="pclass">Output</span></dt><dd><div class="paramtext"><i>On exit</i>: an estimate of the standard error of <m:math><m:mover><m:mi>&#946;</m:mi><m:mo>^</m:mo></m:mover></m:math>.</div></dd><dt class="paramhead"><a name="SEGAM" id="SEGAM"/>10: &#8194; SEGAM &#8211; <span class="bitalic">double precision</span><span class="pclass">Output</span></dt><dd><div class="paramtext"><i>On exit</i>: an estimate of the standard error of <m:math><m:mover><m:mi>&#947;</m:mi><m:mo>^</m:mo></m:mover></m:math>.</div></dd><dt class="paramhead"><a name="CORR" id="CORR"/>11: &#8194; CORR &#8211; <span class="bitalic">double precision</span><span class="pclass">Output</span></dt><dd><div class="paramtext"><i>On exit</i>: an estimate of the correlation between <m:math><m:mover><m:mi>&#946;</m:mi><m:mo>^</m:mo></m:mover></m:math>&#160;and <m:math><m:mover><m:mi>&#947;</m:mi><m:mo>^</m:mo></m:mover></m:math>.</div></dd><dt class="paramhead"><a name="DEV" id="DEV"/>12: &#8194; DEV &#8211; <span class="bitalic">double precision</span><span class="pclass">Output</span></dt><dd><div class="paramtext"><i>On exit</i>: the maximized kernel log-likelihood, <m:math><m:mi>L</m:mi><m:mfenced separators=""><m:mover><m:mi>&#946;</m:mi><m:mo>^</m:mo></m:mover><m:mo>,</m:mo><m:mover><m:mi>&#947;</m:mi><m:mo>^</m:mo></m:mover></m:mfenced></m:math>.</div></dd><dt class="paramhead"><a name="NIT" id="NIT"/>13: &#8194; NIT &#8211; INTEGER<span class="pclass">Output</span></dt><dd>
<div class="paramtext"><i>On exit</i>: the number of iterations performed.</div></dd><dt class="paramhead"><a name="WK" id="WK"/>14: &#8194; WK(<a class="arg" href="#N">N</a>) &#8211; <span class="bitalic">double precision</span> array<span class="pclass">Workspace</span></dt><dt class="paramhead"><a name="IFAIL" id="IFAIL"/>15: &#8194; IFAIL &#8211; INTEGER<span class="pclass">Input/Output</span></dt><dd>
<div class="paramtext"><i>On entry</i>: <a class="arg" href="#IFAIL">IFAIL</a> must be set to <m:math><m:mn>0</m:mn></m:math>, <m:math><m:mrow><m:mo>-</m:mo><m:mn>1</m:mn></m:mrow><m:mtext>&#8203; or &#8203;</m:mtext><m:mn>1</m:mn></m:math>. If you are unfamiliar with this parameter you should refer to <a class="sec" href="../GENINT/essint.xml#library3">Section 3.3</a> in  the Essential Introduction for details.</div>
<div class="paramtext"><i>On exit</i>: <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#errors"><m:mn mathcolor="#003399" mathvariant="bold">0</m:mn></m:maction></m:math>&#160;unless the routine detects an error (see <a class="sec" href="#errors">Section 6</a>). <div class="paramtext">For environments where it might be inappropriate to halt program execution when an error is detected, the value <m:math><m:mrow><m:mo>-</m:mo><m:mn>1</m:mn></m:mrow><m:mtext>&#8203; or &#8203;</m:mtext><m:mn>1</m:mn></m:math>&#160;is recommended.  If the output of error messages is undesirable, then the value <m:math><m:mn>1</m:mn></m:math>&#160;is recommended.  Otherwise, if you are not familiar with this parameter, the recommended value is <m:math><m:mn>0</m:mn></m:math>.  <b>When the value <m:math><m:mrow><m:mo>-</m:mo><m:mn mathvariant="bold">1</m:mn></m:mrow><m:mtext>&#8203; or &#8203;</m:mtext><m:mn mathvariant="bold">1</m:mn></m:math>&#160;is used it is essential to test the value of <a class="arg" href="#IFAIL">IFAIL</a> on exit.</b></div></div></dd></dl><h2 class="standard"><a class="sec" name="errors" id="errors"/>6&#160;&#160;Error Indicators and Warnings</h2>
<div class="paramtext">If on entry <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#errors"><m:mn mathcolor="#003399" mathvariant="bold">0</m:mn></m:maction></m:math>&#160;or <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#errors"><m:mn mathcolor="#003399" mathvariant="bold">-1</m:mn></m:maction></m:math>, explanatory error messages are output on the current error message unit (as defined by <a class="rout" href="../X04/x04aaf.xml">X04AAF</a>).</div><div class="paramtext">Errors or warnings detected by the routine:</div>
<dl class="ifail">
<dt class="errorhead"><a name="IFeq1" id="IFeq1"/><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:mn>1</m:mn></m:math></dt>
<dd>
<table class="ifail"><tr><td class="ifail1">On&#160;entry,</td><td class="ifail2-90"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#CENS"><m:mi mathcolor="#EE0000" mathvariant="bold">CENS</m:mi></m:maction><m:mo>&#8800;</m:mo><m:mtext>'N'</m:mtext></m:math>&#160;or <m:math><m:mtext>'C'</m:mtext></m:math>,</td></tr><tr><td class="ifail1">or</td><td class="ifail2-90"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#N"><m:mi mathcolor="#EE0000" mathvariant="bold">N</m:mi></m:maction><m:mo>&lt;</m:mo><m:mn>1</m:mn></m:math>,</td></tr><tr><td class="ifail1">or</td><td class="ifail2-90"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#TOL"><m:mi mathcolor="#EE0000" mathvariant="bold">TOL</m:mi></m:maction><m:mo>&lt;</m:mo><m:mn>0.0</m:mn></m:math>,</td></tr><tr><td class="ifail1">or</td><td class="ifail2-90"><m:math><m:mn>0.0</m:mn><m:mo>&lt;</m:mo><m:maction actiontype="link" dsi:type="simple" dsi:href="#TOL"><m:mi mathcolor="#EE0000" mathvariant="bold">TOL</m:mi></m:maction><m:mo>&lt;</m:mo><m:mi mathvariant="bold-italic">machine&#160;precision</m:mi></m:math>,</td></tr><tr><td class="ifail1">or</td><td class="ifail2-90"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#TOL"><m:mi mathcolor="#EE0000" mathvariant="bold">TOL</m:mi></m:maction><m:mo>&gt;</m:mo><m:mn>1.0</m:mn></m:math>.</td></tr></table>
</dd>
</dl><dl class="ifail">
<dt class="errorhead"><a name="IFeq2" id="IFeq2"/><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:mn>2</m:mn></m:math></dt>
<dd>
<table class="ifail"><tr><td class="ifail1">On&#160;entry,</td><td class="ifail2-90">the <m:math><m:mi>i</m:mi></m:math>th observation, <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#X"><m:mi mathcolor="#EE0000" mathvariant="bold">X</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>i</m:mi></m:mfenced></m:mrow><m:mo>&#8804;</m:mo><m:mn>0.0</m:mn></m:math>, for some <m:math><m:mi>i</m:mi><m:mo>=</m:mo><m:mn>1</m:mn><m:mo>,</m:mo><m:mn>2</m:mn><m:mo>,</m:mo><m:mo>&#8230;</m:mo><m:mo>,</m:mo><m:mi>n</m:mi></m:math>,</td></tr><tr><td class="ifail1">or</td><td class="ifail2-90">the <m:math><m:mi>i</m:mi></m:math>th censoring code, <m:math><m:mrow><m:maction actiontype="link" dsi:type="simple" dsi:href="#IC"><m:mi mathcolor="#EE0000" mathvariant="bold">IC</m:mi></m:maction><m:mfenced separators="," open="(" close=")"><m:mi>i</m:mi></m:mfenced></m:mrow><m:mo>&#8800;</m:mo><m:mn>0</m:mn></m:math>&#160;or <m:math><m:mn>1</m:mn></m:math>, for some <m:math><m:mi>i</m:mi><m:mo>=</m:mo><m:mn>1</m:mn><m:mo>,</m:mo><m:mn>2</m:mn><m:mo>,</m:mo><m:mo>&#8230;</m:mo><m:mo>,</m:mo><m:mi>n</m:mi></m:math>&#160;and <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#CENS"><m:mi mathcolor="#EE0000" mathvariant="bold">CENS</m:mi></m:maction><m:mo>=</m:mo><m:mtext>'C'</m:mtext></m:math>.</td></tr></table>
</dd>
</dl><dl class="ifail">
<dt class="errorhead"><a name="IFeq3" id="IFeq3"/><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:mn>3</m:mn></m:math></dt>
<dd>
<div class="paramtext">On entry, there are no exactly specified observations, or the routine was requested to calculate initial values and there are either less than two distinct exactly specified observations or there are exactly two and the largest observation is one of the exact observations.</div>
</dd>
</dl><dl class="ifail">
<dt class="errorhead"><a name="IFeq4" id="IFeq4"/><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:mn>4</m:mn></m:math></dt>
<dd>
<div class="paramtext">The method has failed to converge in <a class="arg" href="#MAXIT">MAXIT</a> iterations.  You should increase <a class="arg" href="#TOL">TOL</a> or <a class="arg" href="#MAXIT">MAXIT</a>.</div>
</dd>
</dl><dl class="ifail">
<dt class="errorhead"><a name="IFeq5" id="IFeq5"/><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:mn>5</m:mn></m:math></dt>
<dd>
<div class="paramtext">Process has diverged.  The process is deemed divergent if three successive increments of <m:math><m:mi>&#946;</m:mi></m:math>&#160;or <m:math><m:mi>&#947;</m:mi></m:math>&#160;increase or if the Hessian matrix of the Newton&#8211;Raphson process is singular.  Either different initial estimates should be provided or the data should be checked to see if the Weibull distribution is appropriate.</div>
</dd>
</dl><dl class="ifail">
<dt class="errorhead"><a name="IFeq6" id="IFeq6"/><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IFAIL"><m:mi mathcolor="#EE0000" mathvariant="bold">IFAIL</m:mi></m:maction><m:mo>=</m:mo><m:mn>6</m:mn></m:math></dt>
<dd>
<div class="paramtext">A potential overflow has been detected.  This is an unlikely exit usually caused by a large input estimate of <m:math><m:mi>&#947;</m:mi></m:math>.</div>
</dd>
</dl><h2 class="standard"><a class="sec" name="accuracy" id="accuracy"/>7&#160;&#160;Accuracy</h2>
<div class="paramtext">Given that the Weibull distribution is a suitable model for the data and that the initial values are reasonable the convergence to the required accuracy, indicated by <a class="arg" href="#TOL">TOL</a>, should be achieved.</div><h2 class="standard"><a class="sec" name="fcomments" id="fcomments"/>8&#160;&#160;Further Comments</h2>
<div class="paramtext">The initial estimate of <m:math><m:mi>&#947;</m:mi></m:math>&#160;is found by calculating a Kaplan&#8211;Meier estimate of the survival function, <m:math><m:mover><m:mi>S</m:mi><m:mo>^</m:mo></m:mover><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:math>, and estimating the gradient of the plot of <m:math><m:mrow><m:mi>log</m:mi><m:mfenced separators=""><m:mo>-</m:mo><m:mrow><m:mi>log</m:mi><m:mfenced separators=""><m:mover><m:mi>S</m:mi><m:mo>^</m:mo></m:mover><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced></m:mfenced></m:mrow></m:mfenced></m:mrow></m:math>&#160;against <m:math><m:mi>x</m:mi></m:math>.  This requires the Kaplan&#8211;Meier estimate to have at least two distinct points.</div><div class="paramtext">The initial estimate of <m:math><m:mover><m:mi>&#946;</m:mi><m:mo>^</m:mo></m:mover></m:math>, given a value of <m:math><m:mover><m:mi>&#947;</m:mi><m:mo>^</m:mo></m:mover></m:math>, is calculated as

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:mover><m:mi>&#946;</m:mi><m:mo>^</m:mo></m:mover><m:mo>=</m:mo><m:mrow><m:mi>log</m:mi><m:mfenced separators=""><m:mfrac><m:mi>d</m:mi><m:mrow><m:munderover><m:mo>&#8721;</m:mo><m:mrow><m:mi>i</m:mi><m:mo>=</m:mo><m:mn>1</m:mn></m:mrow><m:mi>n</m:mi></m:munderover><m:msubsup><m:mi>x</m:mi><m:mi>i</m:mi><m:mover><m:mi>&#947;</m:mi><m:mo>^</m:mo></m:mover></m:msubsup></m:mrow>
 </m:mfrac></m:mfenced></m:mrow>
<m:mtext>.</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div></div><h2 class="standard"><a class="sec" name="example" id="example"/>9&#160;&#160;Example</h2>
<div class="paramtext">In a study, <m:math><m:mn>20</m:mn></m:math>&#160;patients receiving an analgesic to relieve headache pain had the following recorded relief times (in hours):

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:mn>1.1</m:mn><m:mo>&#160;</m:mo><m:mn>1.4</m:mn><m:mo>&#160;</m:mo><m:mn>1.3</m:mn><m:mo>&#160;</m:mo><m:mn>1.7</m:mn><m:mo>&#160;</m:mo><m:mn>1.9</m:mn><m:mo>&#160;</m:mo><m:mn>1.8</m:mn><m:mo>&#160;</m:mo><m:mn>1.6</m:mn><m:mo>&#160;</m:mo><m:mn>2.2</m:mn><m:mo>&#160;</m:mo><m:mn>1.7</m:mn><m:mo>&#160;</m:mo><m:mn>2.7</m:mn><m:mo>&#160;</m:mo><m:mn>4.1</m:mn><m:mo>&#160;</m:mo><m:mn>1.8</m:mn><m:mo>&#160;</m:mo><m:mn>1.5</m:mn><m:mo>&#160;</m:mo><m:mn>1.2</m:mn><m:mo>&#160;</m:mo><m:mn>1.4</m:mn><m:mo>&#160;</m:mo><m:mn>3.0</m:mn><m:mo>&#160;</m:mo><m:mn>1.7</m:mn><m:mo>&#160;</m:mo><m:mn>2.3</m:mn><m:mo>&#160;</m:mo><m:mn>1.6</m:mn><m:mo>&#160;</m:mo><m:mn>2.0</m:mn>
</m:math></td><td class="formula2"/></tr></table></div>

(See <a class="ref" href="#ref390">Gross and Clark (1975)</a>.)  This data is read in and a Weibull distribution fitted assuming no censoring; the parameter estimates and their standard errors are printed.</div><h3 class="standard"><a class="sec" name="examtext" id="examtext"/>9.1&#160;&#160;Program Text</h3>
<p><a class="verbatimref" href="../../examples/source/g07befe.f">Program Text (g07befe.f)</a></p><h3 class="standard"><a class="sec" name="examdata" id="examdata"/>9.2&#160;&#160;Program Data</h3>
<p><a class="verbatimref" href="../../examples/data/g07befe.d">Program&#160;Data (g07befe.d)</a></p><h3 class="standard"><a class="sec" name="examresults" id="examresults"/>9.3&#160;&#160;Program Results</h3>
<p><a class="verbatimref" href="../../examples/baseresults/g07befe.r">Program Results (g07befe.r)</a></p>
<hr/><div><a class="rout" href="../../pdf/G07/g07bef.pdf">G07BEF (PDF version)</a></div><div><a class="chap" href="g07conts.xml">G07 Chapter Contents</a></div><div><a class="chapint" href="g07intro.xml">G07 Chapter Introduction</a></div>
<div><a class="htmltoc" href="../FRONTMATTER/manconts.xml">NAG Library Manual</a></div>
<div><hr/><a class="genint" href="../FRONTMATTER/copyright.xml">&#169; The Numerical Algorithms Group Ltd, Oxford, UK. 2009</a></div></body></html>
