Ttest problem with alpha

조회 수: 15(최근 30일)
curoi
curoi 2013년 4월 9일
댓글: Triana Anderson 2022년 10월 13일
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개)

Community Treasure Hunt

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

Start Hunting!

Translated by