| Line 60... |
Line 60... |
| 60 |
} else /* imax = Inf */
|
60 |
} else /* imax = Inf */
|
| 61 |
mid = 0;
|
61 |
mid = 0;
|
| 62 |
|
62 |
|
| 63 |
if(mid == 0) {
|
63 |
if(mid == 0) {
|
| 64 |
/* underflow to 0 -- maybe numerically correct; maybe can be more accurate,
|
64 |
/* underflow to 0 -- maybe numerically correct; maybe can be more accurate,
|
| - |
|
65 |
* TODO: above log(.): logmid = dpois_raw(imax, ncp2, TRUE) + dchisq(x, dfmid, TRUE);
|
| - |
|
66 |
* ---- and switch to complete log-scale summation of logterm += log(q) {etc} below
|
| 65 |
* particularly when give_log = TRUE */
|
67 |
* particularly when give_log = TRUE */
|
| 66 |
/* Use central-chisq approximation formula when appropriate;
|
68 |
/* Use central-chisq approximation formula when appropriate;
|
| 67 |
* ((FIXME: the optimal cutoff also depends on (x,df); use always here? )) */
|
69 |
* ((FIXME: the optimal cutoff also depends on (x,df); use always here? )) */
|
| 68 |
if(give_log || ncp > 1000.) {
|
70 |
if(give_log || ncp > 1000.) {
|
| 69 |
double nl = df + ncp, ic = nl/(nl + ncp);/* = "1/(1+b)" Abramowitz & St.*/
|
71 |
double nl = df + ncp, ic = nl/(nl + ncp);/* = "1/(1+b)" Abramowitz & St.*/
|