<?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>G01AAF : NAG Library, Mark 23</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/G01/g01aaf.pdf">G01AAF (PDF version)</a></div><div><a class="chap" href="g01conts.xml">G01 Chapter Contents</a></div><div><a class="chapint" href="g01intro.xml">G01 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/>G01AAF</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">G01AAF calculates the mean, standard deviation, coefficients of skewness and kurtosis, and the maximum and minimum values for a set of ungrouped data.  Weighting may be used.</div><h2 class="standard"><a class="sec" name="specification" id="specification"/>2&#160;&#160;Specification</h2><table class="fspec"><tr><td class="tdfspec1">
<div class="left-tablediv"><table class="fspec1"><tbody>
<tr>
<td class="tdfspec1" valign="top" align="left">SUBROUTINE&#160;G01AAF&#160;(</td>
<td class="tdfspec2" valign="top" align="left"><a class="arg" href="#N">N</a>, <a class="arg" href="#X">X</a>, <a class="arg" href="#IWT">IWT</a>, <a class="arg" href="#WT">WT</a>, <a class="arg" href="#XMEAN">XMEAN</a>, <a class="arg" href="#S2">S2</a>, <a class="arg" href="#S3">S3</a>, <a class="arg" href="#S4">S4</a>, <a class="arg" href="#XMIN">XMIN</a>, <a class="arg" href="#XMAX">XMAX</a>, <a class="arg" href="#WTSUM">WTSUM</a>, <a class="arg" href="#IFAIL">IFAIL</a>)</td>
</tr>
</tbody>
</table></div>
<div class="left-tablediv"><table class="fspec3"><tbody>
<tr>
<td class="tdfspec1" valign="top" align="left">INTEGER&#160;</td>
<td class="tdfspec2" valign="top" align="left">N, IWT, IFAIL</td>
</tr>
<tr>
<td class="tdfspec1" valign="top" align="left">REAL&#160;(KIND=nag_wp)&#160;</td>
<td class="tdfspec2" valign="top" align="left">X(N), WT(N), XMEAN, S2, S3, S4, XMIN, XMAX, WTSUM</td>
</tr>
</tbody>
</table></div>
</td></tr></table><h2 class="standard"><a class="sec" name="description" id="description"/>3&#160;&#160;Description</h2>
<div class="paramtext">The data consist of a single sample of <m:math><m:mi>n</m:mi></m:math>&#160;observations,  denoted by <m:math><m:msub><m:mi>x</m:mi><m:mi>i</m:mi></m:msub></m:math>, with corresponding weights,  <m:math><m:msub><m:mi>w</m:mi><m:mi>i</m:mi></m:msub></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><div class="paramtext">If no specific weighting is required, then each <m:math><m:msub><m:mi>w</m:mi><m:mi>i</m:mi></m:msub></m:math>&#160;is set to <m:math><m:mn>1</m:mn></m:math>.</div><div class="paramtext">The quantities computed are:
<table class="standard-100"><tr>
<td style="width:2.1em;" valign="baseline"><a name="itema" id="itema"/>(a)</td>
<td valign="top">The sum of the weights

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:mi>W</m:mi><m:mo>=</m:mo><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:msub><m:mi>w</m:mi><m:mi>i</m:mi></m:msub><m:mtext>.</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div>
</td>
</tr><tr>
<td style="width:2.1em;" valign="baseline"><a name="itemb" id="itemb"/>(b)</td>
<td valign="top">Mean

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:mover><m:mi>x</m:mi><m:mo>-</m:mo></m:mover><m:mo>=</m:mo><m:mfrac><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:msub><m:mi>w</m:mi><m:mi>i</m:mi></m:msub><m:msub><m:mi>x</m:mi><m:mi>i</m:mi></m:msub></m:mrow><m:mi>W</m:mi></m:mfrac><m:mtext>.</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div>
</td>
</tr><tr>
<td style="width:2.1em;" valign="baseline"><a name="itemc" id="itemc"/>(c)</td>
<td valign="top">Standard deviation

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:msub><m:mi>s</m:mi><m:mn>2</m:mn></m:msub><m:mo>=</m:mo><m:msqrt><m:mfrac><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:msub><m:mi>w</m:mi><m:mi>i</m:mi></m:msub><m:msup>
<m:mfenced separators=""><m:msub><m:mi>x</m:mi><m:mi>i</m:mi></m:msub><m:mo>-</m:mo><m:mover><m:mi>x</m:mi><m:mo>-</m:mo></m:mover></m:mfenced>
<m:mn>2</m:mn></m:msup></m:mrow><m:mi>d</m:mi></m:mfrac></m:msqrt><m:mtext>, &#8195; where &#8195;</m:mtext><m:mi>d</m:mi><m:mo>=</m:mo><m:mi>W</m:mi><m:mo>-</m:mo><m:mfrac><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>w</m:mi><m:mi>i</m:mi><m:mn>2</m:mn></m:msubsup></m:mrow><m:mi>W</m:mi></m:mfrac><m:mtext>.</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div>
</td>
</tr><tr>
<td style="width:2.1em;" valign="baseline"><a name="itemd" id="itemd"/>(d)</td>
<td valign="top">Coefficient of skewness

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:msub><m:mi>s</m:mi><m:mn>3</m:mn></m:msub><m:mo>=</m:mo><m:mfrac><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:msub><m:mi>w</m:mi><m:mi>i</m:mi></m:msub><m:msup>
<m:mfenced separators=""><m:msub><m:mi>x</m:mi><m:mi>i</m:mi></m:msub><m:mo>-</m:mo><m:mover><m:mi>x</m:mi><m:mo>-</m:mo></m:mover></m:mfenced>
<m:mn>3</m:mn></m:msup></m:mrow>
  <m:mrow><m:mi>d</m:mi><m:mo>&#215;</m:mo><m:msubsup><m:mi>s</m:mi><m:mn>2</m:mn><m:mn>3</m:mn></m:msubsup></m:mrow>
 </m:mfrac><m:mtext>.</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div>
