Distributions package invlogcdf() function returning the wrong answer?

Consider that the following answer:

invlogcdf(Chi(11), log(0.975))
# 4.681885225101231
qchisq(0.975, 11)
# 21.920049261021205

is wrong when comparing invlogcdf() to the equivalent R function, but the following is correct (used as a basic check to test that whether I am using the function correctly):

invlogcdf(Normal(), log(0.975))
# 1.9599639845400534
# 1.9599639845400536

Maybe there is an issue with how Chi-Squared inverse CDF is implemented or am I doing something wrong?

You ask Distributions for Chi distribution - and it gives the correct result. Just ask it for Chisq distribution: invlogcdf(Chisq(11), log(0.975)) = 21.92.

1 Like

Wow, I didn’t even know the Chi-distribution existed! I though that Chi was just short hand for Chi-Squared. I have been searching for the bug in my code for ages and in the end realised I wasn’t getting anything like the values I was expecting for the Chi() distribution. :laughing:

Thanks for setting me right.