Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.0.2 - 日本語

Change language to:
English - Français - Português - Русский

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

Scilabヘルプ >> Statistics > Data with Missing Values > nanreglin

nanreglin

線形回帰

呼び出し手順

[a,b]=nanreglin(x,y)

引数

x, y, a, b

数値ベクトルまたは行列.

説明

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

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

y の各線は独立した問題として処理されます. xまたはyに NaN (x(i,j) = %nan または y(i,j) = %nan) が含まれる場合,点 [x(:,j); y(i,j)] が存在しないように x(:,j)y(i,j) は無視されます.

グラフィカルな例 #1:

// 以下の例では,2つの問題は共に2本の直線を表します:
// 1本は(0,0)から(10,10)へ,もう一つは(0,20)から(10,30)へ.
// 全ての点が並んでおり,NaNが無視されるため,
// reglinとnanreglinは同じ値を見つけます.
subplot(211)
x = 0:10;
y = 20:30;
[a1, b1] = reglin(x, [x ; y]);
plot(x', (a1*x+repmat(b1,1,11))', "red")
subplot(212)
y2 = y;
y2(2:10) = %nan; // y2(1) と y2(11) は変更されません.
[a2, b2] = nanreglin(x, [x ; y2])
plot(x', (a2*x+repmat(b2,1,11))', "blue")

グラフィカルな例 #2:

// 両方の問題は,(0,0)から(2,2)への直線 (reglin(x, x))を表します.
// 最初の問題(reglin(x, y))の2番目の引数は式 y = 1 で表される線,
// 2番目の問題(reglin(x, y2))の第2引数はyの中央の点 (%nan を指定)を無視します.
// 残りの2点が(0,0)と(2,0)のため,線は式 y = 0 を表します.
subplot(211)
x = 0:2;
y = [0 3 0];
[a1, b1] = reglin(x, [x ; y]);
plot(x', (a1*x+repmat(b1,1,3))', "red")
subplot(212)
y2 = y;
y2(2) = %nan; // y2 = [0 %nan 0];
[a2, b2] = nanreglin(x, [x ; y2]);
plot(x', (a2*x+repmat(b2,1,3))', "blue")

参照

  • reglin — 線形回帰
  • pinv — 擬似逆行列
  • leastsq — Solves non-linear least squares problems
  • qr — QR 分解

履歴

バージョン記述
5.5.0 導入
Report an issue
<< nanmin Data with Missing Values nanstdev >>

Copyright (c) 2022-2023 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu Feb 14 15:02:13 CET 2019