* Bug #7858 fixed - variance and variancef can now return mean
[scilab.git] / scilab / modules / statistics / help / en_US / descriptive_statistics / variancef.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  * This file must be used under the terms of the CeCILL.
7  * This source file is licensed as described in the file COPYING, which
8  * you should have received as part of this distribution.  The terms
9  * are also available at    
10  * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
11  *
12  -->
13 <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="variancef">
14     <refnamediv>
15         <refname>variancef</refname>
16         <refpurpose>variance and mean of the values of a vector or matrix</refpurpose>
17     </refnamediv>
18     <refsynopsisdiv>
19         <title>Calling Sequence</title>
20         <synopsis>s=variancef(x,fre)
21             [s,m]=variancef(x,fre,'r') or s=variancef(x,fre,1)
22             [s,m]=variancef(x,fre,'c') or s=variancef(x,fre,2)
23         </synopsis>
24     </refsynopsisdiv>
25     <refsection>
26         <title>Arguments</title>
27         <variablelist>
28             <varlistentry>
29                 <term>x</term>
30                 <listitem>
31                     <para>real or complex vector or matrix</para>
32                 </listitem>
33             </varlistentry>
34         </variablelist>
35     </refsection>
36     <refsection>
37         <title>Description</title>
38         <para>
39             This function computes the variance of the values of a
40             vector or matrix <literal>x</literal>, each of them counted with a
41             frequency signaled by the corresponding values of the
42             integer vector or matrix <literal>fre</literal> with the same type of
43             <literal>x</literal>.
44         </para>
45         <para>
46             For a vector or matrix <literal>x</literal>, <literal>s=variancef(x,fre)</literal> (or
47             <literal>s=variancef(x,fre,'*')</literal>) returns in scalar <literal>s</literal> the
48             variance of all the entries of <literal>x</literal>, each value
49             counted with the multiplicity indicated by the
50             corresponding value of <literal>fre</literal>.
51         </para>
52         <para>
53             <literal>s=variancef(x,fre,'r')</literal>(or, equivalently,
54             <literal>s=variancef(x,fre,1)</literal>) returns in each entry of the row
55             vector <literal>s</literal> of type 1xsize(x,'c') the variance of
56             each column of <literal>x</literal>, each value counted with the
57             multiplicity indicated by the corresponding value of
58             <literal>fre</literal>.
59         </para>
60         <para>
61             <literal>s=variancef(x,fre,'c')</literal>(or, equivalently,
62             <literal>s=variancef(x,fre,2)</literal>) returns in each entry of the
63             column vector <literal>s</literal> of type size(x,'c') x1 the variance
64             of each row of <literal>x</literal>, each value counted with the
65             multiplicity indicated by the corresponding value of
66             <literal>fre</literal>.
67         </para>
68         <para>
69             The second output argument <literal>m</literal> is the mean of the input,
70             with respect to the <literal>orien</literal> parameter.
71         </para>
72     </refsection>
73     <refsection>
74         <title>Examples</title>
75         <programlisting role="example"><![CDATA[ 
76 x = [0.2113249 0.0002211 0.6653811; 0.7560439 0.9546254 0.6283918]
77 fre = [1 2 3; 3 4 3]
78 [s, m] = variancef(x, fre)
79 [s, m] = variancef(x, fre, "r")
80 [s, m] = variancef(x, fre, "c")
81  ]]></programlisting>
82     </refsection>
83     <refsection role="see also">
84         <title>See Also</title>
85         <simplelist type="inline">
86             <member>
87                 <link linkend="variance">variance</link>
88             </member>
89             <member>
90                 <link linkend="mtlb_var">mtlb_var</link>
91             </member>
92         </simplelist>
93     </refsection>
94     <refsection>
95         <title>Bibliography</title>
96         <para>
97             Wonacott, T.H. &amp; Wonacott, R.J.; Introductory Statistics, fifth edition, J.Wiley &amp; Sons, 1990.
98         </para>
99     </refsection>
100 </refentry>