Statistics/Chi-squared distribution: Difference between revisions

Content added Content deleted
m (→‎{{header|Python}}: cdf function)
m (change table)
Line 130: Line 130:
end
end


println("\nχ2 x cdf for χ2 P value (df=3)\n", "-"^36)

println("\nχ2 x P value (df=3)\n----------------------")
for p in [1, 2, 4, 8, 16, 32]
for p in [1, 2, 4, 8, 16, 32]
println(lpad(p, 2), " ", 1.0 - cdf_χ2(p, 3))
cdf = round(cdf_χ2(p, 3), digits=10)
println(lpad(p, 2), " ", cdf, " ", round(1.0 - cdf, digits=10))
end
end


Line 174: Line 174:
10 0.00085003666 0.00336897349 0.00850036660 0.01684486749 0.02833455534
10 0.00085003666 0.00336897349 0.00850036660 0.01684486749 0.02833455534


χ2 x P value (df=3)
χ2 x cdf for χ2 P value (df=3)
----------------------
------------------------------------
1 0.8012519569012008
1 0.1987480431 0.8012519569
2 0.5724067044708798
2 0.4275932955 0.5724067045
4 0.2614641299491106
4 0.7385358701 0.2614641299
8 0.04601170568923141
8 0.9539882943 0.0460117057
16 0.0011339842897852837
16 0.9988660157 0.0011339843
32 5.233466447984725e-7
32 0.9999994767 5.233e-7


For the airport data, diff total is 4.512820512820512, χ2 is 0.08875392598443503, p value 0.7888504263193064
For the airport data, diff total is 4.512820512820512, χ2 is 0.08875392598443503, p value 0.7888504263193064