find probability of chi2 test

Dear all;
if i want to perfrom a hypothesis test for chi2 distrubtion , how can i do it in matlab :
P(X>a)= alpha

5 Comments

If you're looking for the chi-squared test, have a look at chi2gof.
Thank you
i need to check P(x>Chi2_critical Value)=alpha
alhpha can be specifed but how i can specfiy Chi2_critical Value , usually i am looking at degree of freedom of 2
so, Chi2_critical Value = 5.99 at alpha= 0.05
Asvin Kumar
Asvin Kumar on 21 Mar 2021
Edited: Asvin Kumar on 21 Mar 2021
I'm not sure I can help much with this topic. Just curious... If Chi2_critical and alpha are constants, what is x? What distribution does it follow? Do you have a sample set of values of x?
If there's a wiki page explaining this statistic, could you please link it? I'd like to learn something new.
thank you Asvin
basically i need to test the following hypothesis
P(X> Chi2_Cirtical value)= alpha
Chi2_Cirtical value calcuated from central Chi2 distribution table , alpha is the signifacnce level
so, i need to check if the hypothesis hold if the above equatio is satisifed .
let us assume that Chi2_Cirtical value= 5.99 at alpha= 0.05 .at degree of freedom 2
in chi2gof. , i can specify the alpha but to specify the Chi2_Cirtical value , I need to know the degree of freedom.
if i use above function , i can got degree of freedeom , so since i know alpha i, i can check if the dgree of freedom > 2 , then X> 5.99 and my ypothesis is hold.
Is my conclusion is right?
Thanks for explaining. I'm, unfortunately, not the right person for this question. I was merely suggesting a function I had come across in the docs. I'll let someone else from the community help you with this.

Sign in to comment.

 Accepted Answer

Based on what you explained it seems you already have the X2 stat.
p = 1 - chi2cdf(x, nu) % where x is chi2 stat and nu is df

More Answers (1)

To elaborate on @Ive J's answer,
You have X. using chi2cdf, you can get . So in your case, , which you can get using chi2cdf as follows
p = 1 - chi2cdf(X, a)

Community Treasure Hunt

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

Start Hunting!