MATLAB Answers

Riados
0

Statistical difference between population and sample

Asked by Riados
on 28 Oct 2016
Latest activity Edited by Riados
on 29 Oct 2016
Hey folks, I'm not sure what MATLAB function to use for this problem:
I've got one test-measurement that I chopped in two sets of data (unequal in size), one before triggering something and one after.
Now I want to know if there is a statistical difference between those two. Tried ttest (didnt work) and ttest2, but the results were confusing (subjectively there should be no difference but the ttest2 returns results like h=1 with p=3e-69). Is this the wrong function for my application or am I using it wrong?

  3 Comments

Well, would need to know how you applied ttest2 but the result h=1 indicates that the the null hypothesis was rejected; the extremely small p value indicates "it ain't even close!". Of course, the null hypothesis with default inputs is "samples from normal distributions with equal means and equal but unknown variances, against the alternative that the means are not equal" so besides the simple fact the means may not be the same the underlying normality assumption may be violated.
You can try the two-sample Kolmogorov-Smirnov test which has as its null hypothesis that x1, x2 are from the same continuous distribution...
Show the two sample cdfs on a single plot would be one visual sanity check.
First of all, thank you dpb for responding so quickly.
I used [h,p]=ttest2(blue,orange,'Vartype','unequal'), but as you can see the samplesize is too different and so produces completely different means.
Then I tried comparing blue with blue+orange, but still got h=1.
Any ideas on what I am doing wrong here?
Ok I got it now! The issue was that I picked an outlier sample. 95% of the other samples return h=0 as expected, when I use ttest2 or even better when kstest2 (as dpb suggested) is used.
Thanks for your help!

Sign in to comment.

0 Answers