Main Content

normplot

説明

normplot(x) は、x 内のデータの分布を正規分布と比較する正規確率プロットを作成します。

normplot は、プラス記号 ('+') マーカーを使用して x 内の各データ点をプロットし、理論的な分布を表す 2 本の基準線を描画します。実線の基準線はデータの 1 番目と 3 番目の四分位数を接続し、破線の基準線はデータの端まで実線を伸ばします。標本データが正規分布に従っている場合、データ点は基準線に沿って現れます。正規分布ではない場合、データ プロットが曲がります。

normplot(ax,x) は、ax によって指定された座標軸に正規確率プロットを追加します。

h = normplot(___) は、前のいずれかの構文を使用して、プロットされた線に対応するグラフィックス ハンドルを返します。

すべて折りたたむ

mu = 10sigma = 1 をもつ正規分布から無作為標本データを生成します。

rng default;  % For reproducibility
x = normrnd(10,1,25,1);

標本データの正規確率プロットを作成します。

figure;
normplot(x)

Figure contains an axes object. The axes object with title Normal Probability Plot, xlabel Data, ylabel Probability contains 3 objects of type line. One or more of the lines displays its values using only markers

このプロットは、データが正規分布に従っていることを示しています。

4 つの異なる各分布から 50 個の乱数を生成します。4 つの分布は、標準正規分布、5 つの自由度があるスチューデントの t 分布 (裾が広い分布)、mu が 0、sigma が 1、歪度が 0.5、尖度が 3 のピアソン乱数群 (右の裾が長い分布)、および mu が 0、sigma が 1、歪度が -0.5、尖度が 3 のピアソン乱数群 (左の裾が長い分布) です。

rng(11)  % For reproducibility
x1 = normrnd(0,1,[50,1]);
x2 = trnd(5,[50,1]);
x3 = pearsrnd(0,1,0.5,3,[50,1]);
x4 = pearsrnd(0,1,-0.5,3,[50,1]);

各分布の pdf を視覚的に比較するため、同じ図に 4 つのヒストグラムをプロットします。

figure
subplot(2,2,1)
histogram(x1,10)
title('Normal')
axis([-4,4,0,15])

subplot(2,2,2)
histogram(x2,10)
title('Fat Tails')
axis([-4,4,0,15])

subplot(2,2,3)
histogram(x3,10)
title('Right-Skewed')
axis([-4,4,0,15])

subplot(2,2,4)
histogram(x4,10)
title('Left-Skewed')
axis([-4,4,0,15])

Figure contains 4 axes objects. Axes object 1 with title Normal contains an object of type histogram. Axes object 2 with title Fat Tails contains an object of type histogram. Axes object 3 with title Right-Skewed contains an object of type histogram. Axes object 4 with title Left-Skewed contains an object of type histogram.

ヒストグラムには、各標本がどのように正規分布と異なるかが示されています。

各標本の正規確率プロットを作成します。

figure
subplot(2,2,1)
normplot(x1)
title('Normal')

subplot(2,2,2)
normplot(x2)
title('Fat Tails')

subplot(2,2,3)
normplot(x3)
title('Right-Skewed')

subplot(2,2,4)
normplot(x4)
title('Left-Skewed')

Figure contains 4 axes objects. Axes object 1 with title Normal, xlabel Data, ylabel Probability contains 3 objects of type line. One or more of the lines displays its values using only markers Axes object 2 with title Fat Tails, xlabel Data, ylabel Probability contains 3 objects of type line. One or more of the lines displays its values using only markers Axes object 3 with title Right-Skewed, xlabel Data, ylabel Probability contains 3 objects of type line. One or more of the lines displays its values using only markers Axes object 4 with title Left-Skewed, xlabel Data, ylabel Probability contains 3 objects of type line. One or more of the lines displays its values using only markers

