[doc] misc. fix & improvements
[scilab.git] / scilab / modules / statistics / help / en_US / 3_dispersion_widths / mad.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4  * Copyright (C) 2000 - INRIA - Carlos Klimann
5  *
6  * Copyright (C) 2012 - 2016 - Scilab Enterprises
7  *
8  * This file is hereby licensed under the terms of the GNU GPL v2.0,
9  * pursuant to article 5.3.4 of the CeCILL v.2.1.
10  * This file was originally licensed under the terms of the CeCILL v2.1,
11  * and continues to be available under such terms.
12  * For more information, see the COPYING file which you should have received
13  * along with this program.
14  *
15  -->
16 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="mad">
17     <refnamediv>
18         <refname>mad</refname>
19         <refpurpose>mean absolute deviation</refpurpose>
20     </refnamediv>
21     <refsynopsisdiv>
22         <title>Syntax</title>
23         <synopsis>s2=mad(x)
24             s2=mad(x,'r') or s2=mad(x,1)
25             s2=mad(x,'c') or s2=mad(x,2)
26         </synopsis>
27     </refsynopsisdiv>
28     <refsection>
29         <title>Arguments</title>
30         <variablelist>
31             <varlistentry>
32                 <term>x</term>
33                 <listitem>
34                     <para>real or complex vector or matrix</para>
35                 </listitem>
36             </varlistentry>
37         </variablelist>
38     </refsection>
39     <refsection>
40         <title>Description</title>
41         <para>
42             This function computes   the mean absolute deviation of  a
43             real or complex vector or matrix <literal> x</literal>.
44         </para>
45         <para>
46             For  a  vector  or matrix  <literal>   x</literal>, <literal> s2=mad(x)  </literal>
47             returns in scalar <literal> s2</literal> the mean absolute  deviation
48             of all the entries of <literal> x</literal>.
49         </para>
50         <para>
51             <literal> s2=mad(x,'r')  </literal> (or, equivalently,  <literal> s2=mad(x,1)</literal>)
52             returns in each entry of the column vector <literal> s2</literal>
53             the mean absolute deviation of each column of <literal> x</literal>.
54         </para>
55         <para>
56             <literal> s2=mad(x,'c')  </literal> (or, equivalently,  <literal> s2=mad(x,2)</literal>)
57             returns in each entry of the column vector <literal> s2</literal>
58             the mean absolute deviation of each row of <literal> x</literal>.
59         </para>
60     </refsection>
61     <refsection>
62         <title>Examples</title>
63         <programlisting role="example"><![CDATA[
64 x  = [2 2 3 4 14];
65
66 // Mean absolute deviation of a set of data
67 // Expected = (|2-5|+|2-5|+|3-5|+|4-5|+|14-5|) / 5 = 3.6
68 mad(x)
69    ]]></programlisting>
70     </refsection>
71     <refsection>
72         <title>Bibliography</title>
73         <para>
74             Reference: Wonacott  T.H.&amp; Wonacott  R.J. .-  Introductory Statistics, 5th edition, John Wiley, 1990.
75         </para>
76     </refsection>
77 </refentry>