Ttest problem with alpha

8 次查看(过去 30 天)
curoi
curoi 2013-4-9
So I'm trying to run a one-sample test so that I can determine the confidence intervals at one standard deviation away. However I keep getting the error 'ALPHA must be a scalar between 0 and 1' for the following code.
[ ho1, pv1, ci1, stat1 ] = ttest( New_cor.h, mean( New_cor.h ),'Alpha', 0.32 );
I've tried replacing the 0.32 with other values between 0 and 1 including 0.05 and 0.01 but I still get the same error. If I don't include 'Alpha' and run the ttest as the default 0.05, it works. Any ideas?

采纳的回答

bym
bym 2013-4-9
you do not need to pass 'Alpha' to the function, you are getting the error because you are trying to pass a string when it is expecting a number. Just do this:
[ ho1, pv1, ci1, stat1 ] = ttest( New_cor.h, mean( New_cor.h ), 0.32 );
  1 个评论
Triana Anderson
Triana Anderson 2022-10-13
I am having a smilar problem as the one above. I tried this solution and get an error that says:
'.05' is not a valid value for the 'tail' argument. Valid values are: 'left', 'both', 'right'.
I am trying to run this test:
[h,p,ci,stats] = ttest(x, 12.6, .4, 'tail', 'right', 'alpha', 0.01)
and I get the response:
'tail' is not a valid value for the 'tail' argument. Valid values are: 'left', 'both','right'.
If I try running it:
[h,p,ci,stats] = ttest(x, 12.6, .4, 'right', 'alpha', 0.01)
I get: Dimension argument must be a positive integer scalar or a vector of positive integers.
If I run it:
[h,p,ci,stats] = ttest(x, 12.6, .4, 'right')
I get results... but I want to be able to set the significnace level.
If I run it:
[h,p,ci,stats] = ttest(x, 12.6, .4, 'right', 'alpha', .01)
I get: Error using size
Dimension argument must be a positive integer scalar or a vector of positive integers.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Automated Driving Toolbox 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by