Tiny improvements of narsimul + reglin help pages
[scilab.git] / scilab / modules / cacsd / help / en_US / reglin.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) INRIA - 
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-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="reglin">
14     <refnamediv>
15         <refname>reglin</refname>
16         <refpurpose>Linear regression</refpurpose>
17     </refnamediv>
18     <refsynopsisdiv>
19         <title>Calling Sequence</title>
20         <synopsis>[a,b,sig]=reglin(x,y)</synopsis>
21     </refsynopsisdiv>
22     <refsection>
23         <title>Description</title>
24         <para>
25             solve the regression problem y=a*x+ b in the least square sense. 
26             <literal>sig</literal> is the standard deviation of the residual. <literal>x</literal> and <literal>y</literal>
27             are two matrices of size <literal>x(p,n)</literal> and <literal>y(q,n)</literal>, where  <literal>n</literal>
28             is the number of samples.
29         </para>
30         <para>
31             The estimator <literal>a</literal> is a matrix of size <literal>(q,p)</literal> and <literal>b</literal> is a
32             vector of size <literal>(q,1)</literal>
33         </para>
34     </refsection>
35     <refsection>
36         <title>Examples</title>
37         <programlisting role="example"><![CDATA[
38 // simulation of data for a(3,5) and b(3,1)
39 x=rand(5,100);
40 aa=testmatrix('magi',5);aa=aa(1:3,:);
41 bb=[9;10;11]
42 y=aa*x +bb*ones(1,100)+ 0.1*rand(3,100);
43
44 // identification
45 [a,b,sig]=reglin(x,y);
46 max(abs(aa-a))
47 max(abs(bb-b))
48
49 // an other example : fitting a polynomial
50 f=1:100; x=[f.*f; f];
51 y= [ 2,3]*x+ 10*ones(f) + 0.1*rand(f);
52 [a,b]=reglin(x,y)
53  ]]></programlisting>
54     </refsection>
55     <refsection role="see also">
56         <title>See Also</title>
57         <simplelist type="inline">
58             <member>
59                 <link linkend="pinv">pinv</link>
60             </member>
61             <member>
62                 <link linkend="leastsq">leastsq</link>
63             </member>
64             <member>
65                 <link linkend="qr">qr</link>
66             </member>
67         </simplelist>
68     </refsection>
69 </refentry>