Skip to content

Commit

Permalink
try max instead of correction
Browse files Browse the repository at this point in the history
  • Loading branch information
sbfnk committed Jan 22, 2025
1 parent 75628ff commit 4a98786
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion inst/stan/functions/rt.stan
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ real R_to_r_manual(real R, vector gt_rev_pmf, real abs_tol) {
int gt_len = num_elements(gt_rev_pmf);
vector[gt_len] gt_pmf = reverse(gt_rev_pmf);
real mean_gt = dot_product(gt_pmf, linspaced_vector(gt_len, 0, gt_len - 1));
real r = (R - 1) / (R * mean_gt + 1);
real r = fmax((R - 1) / (R * mean_gt), -1);
real step = abs_tol + 1;
while (abs(step) > abs_tol) {
step = R_to_r_newton_step(R, r, gt_pmf);
Expand Down

0 comments on commit 4a98786

Please sign in to comment.