How to get p value from Chi Square table

question

#1

Hi guys,

Given cquantile(Chisq(1), .005), we can get its Chi square table value 7.8

Is there anyway to get the corresponding p value when given Chi square table value and freedom?

Thanks,

Hongwei


#2
using Distributions
ccdf(Chisq(1), 7.8)

#3

That one I can help with:

julia> 1-cdf(Chisq(1),7.8)
0.00522462344006136

#4

Thanks a lot, Tamas!


#5

Thanks a lot, Mcreel! It seems ccdf and cdf are complementary of each other.


#6

ccdf may offer more precision in some cases. Computing 1 - cdf can be numerically problematic if cdf is very close to 1:

julia> (1 - 0.9999999999999999) + 0.0000000000000001
2.1102230246251565e-16

julia> 1 - (0.9999999999999999 + 0.0000000000000001)
0.0


#7

Looking at this again, I wrote this example way too quickly and totally screwed it up by putting a plus sign instead of a minus sign in the first computation. The relevant comparison would be something like this:

julia> 1 - (0.9999999999999999 + 0.0000000000000001)
0.0

julia> (1 - 0.9999999999999999) - 0.0000000000000001
1.1022302462515656e-17