Skip to content

Commit a319a7a

Browse files
committed
invlogccdf_newton(): refactor using newton()
1 parent 4e7f76c commit a319a7a

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

src/quantilealgs.jl

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -118,17 +118,9 @@ function invlogccdf_newton(d::ContinuousUnivariateDistribution, lp::Real, xs::Re
118118
if -Inf < lp < 0
119119
x0 = T(xs)
120120
if lp < logccdf(d,x0)
121-
x = x0 + f_a(x0)
122-
while abs(x-x0) > max(abs(x),abs(x0)) * tol
123-
x0 = x
124-
x = x0 + f_a(x0)
125-
end
121+
return newton(f_a, T(xs), tol)
126122
else
127-
x = x0 + f_b(x0)
128-
while abs(x-x0) > max(abs(x),abs(x0)) * tol
129-
x0 = x
130-
x = x0 + f_b(x0)
131-
end
123+
return newton(f_b, T(xs), tol)
132124
end
133125
return x
134126
elseif lp == -Inf

0 commit comments

Comments
 (0)