One Sided T test function gives -Inf as part of the confidence interval?
21 views (last 30 days)
Show older comments
As the question states, I have a problem where I need to use the 'ttest' function.
I have the data,
data = [37 , 54 , 29 , 46 , 33];
then I run the test:
[h , p , ci , stat] = ttest(data , 45 , 'Alpha' , 0.10 , 'Tail' , 'left');
I get:
h = 0; p = 0.158; ci = -Inf 49.4618; stats = tstat: -1.1474; df: 4; sd: 10.1341;
Everything is correct from hand calculations, except for the -Inf value as the lower limit on the confidence interval. I looked for help with this before posting, and a previous post (<http://stackoverflow.com/questions/3816702/ttest-function-error-in-matlab-error-using-nanmean-too-many-input>) about an unrelated issue with ttest suggested using "which" to verify the correct function is being used.
When I do that, I get:
C:\Program Files\MATLAB\R2013a\toolbox\stats\stats\ttest.m
I don't know if this is a flaw with the function or something else. The script is attached.
0 Comments
Accepted Answer
the cyclist
on 14 Oct 2013
The result is correct. You have asked for a one-sided test. The null hypothesis is that the mean of the data is 45. The alternate hypothesis is that the data come from a distribution with mean less than 45.
The test did not reject the null (h =0), and the 90% confidence interval is that the mean is less than 49.4618, which equivalent to saying it is in the interval [-Inf,49.4618].
0 Comments
More Answers (0)
See Also
Categories
Find more on Hypothesis Tests in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!