manova
多変量分散分析
説明
例
多変量分散分析の実行
標本データを読み込みます。
load fisheriris
列ベクトル species
は、3 種類のアヤメ (setosa、versicolor、virginica) で構成されています。double 行列 meas
は、花に関する 4 種類の測定値、がく片の長さと幅 (cm) と花弁の長さと幅 (cm) で構成されています。
データを table 配列に保存します。
t = table(species,meas(:,1),meas(:,2),meas(:,3),meas(:,4),... 'VariableNames',{'species','meas1','meas2','meas3','meas4'}); Meas = table([1 2 3 4]','VariableNames',{'Measurements'});
反復予測モデルを当てはめます。ここで、測定が応答、種類が予測子変数となります。
rm = fitrm(t,'meas1-meas4~species','WithinDesign',Meas);
多変量分散分析を実行します。
manova(rm)
ans=8×9 table
Within Between Statistic Value F RSquare df1 df2 pValue
________ ___________ _________ _________ ______ _______ ___ ___ ___________
Constant (Intercept) Pillai 0.99013 4847.5 0.99013 3 145 3.7881e-145
Constant (Intercept) Wilks 0.0098724 4847.5 0.99013 3 145 3.7881e-145
Constant (Intercept) Hotelling 100.29 4847.5 0.99013 3 145 3.7881e-145
Constant (Intercept) Roy 100.29 4847.5 0.99013 3 145 3.7881e-145
Constant species Pillai 0.96909 45.749 0.48455 6 292 2.4729e-39
Constant species Wilks 0.041153 189.92 0.79714 6 290 2.3958e-97
Constant species Hotelling 23.051 555.17 0.92016 6 288 4.6662e-155
Constant species Roy 23.04 1121.3 0.9584 3 146 1.4771e-100
種類ごとに多変量分散分析を個別に実行します。
manova(rm,'By','species')
ans=12×9 table
Within Between Statistic Value F RSquare df1 df2 pValue
________ __________________ _________ ________ ______ _______ ___ ___ ___________
Constant species=setosa Pillai 0.9823 2682.7 0.9823 3 145 9.0223e-127
Constant species=setosa Wilks 0.017698 2682.7 0.9823 3 145 9.0223e-127
Constant species=setosa Hotelling 55.504 2682.7 0.9823 3 145 9.0223e-127
Constant species=setosa Roy 55.504 2682.7 0.9823 3 145 9.0223e-127
Constant species=versicolor Pillai 0.97 1562.8 0.97 3 145 3.7058e-110
Constant species=versicolor Wilks 0.029999 1562.8 0.97 3 145 3.7058e-110
Constant species=versicolor Hotelling 32.334 1562.8 0.97 3 145 3.7058e-110
Constant species=versicolor Roy 32.334 1562.8 0.97 3 145 3.7058e-110
Constant species=virginica Pillai 0.97261 1716.1 0.97261 3 145 5.1113e-113
Constant species=virginica Wilks 0.027394 1716.1 0.97261 3 145 5.1113e-113
Constant species=virginica Hotelling 35.505 1716.1 0.97261 3 145 5.1113e-113
Constant species=virginica Roy 35.505 1716.1 0.97261 3 145 5.1113e-113
仮説検定の配列の出力
標本データを読み込みます。
load fisheriris
列ベクトル species
は、3 種類のアヤメ (setosa、versicolor、virginica) で構成されています。double 行列 meas
は、花に関する 4 種類の測定値、がく片の長さと幅 (cm) と花弁の長さと幅 (cm) で構成されています。
データを table 配列に保存します。
t = table(species,meas(:,1),meas(:,2),meas(:,3),meas(:,4),... 'VariableNames',{'species','meas1','meas2','meas3','meas4'}); Meas = dataset([1 2 3 4]','VarNames',{'Measurements'});
反復予測モデルを当てはめます。ここで、測定が応答、種類が予測子変数となります。
rm = fitrm(t,'meas1-meas4~species','WithinDesign',Meas);
多変量分散分析を実行します。また、仮説検定を構築するための配列を返します。
[manovatbl,A,C,D] = manova(rm)
manovatbl=8×9 table
Within Between Statistic Value F RSquare df1 df2 pValue
________ ___________ _________ _________ ______ _______ ___ ___ ___________
Constant (Intercept) Pillai 0.99013 4847.5 0.99013 3 145 3.7881e-145
Constant (Intercept) Wilks 0.0098724 4847.5 0.99013 3 145 3.7881e-145
Constant (Intercept) Hotelling 100.29 4847.5 0.99013 3 145 3.7881e-145
Constant (Intercept) Roy 100.29 4847.5 0.99013 3 145 3.7881e-145
Constant species Pillai 0.96909 45.749 0.48455 6 292 2.4729e-39
Constant species Wilks 0.041153 189.92 0.79714 6 290 2.3958e-97
Constant species Hotelling 23.051 555.17 0.92016 6 288 4.6662e-155
Constant species Roy 23.04 1121.3 0.9584 3 146 1.4771e-100
A=2×1 cell array
{[ 1 0 0]}
{2x3 double}
C = 4×3
1 0 0
-1 1 0
0 -1 1
0 0 -1
D = 0
行列 A にインデックスを作成します。
A{1}
ans = 1×3
1 0 0
A{2}
ans = 2×3
0 1 0
0 0 1
入力引数
rm
— 反復測定モデル
RepeatedMeasuresModel
オブジェクト
反復測定モデル。RepeatedMeasuresModel
オブジェクトとして返します。
このオブジェクトのプロパティとメソッドについては、RepeatedMeasuresModel
を参照してください。
名前と値の引数
オプションの引数のペアを Name1=Value1,...,NameN=ValueN
として指定します。ここで Name
は引数名、Value
は対応する値です。名前と値の引数は他の引数の後ろにする必要がありますが、ペアの順序は関係ありません。
R2021a より前では、名前と値をそれぞれコンマを使って区切り、Name
を引用符で囲みます。
例: manovatbl = manova(rm,'WithinModel','separatemeans')
WithinModel
— 被験者内仮説検定を指定するモデル
'separatemeans'
(既定値) | 公式によるモデル仕様 | r 行 nc 列の行列
被験者内仮説検定を指定するモデル。次のいずれかとして指定します。
'separatemeans'
— グループごとの平均を計算し、各平均が等しいかテストします。モデル仕様 — 被験者内要因のモデル仕様です。モデルの各項を検定します。この場合、
tbl
には公式の項ごとの manova が個別に格納されます。ここで、多変量応答は当該の項の係数のベクトルと等しくなります。r 行 nc 列の行列 C。r 件の反復測定間における nc 件の対比を指定します。Y が反復測定モデル
rm
内で使用される反復測定の行列を表す場合、出力tbl
には Y*C の各列の個別の manova が格納されます。
例: 'WithinModel','separatemeans'
データ型: single
| double
| char
| string
By
— 1 件の被験者間要因
文字ベクトル | string スカラー
1 件の被験者間要因。'By'
と文字ベクトルまたは string スカラーから構成されるコンマ区切りのペアとして指定します。manova
は、この要因の値ごとに被験者内モデルの検定を個別に実行します。
たとえば、被験者間要因 Drug がある場合、この要因を指定して次のように manova を実行することができます。
例: 'By','Drug'
データ型: char
| string
出力引数
manovatbl
— 多変量分散分析の結果
テーブル
反復測定モデル rm
の多変量分散分析の結果。table
として返します。
manova
は次の方法により、全体の共分散に対するモデル項の寄与を測定します。
ウィルクスのラムダ
ピライのトレース
ホテリング・ローリーのトレース
ロイの最大根統計量
詳細は、反復測定の多変量分散分析を参照してください。
manova
はこれらの検定の結果をグループ別に返します。manovatbl
には次の列があります。
列名 | 定義 |
---|---|
Within | 被験者内の項 |
Between | 被験者間の項 |
Statistic | 計算される統計値の名前 |
Value | 対応する統計量の値 |
F | F 統計量の値 |
RSquare | 説明された分散の測定 |
df1 | 分子の自由度 |
df2 | 分母の自由度 |
pValue | F 統計量の値に対応する p 値 |
データ型: table
A
— 被験者間モデルに基づく仕様
行列 | cell 配列
被験者間モデルに基づく仕様。行列または cell 配列として返します。これにより、B
の所定の列内にある要素に対する仮説 (時間内仮説) が可能になります。manovatbl
に複数の仮説検定がある場合、A
は cell 配列となることがあります。
データ型: single
| double
| cell
C
— 被験者内モデルに基づく仕様
行列 | cell 配列
被験者内モデルに基づく仕様。行列または cell 配列として返します。これにより、B
の所定の行内にある要素に対する仮説 (時間間仮説) が可能になります。manovatbl
に複数の仮説検定がある場合、C
は cell 配列となることがあります。
データ型: single
| double
| cell
D
— 仮説値
0
仮説値。0 として返します。
ヒント
各観察 (被験者) の多変量応答は反復測定のベクトルです。
より一般的な仮説
A*B*C = D
を検定するには、coeftest
を使用します。
バージョン履歴
R2014a で導入
MATLAB コマンド
次の MATLAB コマンドに対応するリンクがクリックされました。
コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは MATLAB コマンドをサポートしていません。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)