MATLAB Answers

Rita
0

How to do paired t test with mean and sd?

Asked by Rita
on 29 Aug 2016
Latest activity Commented on by Star Strider
on 30 Aug 2016
I would like to do paired t-test with mean and standard deviation and the number of sampling.
for A:mean =8.37 sd=0.53
B: mean=8.18 sd=0.16 number of samples for both A=B=44
Thanks.

  0 Comments

Sign in to comment.

2 Answers

Answer by Star Strider
on 30 Aug 2016
 Accepted Answer

To do it with only the means and standard deviations, you would have to write your own functions to calculate the one- and two-tailed t-probabilities, but fortunately with MATLAB that is not difficult:
Amean =8.37;
Asd=0.53;
Bmean=8.18;
Bsd=0.16;
N = 44;
v = 2*N-2;
tval = (Amean-Bmean) / sqrt((Asd^2+Bsd^2)/N); % Calculate T-Statistic
tdist2T = @(t,v) (1-betainc(v/(v+t^2),v/2,0.5)); % 2-tailed t-distribution
tdist1T = @(t,v) 1-(1-tdist2T(t,v))/2; % 1-tailed t-distribution
tprob = 1-[tdist2T(tval,v) tdist1T(tval,v)]
tprob =
0.0253 0.01265
So your groups are significantly different at alpha = 0.05.
The functions are correct, but you may want to check my ‘v’ and ‘tval’ calculations to be certain it they are correct to your experimental design. If they are not, change them appropriately.

  2 Comments

You are amazing! Thanks
Thank you! My pleasure!

Sign in to comment.


Answer by Thorsten
on 30 Aug 2016
Edited by Thorsten
on 30 Aug 2016

If you have the Statistics Toolbox, you can use
ttest(A-B)

  2 Comments

Thanks a lot.I have this toolbox but can ttest function work with mean and sd without samples? Thanks again
No, you need the samples.

Sign in to comment.