bisearch {extRemes}R Documentation

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.

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.

Value

x The estimated crossing.
fm The difference between the function value at the found crossing and upcross.level.
iter Number of iterations used to find the crossing.

Author(s)

Unknown

References

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

See Also

gev.parameterCI,gpd.parameterCI

Examples

# 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)

[Package extRemes version 1.59 Index]