File: reglin.man

package info (click to toggle)
scilab 2.6-4
  • links: PTS
  • area: non-free
  • in suites: woody
  • size: 54,632 kB
  • ctags: 40,267
  • sloc: ansic: 267,851; fortran: 166,549; sh: 10,005; makefile: 4,119; tcl: 1,070; cpp: 233; csh: 143; asm: 135; perl: 130; java: 39
file content (35 lines) | stat: -rw-r--r-- 914 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
.TH reglin 1 "April 1993" "Scilab Group" "Scilab Function"
.so ../sci.an
.SH NAME
reglin - Linear regression 
.SH CALLING SEQUENCE
.nf
[a,b,sig]=reglin(x,y)
.fi
.SH DESCRIPTION
solve the regression problem y=a*x+ b in the least square sense. 
\fRsig\fV is the standard deviation of the residual. \fVx\fR and \fVy\fR
are two matrices of size \fRx(p,n)\fV and \fRy(q,n)\fV, where  \fVn\fR
is the number of samples. 
.LP
The estimator \fRa\fV is a matrix of size \fV(q,p)\fR and \fRb\fV is a
vector of size \fR(q,1)\fV

.Sh EXAMPLE 
.nf
// simulation of data for a(3,5) and b(3,1)
x=rand(5,100);
aa=testmatrix('magi',5);aa=aa(1:3,:);
bb=[9;10;11]
y=aa*x +bb*ones(1,100)+ 0.1*rand(3,100);
// identification 
[a,b,sig]=reglin(x,y);
maxi(abs(aa-a))
maxi(abs(bb-b))
// an other example : fitting a polynom 
f=1:100; x=[f.*f; f];
y= [ 2,3]*x+ 10*ones(f) + 0.1*rand(f);
[a,b]=reglin(x,y)
.fi
.SH SEE ALSO
pinv, leastsq, qr