2 つの異なる各分布から 50 個の乱数を含む 50 行 2 列の行列を作成します。1 列目には標準正規分布による乱数、2 列目には mu が 0、sigma が 1、歪度が 0.5、尖度が 3 のピアソン乱数群 (右の裾が長い分布) を格納します。

rng default  % For reproducibility
x = [normrnd(0,1,[50,1]) pearsrnd(0,1,0.5,3,[50,1])];

同じ図に両方の標本の正規確率プロットを作成します。プロットの line グラフィックス ハンドルを返します。

figure
h = normplot(x)
h = 
  6x1 Line array:

  Line
  Line
  Line
  Line
  Line
  Line

legend({'Normal','Right-Skewed'},'Location','southeast')

Figure contains an axes object. The axes object with title Normal Probability Plot, xlabel Data, ylabel Probability contains 6 objects of type line. One or more of the lines displays its values using only markers These objects represent Normal, Right-Skewed.

ハンドル h(1) および h(2) は、それぞれ正規分布および非対称な分布のデータ点に対応します。ハンドル h(3) および h(4) は、標本データに近似させた 2 番目および 3 番目の四分位線に対応します。ハンドル h(5) および h(6) は、標本データの各セットの最小値および最大値まで伸びる外挿線に対応します。

説明のため、h(3) によって表される正規分布データ標本の 2 番目および 3 番目の四分位線の幅を 2 に増やします。

h(3).LineWidth = 2;
h(4).LineWidth = 2;

Figure contains an axes object. The axes object with title Normal Probability Plot, xlabel Data, ylabel Probability contains 6 objects of type line. One or more of the lines displays its values using only markers These objects represent Normal, Right-Skewed.

入力引数

すべて折りたたむ

標本データ。数値ベクトルまたは数値行列を指定します。normplot は記号 '+' を使用して x 内の各値を表示します。x が行列の場合、normplotx の各列について別々のラインを表示します。

データ型: single | double

ターゲットの座標軸。Axes オブジェクトまたは UIAxes オブジェクトを指定します。normplot は、ax で指定された座標軸にプロットを追加します。詳細については、Axes のプロパティUIAxes のプロパティを参照してください。

現在の Figure の現在の座標軸を取得するには、gca を使用します。

出力引数

すべて折りたたむ

line オブジェクトのグラフィックス ハンドル。Line グラフィックス ハンドルのベクトルとして返されます。グラフィックス ハンドルは、プロットの特定の線のプロパティをクエリおよび変更するために使用できる一意な識別子です。normplotx の各列について 3 つのハンドルを返します。

  • データ点を表す線。normplot は、プラス記号 ('+') マーカーを使用して x 内の各データ点を表します。

  • x の各列の 1 番目および 3 番目の四分位数を結合するライン。実線として表されます。

  • x の最小値および最大値まで伸びる四分位線の外挿。破線として表されます。

line オブジェクトのプロパティを表示および設定するには、ドット表記を使用します。ドット表記の使用法の詳細については、プロパティ値へのアクセスを参照してください。設定できる Line オブジェクトのプロパティの詳細については、Line のプロパティ を参照してください。

アルゴリズム

normplot は、標本データの分位数を正規分布の分位数に一致させます。標本データは並べ替えられ、x 軸に対してプロットされます。y 軸は、正規分布の分位数を、確率値に変換して表します。したがって、y 軸のスケーリングは線形ではありません。

サイズが N の標本を並べ替えた i 番目の値が x 軸の値である場合、y 軸の値はデータの経験的累積分布関数に対する評価点間の中点です。中点は (i0.5)N に等しくなります。

normplot は、プロットの線形性を評価するため、基準線を重ね合わせます。この線は、データの 1 番目と 3 番目の四分位数を通過します。

代替機能

関数 probplot を使用して確率プロットを作成できます。関数 probplot では、打ち切られたデータと、確率プロットの分布を指定できます。

バージョン履歴

R2006a より前に導入