我有一个fMRI数据矩阵,其大小为9 * 10(我随机将值放入其中)。前两行属于1类刺激;接下来的两行属于2类刺激,接下来的两行属于3类刺激,最后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
答案 0 :(得分:1)
看起来你想要执行2个样本(配对)t检验,在这种情况下你想要使用ttest2功能。计算起来非常简单:如果没有关于数据的大量信息,我会将它们重新排列成单行向量进行比较。
我使用的代码很简单:
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
给出以下内容:
这是你的意思吗?如果没有,请提供有关您的数据的更多详细信息。