Matlab 如何计算我的数据矩阵的T检验

Matlab 如何计算我的数据矩阵的T检验,matlab,matlab-figure,matlab-guide,Matlab,Matlab Figure,Matlab Guide,我有一个功能磁共振成像数据矩阵,它的大小是9*10(我随机把数值放进去)。前两行为1类刺激;接下来的两行是第2类刺激,接下来的两行是第3类刺激,最后三行是无刺激(休息条件)。我想测试两种条件(1类刺激与静止条件),(2类刺激与静止条件)和(3类刺激与静止条件)之间的信号差异。我的问题是如何对fMRI数据进行T检验 H1: Condition1 ≠ Condition2 H0: Condition1 = Condition2 And should I compute based on these

我有一个功能磁共振成像数据矩阵,它的大小是9*10(我随机把数值放进去)。前两行为1类刺激;接下来的两行是第2类刺激,接下来的两行是第3类刺激,最后三行是无刺激(休息条件)。我想测试两种条件(1类刺激与静止条件),(2类刺激与静止条件)和(3类刺激与静止条件)之间的信号差异。我的问题是如何对fMRI数据进行T检验

H1: Condition1 ≠ Condition2
H0: Condition1 = Condition2

And should I compute based on these:1.Difference between the mean intensities of each condition
2. Degree of overlap in intensities
-7  0   -1  -5  -1  -2  -3  0   1   -8
2   -1  3   -1  -1  -1  -2  1   2   -3  ----> under class 1 stimulus

-4  -1  1   -1  8   1   0   -8  -2  -1
-2  -2  -5  -3  -1  -1  -15 0   -1  2   ----> under class 2 stimulus

3   0   5   8   -5  2   -2  8   10  -8
5   0   2   -4  8   2   6   0   -11 2   ----> under class 3 stimulus

-6  4   1   -2  6   -6  -5  0   11  -6
6   8   3   -4  -1  -5  5   -4  2   0
3   2   1   -6  -8  -4  2   0   5   3   -----> under rest (no stimulus) condition 

看起来您希望执行2样本(配对)t检验,在这种情况下,您希望使用该函数。这很容易计算:在没有太多数据信息的情况下,我将它们重新排列成单行向量进行比较

我使用的代码很简单:

clear
clc    

% Define experimental data.
Cond1 =  [-8 2   -1  3   -1  -1  -1  -2  1   2   -3];

Cond2 = [-4  -1  1   -1  8   1   0   -8  -2  -1 -2  -2  -5  -3  -1  -1  -15 0   -1  2];

Cond3 = [3   0   5   8   -5  2   -2  8   10  -8 5   0   2   -4  8   2   6   0   -11 2];

Rest = [ -6  4   1   -2  6   -6  -5  0   11  -6 6   8   3   -4  -1  -5  5   -4  2   0 3   2   1   -6  -8  -4  2   0   5   3] ;

% Group data for easy referencing in plots
AllData = {Cond1;Cond2;Cond3;Rest}; 

% Perform the t tests. The p-value is given together with h, which tells you whether the null hypothesis is rejected (value of 0) or not (value of 1).

[h1,p1]=ttest2(Rest,Cond1)

[h2,p2]=ttest2(Rest,Cond2)

[h3,p3]=ttest2(Rest,Cond3)

PValues = [p1;p2;p3];
绘制结果

figure

for k = 1:4

    if k < 4
        subplot(1,4,k)
        boxplot(AllData{k})
        set(gca,'YLim',[-10 10])

        TitleString = sprintf('Condition %i\n p-value of %0.2f',k,PValues(k));
        title(TitleString,'FontSize',14)

    else
        subplot(1,4,k)
        boxplot(AllData{4})
        set(gca,'YLim',[-10 10])
        title('Rest','FontSize',14)

    end
end
图
对于k=1:4
如果k<4
子地块(1,4,k)
箱线图(所有数据{k})
集合(gca,'YLim',[-10])
TitleString=sprintf('Condition%i\n p-value为%0.2f',k,PValues(k));
标题(标题栏,'FontSize',14)
其他的
子地块(1,4,k)
箱线图(所有数据{4})
集合(gca,'YLim',[-10])
标题('Rest','FontSize',14)
结束
结束
提供以下信息:


这就是你的意思吗?如果没有,请提供有关您的数据的更多详细信息。

感谢@DannyBland编辑我的帖子!任何人都可以给我任何建议吗?我应用我真实的fMRI数据,p值都是0。这是什么意思?它真的是0还是四舍五入到0?在任何情况下,请查看本网站,了解更多关于p值和统计数据的信息:它实际上是零,比如0.00ok!那么请看一下我上面评论中的链接;它很好地解释了如何解释p值。如何得到正尾和负尾?