turnbull: Fix typo

Copy paste error in likelihood-ratio CIs resulting in lower confidence limit being reported as upper confidence limit
This commit is contained in:
RunasSudo 2023-12-26 23:45:28 +11:00
parent 162e415e07
commit d690da72e3
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
1 changed files with 4 additions and 6 deletions

View File

@ -723,12 +723,12 @@ fn survival_prob_likelihood_ratio_ci(data: &TurnbullData, progress_bar: Progress
// Compute upper confidence limit
root_finder = AndersonBjorckRootFinder::new(
0.0, s[time_index],
f64::NAN, -CHI2_1DF_95 // Value of (lr_statistic - CHI2_1DF_95), which we are seeking the roots of
s[time_index], 1.0,
-CHI2_1DF_95, f64::NAN // Value of (lr_statistic - CHI2_1DF_95), which we are seeking the roots of
);
ci_estimate = s[time_index] - Z_97_5 * oim_se[time_index - 1];
if ci_estimate < 0.0 {
ci_estimate = s[time_index] + Z_97_5 * oim_se[time_index - 1];
if ci_estimate > 1.0 {
ci_estimate = root_finder.next_guess(); // Returns interval midpoint in this case
}
@ -744,8 +744,6 @@ fn survival_prob_likelihood_ratio_ci(data: &TurnbullData, progress_bar: Progress
value_left, value_right // Value of (lr_statistic - CHI2_1DF_95), which we are seeking the roots of
);
// TODO: Terminate if reached precision already
ci_estimate = root_finder.next_guess(); // Returns interval midpoint in this case
}
}