P-value from Chi sq test statistic in Python

后端 未结 7 1745
借酒劲吻你
借酒劲吻你 2020-12-24 01:36

I have computed a test statistic that is distributed as a chi square with 1 degree of freedom, and want to find out what P-value this corresponds to using python.

I

7条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-24 02:08

    Quick refresher here:

    Probability Density Function: think of it as a point value; how dense is the probability at a given point?

    Cumulative Distribution Function: this is the mass of probability of the function up to a given point; what percentage of the distribution lies on one side of this point?

    In your case, you took the PDF, for which you got the correct answer. If you try 1 - CDF:

    >>> 1 - stats.chi2.cdf(3.84, 1)
    0.050043521248705147
    

    PDF CDF

提交回复
热议问题