One Sided T test function gives -Inf as part of the confidence interval?
21 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
the cyclist
2013-10-14
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Hypothesis Tests 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!