Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Please login or create an account
Change language to: English - Français - Português - Русский

Please note that the recommended version of Scilab is 6.0.1. This page might be outdated.
See the recommended documentation of this function

Scilab help >> CACSD > reglin

reglin

線形回帰

C呼び出し手順

[a,b,sig]=reglin(x,y)

説明

最小二乗解として回帰問題y=a*x+ bを解きます. sig は残差の標準偏差です. x および y は大きさ x(p,n) および y(q,n) の行列, ただしnはサンプル数,です.

推定器 a は大きさ (q,p) の行列, bは大きさ (q,1)のベクトルです.

// 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 polynomial 
f=1:100; x=[f.*f; f];
y= [ 2,3]*x+ 10*ones(f) + 0.1*rand(f);
[a,b]=reglin(x,y)

参照

  • pinv — 擬似逆行列
  • leastsq — Solves non-linear least squares problems
  • qr — QR 分解
Scilab Enterprises
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Mon Oct 01 17:40:28 CEST 2012