F検定について
6 views (last 30 days)
Show older comments
Hiraku Tokuma
on 29 Sep 2021
Commented: Hiraku Tokuma
on 2 Oct 2021
forループでF検定のp値を出力させる方法を教えてください。
for a= 1:n;
x= 行列名1 (a,:);
y = 行列名2(a,:);
f(a,:) = vartest2(x,y);
end
とすると、
行列名1と2のa列目同士をF検定してその判定を返してはくれるのですが、同時にp値の行列も作成したいです。
ご知恵を拝借願えませんでしょうか。
0 Comments
Accepted Answer
Atsushi Ueno
on 29 Sep 2021
上記の最初に書いてある「等分散に関する検定」と同じ内容です。データの内容はさておき、[h,p] = vartest2(x,y)と書かないとp値を出力してくれないので、一旦スカラ変数に格納してから行列にコピーすればやりたい事が出来ます。
load examgrades;
for a= 1:size(grades,2)-1;
x = grades(:,a);
y = grades(:,a+1);
[h,p] = vartest2(x,y) % 検定結果とp値を両方出力する
f(a,:) = [h,p]; % 検定結果とp値を行列に格納する
end
f
More Answers (0)
See Also
Categories
Find more on 仮説検定 in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!