Learn R Programming

extRemes (version 1.65)

bisearch: Simple Bisection Search.

Description

Bisection search algorithm to find where a function crosses a particular value.

Usage

bisearch(x1, x2, f, tol = 1e-07, niter = 25, upcross.level = 0)

Arguments

x1
Low-end starting value.
x2
High-end starting value.
f
A function for which to find the crossing value.
tol
The tolerance that determines whether to break (early) from the algorithm.
niter
Number of iterations to try before quitting.
upcross.level
The level where it is desired to find where f crosses.

Value

  • xThe estimated crossing.
  • fmThe difference between the function value at the found crossing and upcross.level.
  • iterNumber of iterations used to find the crossing.

Details

This function is shamelessly stolen from the fields package (cf. bisection.search), but is slightly simpler (i.e., less useful) in that it doesn't allow for extra arguments to f. It is used in the gev.parameterCI and gpd.parameterCI functions to try to find analytically where the profile likelihood crosses the chi-square based critical value for obtaining confidence bounds on parameter estimates.

References

Fishbane, P. M., Gasiorowicz, S. and Thornton, S. T. (1996) Physics for Scientists and Engineers, 2nd ed. (Extended), Upper Saddle River, New Jersey: Prentice Hall.

See Also

gev.parameterCI,gpd.parameterCI

Examples

Run this code
# Try to solve x^2 = 0.2
# Initial guess is that it occurs between x=0 and x=1.
bisearch( 0, 1, function(x) x^2, tol=1e-20, upcross.level=0.2)

Run the code above in your browser using DataLab