Problem using ttest and signrank functions

9 ビュー (過去 30 日間)
Eric
Eric 2014 年 9 月 22 日
コメント済み: José-Luis 2014 年 9 月 22 日
I'm trying to use the ttest and the signrank functions but they don't work.
When using the ttest function it says:
Undefined function or variable 't'.
Error in nanmean (line 7) N = sum(~isnan(t), dim);
Error in ttest (line 131) xmean = nanmean(x,dim);
and for the signrank it says:
Error using signrank (line 95) SIGNRANK requires vector rather than matrix data.
I have the following toolboxes installed: MATLAB Version 8.2 (R2013b) Signal Processing Toolbox Version 6.20 (R2013b) Statistical Parametric Mapping Version 5236 (SPM8) Statistics Toolbox Version 8.3 (R2013b)
Thank you very much in advance.
  1 件のコメント
Eric
Eric 2014 年 9 月 22 日
Sorry about that. Here is the code for performing the Wilcoxon Signed-Rank Test on EEG data:
pval = 0.05
all = Alphapower;
dataalpha1 = all(1:3,:,:);
dataalpha2 = all(4:6,:,:);
for channel = 1:19
pre = dataalpha1(:,1,channel);
post = dataalpha2(:,2,channel);
[p, h, stats] = signrank(post, pre, 'alpha', pval);
end

サインインしてコメントする。

採用された回答

José-Luis
José-Luis 2014 年 9 月 22 日
[p, h, stats] = signrank(squeeze(post), squeeze(pre), 'alpha', pval);
  2 件のコメント
Eric
Eric 2014 年 9 月 22 日
Thank you for the answer. But does this return values from comparisons for each column (like channel 1 pre compared to channel 1 post)?
José-Luis
José-Luis 2014 年 9 月 22 日
No, your code was not working because dataalpha1 and dataalpha2 were not vectors but matrices of size [: 1 1]. Squeeze() just makes them a vector array, which is what the function is expecting. You could also do:
[p, h, stats] = signrank(post(:), pre(:), 'alpha', pval);

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeHypothesis Tests についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by