Post Reply 
[WP-34S] Chi-Square Distribution
01-11-2014, 11:11 PM
Post: #4
RE: [WP-34S] Chi-Square Distribution
The distribution code hasn't changed since we did all that work on it. Looking at the code, it boils down to doing the initial estimate and then running the Newton solver. The internal code will be running in double precision, although the convergence criteria is precision mode dependent.


Is it possible your 34S is in one of the slow clock states?


- Pauli


Code:
                XLBL"QF_CHI2"
                        xIN MONADIC
                        GSB chi2_param
                        GSB qf_check_probability
                        GSB qf_chi2_est
                        _INT DIST_CHI2
                        XEQ qf_newton
                        xOUT xOUT_NORMAL

#define R_P     .00
#define R_T     .01
qf_chi2_est::           LocR 2
                        STO R_P
                        _INT 15
                        x<? J
                                JMP qf_chi2_est_ll
                        _INT 1
                        JMP qf_chi2_est_ld
qf_chi2_est_ll::        _INT 85
                        SDR 2
qf_chi2_est_ld::        +/-
                        RCL[times] J
                        e[^x]
                        x[<=]? R_P
                                JMP qf_chi2_large
                        Num 1/2
                        RCL[times] J
                        ENTER[^]        // n/2 n/2 ? ?
                        LN[GAMMA]
                        RCL/ Y
                        e[^x]
                        RCL Y           // n/2 exp n/2 ?
                        RCL[times] R_P  // pn/2 exp n/2 ?
                        RCL Z
                        [^x][sqrt]y     // xroot exp n/2
                        [times]
                        RCL+ X
                        JMP qf_chi2_est_exit

qf_chi2_large::         RCL R_P
                        GSB qf_q_est
                        _INT 97
                        SDR 2
                        [times]         // .97q
                        Num Chi2        // 0.2214
                        RCL/ J          // .2214/n .97q
                        ENTER[^]        // .2214/N .2214/N .97q
                        [sqrt]
                        RCL[times] Z    // sqrt(.2214/N)*.97q .2214/N .97q
                        RCL- Y          // sqrt(.2214/N)*.97q-.2214/N .2214/N .97q
                        INC X
                        x[^3]
                        RCL[times] J    // ch3 .2214/N .97q
                        _INT 6
                        RCL[times] J
                        _INT 16
                        +
                        SWAP
                        x[<=]? Y
                                JMP qf_chi2_est_exit
                        RCL R_P
                        GSB log1m
                        _INT 150
                        RCL[times] J
                        /
                        INC X
                        [times]

qf_chi2_est_exit::      RCL R_P
                        RTN
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: [WP-34S] Chi-Square Distribution - Paul Dale - 01-11-2014 11:11 PM



User(s) browsing this thread: 1 Guest(s)