Tk Library Source Code

View Ticket
Login
Ticket UUID: 1861370
Title: Submission: Chi-squared distribution
Type: RFE Version: None
Submitter: erickb Created on: 2007-12-31 13:58:21
Subsystem: math Assigned To: arjenmarkus
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2008-01-18 16:39:47
Resolution: Closed By: arjenmarkus
    Closed on: 2008-01-18 09:39:47
Description:
Hi,

I'm submitting an implementation of the (central) chi-squared distribution.

This time around, I did a more systematic job of testing the code, by using a test-driven development approach. To do that, I used my little "simple test" library.

I'm attaching the code that implements the chi-squared library first. Then I'll post the simple test code.

Dependencies:
 - Gamma distribution
 - Simple test

Eric
User Comments: erickb added on 2008-01-01 05:13:43:

File Added - 260323: invchisqr.tcl

Logged In: YES 
user_id=816411
Originator: YES

OK, last fix to inverse chi-squared -- now catches when p = 1.0 (so return value should be infinity).
File Added: invchisqr.tcl

erickb added on 2008-01-01 05:12:30:

File Deleted - 260322:

nobody added on 2008-01-01 05:11:34:

File Added - 260322: invchisqr.tcl

erickb added on 2008-01-01 02:45:24:

File Added - 260314: invchisqr.tcl

Logged In: YES 
user_id=816411
Originator: YES

This is an improved inverse chi-square. More robust than the original. Also tested to tolerance of 1.0e-9 against R output.
File Added: invchisqr.tcl

erickb added on 2008-01-01 02:44:12:

File Deleted - 260287:

erickb added on 2007-12-31 22:06:52:

File Added - 260287: invchisqr.tcl

Logged In: YES 
user_id=816411
Originator: YES

Hello,

I'm adding to this an implementation of the inverse cumulative chi-squared distribution, since that's needed for statistical inference. It's a straightforward implementation of root solving. It turned out to be a little "touchy", but I think I've covered enough extreme cases that I can be pretty sure it will behave robustly.

This has "source chisqr.tcl" at the top of the file and runs the tests at the bottom of the file, but it could really be put directly into the "chisqr.tcl" file.

Eric

File Added: invchisqr.tcl

erickb added on 2007-12-31 20:58:57:

File Added - 260283: simpletest.tcl

Logged In: YES 
user_id=816411
Originator: YES

File Added: simpletest.tcl

erickb added on 2007-12-31 20:58:22:

File Added - 260282: chisq.tcl

Attachments: