How do I apply the T-Test correctly?
Show older comments
Hi everyone,
I am not sure if I apply the T-Test correctly to my data. In the description it says "H = TTEST(X) performs a t-test of the hypothesis that the data in the vector X come from a distribution with mean zero, and returns the result of the test in H." That is my code:
load stockreturns
x = stocks(:,3);
x1=x-mean(x);
x2=x+10;
[h,p,ci,stats] = ttest(x,0,'Alpha',0.01);
[h1,p1,ci1,stats1] = ttest(x1,0,'Alpha',0.01);
[h2,p2,ci2,stats2] = ttest(x2,0,'Alpha',0.01);
The way I understand it, the T-Test checks if your data is t-distributed with a mean of 0. If I know that my data has a mean of e.g. 10, the T-Test gives really bad results, because the mean is not 0. If I still want to find out if there is a t-distribution, can I substract 10 from my data and apply the T-Test without making any serious error?
If I substract the mean of my data (line 3) the P value becomes 1 in every case. Why is that?
I assume that when I substract the mean, the criterion of 0 mean is met. But that doesn't necessarily mean that I have a T-distribution, right? So if I substract the mean of my values and p becomes 1, I have a T-distribution?
I'm sorry for my confusing words. I hope you understand what I mean.
Accepted Answer
More Answers (0)
Categories
Find more on Axis Labels in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!