</td>
</tr><tr>
<td style="width:2.1em;" valign="baseline"><a name="iteme" id="iteme"/>(e)</td>
<td valign="top">Coefficient of kurtosis

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:msub><m:mi>s</m:mi><m:mn>4</m:mn></m:msub><m:mo>=</m:mo><m:mfrac><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:msub><m:mi>w</m:mi><m:mi>i</m:mi></m:msub><m:msup>
<m:mfenced separators=""><m:msub><m:mi>x</m:mi><m:mi>i</m:mi></m:msub><m:mo>-</m:mo><m:mover><m:mi>x</m:mi><m:mo>-</m:mo></m:mover></m:mfenced>
<m:mn>4</m:mn></m:msup></m:mrow>
  <m:mrow><m:mi>d</m:mi><m:mo>&#215;</m:mo><m:msubsup><m:mi>s</m:mi><m:mn>2</m:mn><m:mn>4</m:mn></m:msubsup></m:mrow>
 </m:mfrac><m:mo>-</m:mo><m:mn>3</m:mn><m:mtext>.</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div>
</td>
</tr><tr>
<td style="width:2.1em;" valign="baseline"><a name="itemf" id="itemf"/>(f)</td>
<td valign="top">Maximum and minimum elements of the sample.</td>
</tr><tr>
<td style="width:2.1em;" valign="baseline"><a name="itemg" id="itemg"/>(g)</td>
<td valign="top">The number of observations for which <m:math><m:msub><m:mi>w</m:mi><m:mi>i</m:mi></m:msub><m:mo>&gt;</m:mo><m:mn>0</m:mn></m:math>, i.e., the number of <b>valid</b> observations.  Suppose <m:math><m:mi>m</m:mi></m:math>&#160;observations are valid, then the quantities in <a class="item" href="#itemc">(c)</a>, <a class="item" href="#itemd">(d)</a> and <a class="item" href="#iteme">(e)</a> will be computed if  <m:math><m:mi>m</m:mi><m:mo>&#8805;</m:mo><m:mn>2</m:mn></m:math>, and will be based on <m:math><m:mi>m</m:mi><m:mo>-</m:mo><m:mn>1</m:mn></m:math>&#160;degrees of freedom.  The other quantities are evaluated provided <m:math><m:mi>m</m:mi><m:mo>&#8805;</m:mo><m:mn>1</m:mn></m:math>.</td>
</tr></table>
</div><h2 class="standard"><a class="sec" name="references" id="references"/>4&#160;&#160;References</h2>
<div class="paramtext">None.</div><h2 class="standard"><a class="sec" name="parameters" id="parameters"/>5&#160;&#160;Parameters</h2>
<dl><dt class="paramhead"><a name="N" id="N"/>1: &#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"/>2: &#160;&#160;&#8194; X(<a class="arg" href="#N">N</a>) &#8211; REAL&#160;(KIND=nag_wp)&#160;array<span class="pclass">Input</span></dt><dd><div class="paramtext"><i>On entry</i>: the sample observations, <m:math><m:msub><m:mi>x</m:mi><m:mi mathvariant="italic">i</m:mi></m:msub></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="IWT" id="IWT"/>3: &#160;&#160;&#8194; IWT &#8211; INTEGER<span class="pclass">Input/Output</span></dt><dd><div class="paramtext"><i>On entry</i>: indicates whether weights are to be supplied by you or not. In the latter case, the weights will be assumed equal and assigned the value <m:math><m:mn>1.0</m:mn></m:math>&#160;in the routine.

