Talk:Statistics/Chi-squared distribution: Difference between revisions

m
No edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 4:
According to Wikipedia, for the case k = 2, this formula reduces to F(x; 2) = 1 - exp(-x/2). But for values of x from 0 to 10, the only way I can get this simple formula to agree with the one in the task description is if I halve 'x' first before applying the latter. Here's the Wren code I have so far in case I'm missing something or have done something silly:
 
<syntaxhighlight lang="ecmascriptwren">import "./math" for Math
import "./fmt" for Fmt
 
Line 113:
 
:: I am right now also having trouble with the cdf formula at the level of the incomplete Gamma I am using. I think I may have to calculate it in 2 or 3 different ways depending on x and k. --[[User:Wherrera|Wherrera]] ([[User talk:Wherrera|talk]]) 18:33, 2 October 2022 (UTC)
 
:: Well, I gave up getting incomplete gamma to work accurately with just two methods, and am just going to call the one in the BigFloat MPFR library, which I think uses six or more methods for incomplete gamma based on the a and x values. --[[User:Wherrera|Wherrera]] ([[User talk:Wherrera|talk]]) 19:43, 2 October 2022 (UTC)
 
:: I did find that the two formulas I had to calculate the last summation used 2 different meanings for x which had things overly complicated and incorrect. Fixed. --[[User:Wherrera|Wherrera]] ([[User talk:Wherrera|talk]]) 01:22, 3 October 2022 (UTC)
 
Thanks for correcting the cumulative pdf formula. I'm pleased we didn't have to resort to the ''mpfr_gamma_inc'' function as it's not one I've wrapped in Wren-GMP. --[[User:PureFox|PureFox]] ([[User talk:PureFox|talk]]) 09:48, 3 October 2022 (UTC)
9,492

edits