paired_ttest - MATLAB
Closed this issue · 9 comments
Hi
I am new to this toolbox and just confirming... I am doing a paired sample t-test for some continuous treadmill data I have (pre and post) for 10 persons. The intention is to check normality, complete the ttest followed by cohen's d.
For normality do I use:
spmi1 = spm1d.stats.normality.ttest_paired(YA, YB).inference(alpha);
spmi2 = spm1d.stats.normality.ttest_paired(YA, YB).inference(alpha);
OR
spm1d.stats.normality.sw (y, x);
Then a paired t-test using:
%paired t-test
% spm=spm1d.stats.ttest_paired(Y1,Y2);
% spmi=spm.inference(0.05,'two_tailed',true,'interp',true);
I would like to confirm that the normality uses the difference between the pair of data means as the testing variable. So for example s1 represents mean steps before intervention and s2 represents mean steps post-intervention. Normality test (s2-s1)
For paired t-test is it just the means being evaluated? pairedtest (s1,s2)
Also is there is a cohen's d in this toolbox that can be utilized?
I'd suggest using just:
spmi = spm1d.stats.normality.ttest_paired(YA, YB).inference(alpha);
In spm1d, calls to all normality tests are the same as the call to the test itself, so if the test name is ttest_paired
, then the test itself can be run as:
spmi = spm1d.stats.ttest_paired(YA, YB).inference(alpha);
and you just need to add normality
after spm1d.stats
to run the normality test.
I would like to confirm that the normality uses the difference between the pair of data means as the testing variable. So for example s1 represents mean steps before intervention and s2 represents mean steps post-intervention. Normality test (s2-s1)
All normality tests consider only the residuals. For t tests the residuals are the differences from the means. For a paired t test: first the A-B difference is calculated for the i
th subject as d_i = YA_i - YB_i
, then the residuals are calculated for each subject as r_i = d_i - mean_d
, where mean_d
is the mean difference across subjects.
Also is there is a cohen's d in this toolbox that can be utilized?
No, there is not yet any direct support for effect sizes in spm1d because effect size interpretations for 1D data are different than for simple scalar data. An effect that would be interpreted as "large" for simple scalar data may only be interpreted as "medium" or "small" for 1D data. The reason for this can be stated most concisely as "isoprobability", or slightly less concisely as: "probabilistically equivalent effect size thresholds". We are currently preparing a paper which considers this issue in detail, and future versions of spm1d will support effect size calculations.
s1
and s2
must both be (J,Q)
arrays, where J
is the number of observations, and Q
is the number of time nodes. In your case it sounds like J=10
and Q=101
.
I'm not sure what you mean by "invert in Matlab"?
I think the problem is that you've used s2
twice in the command:
spmi2 = spm1d.stats.normality.ttest_paired(s2, s2).inference(alpha)
Using s2
twice will cause all pairwise differences to be zero, and this is likely causing the error.