<dl>
<dt class="paramval"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IWT"><m:mi mathcolor="#EE0000" mathvariant="bold">IWT</m:mi></m:maction><m:mo>=</m:mo><m:mn>0</m:mn></m:math></dt>
<dd>Indicates no user-supplied weights.</dd>
<dt class="paramval"><m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IWT"><m:mi mathcolor="#EE0000" mathvariant="bold">IWT</m:mi></m:maction><m:mo>=</m:mo><m:mn>1</m:mn></m:math></dt>
<dd>Indicates user-supplied weights are required, and they will be supplied in the array <a class="arg" href="#WT">WT</a>.</dd></dl>
</div>
<div class="paramtext"><i>On exit</i>: <a class="arg" href="#IWT">IWT</a> is used to indicate the number of valid observations, <m:math><m:mi>m</m:mi></m:math>; see <a class="item" href="#itemg">(g)</a> in <a class="sec" href="#description">Section 3</a> above.</div></dd><dt class="paramhead"><a name="WT" id="WT"/>4: &#160;&#160;&#8194; WT(<a class="arg" href="#N">N</a>) &#8211; REAL&#160;(KIND=nag_wp)&#160;array<span class="pclass">Input/Output</span></dt><dd><div class="paramtext"><i>On entry</i>: if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IWT"><m:mi mathcolor="#EE0000" mathvariant="bold">IWT</m:mi></m:maction><m:mo>=</m:mo><m:mn>1</m:mn></m:math>, then the elements of <a class="arg" href="#WT">WT</a> must contain the weights associated with the observations, <m:math><m:msub><m:mi>w</m:mi><m:mi mathvariant="italic">i</m:mi></m:msub></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 class="paramtext">If <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IWT"><m:mi mathcolor="#EE0000" mathvariant="bold">IWT</m:mi></m:maction><m:mo>=</m:mo><m:mn>0</m:mn></m:math>, then the elements of <a class="arg" href="#WT">WT</a> need not be set.</div>
</div>
<div class="paramtext"><i>On exit</i>: if <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IWT"><m:mi mathcolor="#EE0000" mathvariant="bold">IWT</m:mi></m:maction><m:mo>=</m:mo><m:mn>1</m:mn></m:math>&#160;the elements of <a class="arg" href="#WT">WT</a> are unchanged.
<div class="paramtext">If <m:math><m:maction actiontype="link" dsi:type="simple" dsi:href="#IWT"><m:mi mathcolor="#EE0000" mathvariant="bold">IWT</m:mi></m:maction><m:mo>=</m:mo><m:mn>0</m:mn></m:math>&#160;each element of <a class="arg" href="#WT">WT</a> will be assigned the value <m:math><m:mn>1.0</m:mn></m:math>.</div>
</div></dd><dt class="paramhead"><a name="XMEAN" id="XMEAN"/>5: &#160;&#160;&#8194; XMEAN &#8211; REAL&#160;(KIND=nag_wp)<span class="pclass">Output</span></dt><dd><div class="paramtext"><i>On exit</i>: the mean, <m:math><m:mover><m:mi>x</m:mi><m:mo>-</m:mo></m:mover></m:math>.</div></dd><dt class="paramhead"><a name="S2" id="S2"/>6: &#160;&#160;&#8194; S2 &#8211; REAL&#160;(KIND=nag_wp)<span class="pclass">Output</span></dt><dd>
<div class="paramtext"><i>On exit</i>: the standard deviation, <m:math><m:msub><m:mi>s</m:mi><m:mn>2</m:mn></m:msub></m:math>.</div></dd><dt class="paramhead"><a name="S3" id="S3"/>7: &#160;&#160;&#8194; S3 &#8211; REAL&#160;(KIND=nag_wp)<span class="pclass">Output</span></dt><dd>
<div class="paramtext"><i>On exit</i>: the coefficient of skewness, <m:math><m:msub><m:mi>s</m:mi><m:mn>3</m:mn></m:msub></m:math>.</div></dd><dt class="paramhead"><a name="S4" id="S4"/>8: &#160;&#160;&#8194; S4 &#8211; REAL&#160;(KIND=nag_wp)<span class="pclass">Output</span></dt><dd>
<div class="paramtext"><i>On exit</i>: the coefficient of kurtosis, <m:math><m:msub><m:mi>s</m:mi><m:mn>4</m:mn></m:msub></m:math>.</div></dd><dt class="paramhead"><a name="XMIN" id="XMIN"/>9: &#160;&#160;&#8194; XMIN &#8211; REAL&#160;(KIND=nag_wp)<span class="pclass">Output</span></dt><dd><div class="paramtext"><i>On exit</i>: the smallest value in the sample.</div></dd><dt class="paramhead"><a name="XMAX" id="XMAX"/>10: &#8194; XMAX &#8211; REAL&#160;(KIND=nag_wp)<span class="pclass">Output</span></dt><dd><div class="paramtext"><i>On exit</i>: the largest value in the sample.</div></dd><dt class="paramhead"><a name="WTSUM" id="WTSUM"/>11: &#8194; WTSUM &#8211; REAL&#160;(KIND=nag_wp)<span class="pclass">Output</span></dt><dd><div class="paramtext"><i>On exit</i>: the sum of the weights in the array <a class="arg" href="#WT">WT</a>, that is <m:math><m:mstyle displaystyle="true"><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:mstyle><m:msub><m:mi>w</m:mi><m:mi>i</m:mi></m:msub></m:math>.
This will be <a class="arg" href="#N">N</a> if <a class="arg" href="#IWT">IWT</a> was <m:math><m:mn>0</m:mn></m:math>&#160;on entry.

