【问题标题】:How to calculate T test for my data matrix如何计算我的数据矩阵的 T 检验
【发布时间】:2014-09-24 01:23:19
【问题描述】:

我有一个 fMRI 数据矩阵,其大小为 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 

【问题讨论】:

  • 感谢@DannyBland 编辑我的帖子!
  • 谁能给我任何建议?

标签: matlab matlab-figure matlab-guide


【解决方案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

给出以下内容:

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

【讨论】:

  • 我应用我真实的fMRI数据,p值全为0,这是什么意思?
  • 真的是0还是被四舍五入到0了?无论如何,请查看此网站以获取有关 p 值和统计信息的更多信息:graphpad.com/guides/prism/6/statistics/…
  • 真的是零,比如0.00
  • 好的!然后请查看我上面评论中的链接;它很好地解释了如何解释 p 值。
  • 如何得到正尾和负尾?
猜你喜欢
  • 1970-01-01
  • 2015-05-17
  • 2023-02-04
  • 1970-01-01
  • 2015-04-26
  • 1970-01-01
  • 2019-08-23
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多