Main Content

このページの翻訳は最新ではありません。ここをクリックして、英語の最新版を参照してください。

predint

cfit または sfit オブジェクトの予測区間

説明

ci = predint(fitresult,x) は、ベクトル x によって指定された新しい予測子値について、cfit オブジェクト fitresult に関連付けられた応答値の 95% 予測限界の上限と下限を返します。fitresultci に必要な情報を含める関数 fit からの出力でなければなりません。ci は、n = length(x)n 行 2 列の配列です。ci の左列には各係数の下限が含まれ、右列には上限が含まれます。

ci = predint(fitresult,x,level)level で指定された信頼度を使用して予測限界を返します。level01 の間でなければなりません。level の既定値は 0.95 です。

ci = predint(fitresult,x,level,intopt,simopt) は、計算する範囲のタイプを指定します。

新しい観測値のランダムな変動に加え、近似曲線の予測における不確定性が測定されるため、観測値の範囲は関数の範囲より広くなります。非同時限界は x の個々の要素に対応し、同時限界は x のすべての要素に対応します。

[ci,y] = predint(...) は、x の予測子について fitresult によって予測された応答値 y を返します。

メモ

predint は、[内挿][Lowess] および [スプライン] などのノンパラメトリックな回帰法の予測区間は計算できません。

すべて折りたたむ

ノイズ データの近似について観測値と関数の予測区間を計算しプロットします。

指数関数的トレンドのノイズを含むデータを生成します。

x = (0:0.2:5)';
y = 2*exp(-0.2*x) + 0.5*randn(size(x));

単項指数関数を使用して曲線をデータに当てはめます。

fitresult = fit(x,y,'exp1');

同時と非同時の両方について観測値と関数の 95% 予測区間を計算します。非同時限界は x の個々の要素に対応し、同時限界は x のすべての要素に対応します。

p11 = predint(fitresult,x,0.95,'observation','off');
p12 = predint(fitresult,x,0.95,'observation','on');
p21 = predint(fitresult,x,0.95,'functional','off');
p22 = predint(fitresult,x,0.95,'functional','on');

データ、近似および予測区間をプロットします。新しい観測値のランダムな変動に加え、近似曲線の予測における不確定性が測定されるため、観測値の範囲は関数の範囲より広くなります。

subplot(2,2,1)
plot(fitresult,x,y), hold on, plot(x,p11,'m--'), xlim([0 5]), ylim([-1 5])
title('Nonsimultaneous Observation Bounds','FontSize',9)
legend off
   
subplot(2,2,2)
plot(fitresult,x,y), hold on, plot(x,p12,'m--'), xlim([0 5]), ylim([-1 5])
title('Simultaneous Observation Bounds','FontSize',9)
legend off

subplot(2,2,3)
plot(fitresult,x,y), hold on, plot(x,p21,'m--'), xlim([0 5]), ylim([-1 5])
title('Nonsimultaneous Functional Bounds','FontSize',9)
legend off

subplot(2,2,4)
plot(fitresult,x,y), hold on, plot(x,p22,'m--'), xlim([0 5]), ylim([-1 5])
title('Simultaneous Functional Bounds','FontSize',9)
legend({'Data','Fitted curve', 'Prediction intervals'},...
       'FontSize',8,'Location','northeast')

Figure contains 4 axes objects. Axes object 1 with title Nonsimultaneous Observation Bounds, xlabel x, ylabel y contains 4 objects of type line. One or more of the lines displays its values using only markers These objects represent data, fitted curve. Axes object 2 with title Simultaneous Observation Bounds, xlabel x, ylabel y contains 4 objects of type line. One or more of the lines displays its values using only markers These objects represent data, fitted curve. Axes object 3 with title Nonsimultaneous Functional Bounds, xlabel x, ylabel y contains 4 objects of type line. One or more of the lines displays its values using only markers These objects represent data, fitted curve. Axes object 4 with title Simultaneous Functional Bounds, xlabel x, ylabel y contains 4 objects of type line. One or more of the lines displays its values using only markers These objects represent Data, Fitted curve, Prediction intervals.

入力引数

すべて折りたたむ

予測区間を求める対象の関数。cfit または sfit オブジェクトとして指定します。

fitresultci に必要な情報を含める関数 fit からの出力でなければなりません。

fitresult の予測範囲の上限と下限の計算に使用する予測子値。ベクトルとして指定します。

予測範囲の信頼度。01 の間の正のスカラーとして指定します。

範囲のタイプ。次のいずれかとして指定します。

  • 'observation' — 新しい観測値の範囲 (既定の設定)

  • 'functional' — 近似曲線の範囲

範囲のタイプ。次のいずれかとして指定します。

  • 'off' — 非同時限界 (既定の設定)

  • 'on' — 同時限界

出力引数

すべて折りたたむ

予測範囲の上限と下限。サイズ n 行 2 列の配列として返されます。ここで、n = length(x) です。

x の予測子について fitresult によって予測された応答値。ベクトルとして返されます。

バージョン履歴

R2013a で導入