1 <?xml version="1.0" encoding="UTF-8"?>
3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4 * Copyright (C) 2000 - INRIA - Carlos Klimann
6 * Copyright (C) 2012 - 2016 - Scilab Enterprises
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.
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">
18 <refname>mad</refname>
19 <refpurpose>mean absolute deviation</refpurpose>
24 s2=mad(x,'r') or s2=mad(x,1)
25 s2=mad(x,'c') or s2=mad(x,2)
29 <title>Arguments</title>
34 <para>real or complex vector or matrix</para>
40 <title>Description</title>
42 This function computes the mean absolute deviation of a
43 real or complex vector or matrix <literal> x</literal>.
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>.
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>.
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>.
62 <title>Examples</title>
63 <programlisting role="example"><![CDATA[
66 // Mean absolute deviation of a set of data
67 // Expected = (|2-5|+|2-5|+|3-5|+|4-5|+|14-5|) / 5 = 3.6
72 <title>Bibliography</title>
74 Reference: Wonacott T.H.& Wonacott R.J. .- Introductory Statistics, 5th edition, John Wiley, 1990.