1 <?xml version="1.0" encoding="UTF-8"?>
3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4 * Copyright (C) 2013 - Scilab Enterprises - Paul Bignier: added mean squared deviation
5 * (third input argument)
6 * Copyright (C) 2000 - INRIA -
8 * Copyright (C) 2012 - 2016 - Scilab Enterprises
10 * This file is hereby licensed under the terms of the GNU GPL v2.0,
11 * pursuant to article 5.3.4 of the CeCILL v.2.1.
12 * This file was originally licensed under the terms of the CeCILL v2.1,
13 * and continues to be available under such terms.
14 * For more information, see the COPYING file which you should have received
15 * along with this program.
18 <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="stdev">
20 <refname>stdev</refname>
22 standard deviation (row orcolumn-wise) of vector/matrix entries
32 y = stdev(x, orien, m)
35 <refsection role="parameters">
36 <title>Arguments</title>
41 <para>real vector, matrix or hypermatrix</para>
47 <para>real scalar, vector or matrix</para>
54 <literal>"*"</literal> (default), <literal>"r"</literal> or 1,
55 <literal>"c"</literal> or 2, or 0<integer<=ndims(x): direction along
56 which calculations are performed.
63 <para>real scalar, vector or hypermatrix, the a priori mean</para>
68 <refsection role="description">
69 <title>Description</title>
71 stdev computes the "sample" standard deviation, that
72 is, it is normalized by N-1, where N is the sequence length.
73 If <varname>m</varname> is present, then <code>stdev</code> computes the
74 mean squared deviation (normalized by N) using the a priori mean defined by <varname>m</varname>.
77 For a vector or a matrix <literal>x</literal>, <literal>y=stdev(x)</literal> returns in the
78 scalar <literal>y</literal> the standard deviation of all the entries of <literal>x</literal>.
81 <literal>y=stdev(x,'r')</literal> (or, equivalently,
82 <literal>y=stdev(x,1)</literal>) is the rowwise standard deviation. It returns in each
83 entry of the row vector <literal>y</literal> the standard deviation of each column of <literal>x</literal>.
86 <literal>y=stdev(x,'c')</literal> (or, equivalently, <literal>y=stdev(x,2)</literal>)
87 is the columnwise stdev. It returns in each
88 entry of the column vector <literal>y</literal> the standard deviation of each row of
92 By extension, <literal>y=stdev(x,n)</literal> with <literal>n</literal> a positive integer
93 returns the deviation along the <literal>n</literal>-th dimension.
98 If <varname>m</varname> is a scalar, then it is expanded to match the size of
99 <code>mean(x)</code> along the <literal>n</literal>-th dimension.
102 <literal>stdev()</literal> can be overloaded.
107 <refsection role="examples">
108 <title>Examples</title>
109 <programlisting role="example"><![CDATA[
110 A = [1 2 10; 7 7.1 7.01];
116 // Deviation from a known (a-priori, built-in) mean:
117 A = grand(10, 10, "nor", 7.5, 3);
118 stdev(A) / 3 // unknown mean => assessed from A before computing stdev
119 stdev(A, '*', 7.5) / 3 // using the theoretical built-in mean
121 // With an hypermatrix:
122 A = grand(3, 5, 30, "nor", 4.1, 1.5);
124 sd = stdev(A, 3, 4.1) / 1.5
128 <refsection role="see also">
129 <title>See also</title>
130 <simplelist type="inline">
132 <link linkend="nanstdev">nanstdev</link>
135 <link linkend="stdevf">stdevf</link>
138 <link linkend="sum">sum</link>
141 <link linkend="median">median</link>
144 <link linkend="mean">mean</link>
148 <refsection role="history">
149 <title>History</title>
152 <revnumber>5.5.0</revnumber>
154 Can now compute the mean squared deviation using the a priori mean defined by <varname>m</varname>
158 <revnumber>6.0.0</revnumber>
160 stdev(x, orien>ndims(x)) no longer returns zeros(x) but yields an error.
164 <revnumber>6.0.1</revnumber>
166 stdev() is now overloadable.