</div></dd><dt class="paramhead"><a name="IFAIL" id="IFAIL"/>12: &#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#errorhandling">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 or a warning has been flagged (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="#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></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>
<div class="paramtext">The number of valid cases, <m:math><m:mi>m</m:mi></m:math>, is <m:math><m:mn>1</m:mn></m:math>.  In this case, standard deviation and coefficients of skewness and of kurtosis cannot be calculated.</div>
</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">Either the number of valid cases is <m:math><m:mn>0</m:mn></m:math>, or at least one weight is negative.</div>
</dd>
</dl><h2 class="standard"><a class="sec" name="accuracy" id="accuracy"/>7&#160;&#160;Accuracy</h2>
<div class="paramtext">The method used is believed to be stable.</div><h2 class="standard"><a class="sec" name="fcomments" id="fcomments"/>8&#160;&#160;Further Comments</h2>
<div class="paramtext">The time taken by G01AAF is approximately proportional to <m:math><m:mi>n</m:mi></m:math>.</div><h2 class="standard"><a class="sec" name="example" id="example"/>9&#160;&#160;Example</h2>
<div class="paramtext">This example summarises a number of datasets.  For each dataset the observations and, optionally, weights are read and printed.  G01AAF is then called and the calculated quantities 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/g01aafe.f90">Program Text (g01aafe.f90)</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/g01aafe.d">Program&#160;Data (g01aafe.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/g01aafe.r">Program Results (g01aafe.r)</a></p>
<hr/><div><a class="rout" href="../../pdf/G01/g01aaf.pdf">G01AAF (PDF version)</a></div><div><a class="chap" href="g01conts.xml">G01 Chapter Contents</a></div><div><a class="chapint" href="g01intro.xml">G01 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. 2011</a></div></body></html>