Ttest problem with alpha

6 views (last 30 days)
curoi
curoi on 9 Apr 2013
Commented: Triana Anderson on 13 Oct 2022
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?

Accepted Answer

bym
bym on 9 Apr 2013
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 Comment
Triana Anderson
Triana Anderson on 13 Oct 2022
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.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!