| bisection | R Documentation |
This function is a modified version of the bisection function
in the cmna R package (Howard, 2017), designed to find a root of the function
.fun with respect to its first argument. Unlike the original bisection() in
cmna, this version allows additional arguments to be passed to .fun.
bisection(.fun, ..., lb, ub, tol = 1e-04, max.it = 100)
.fun |
A function for which the root is to be found. |
... |
Additional arguments to be passed to |
lb |
A numeric value specifying the lower bound of the search interval. |
ub |
A numeric value specifying the upper bound of the search interval. |
tol |
A numeric value specifying the tolerance for convergence. Default is 1e-4. |
max.it |
An integer specifying the maximum number of iterations. Default is 100. |
The bisection method is a well-known root-finding numerical algorithm
that applies to any continuous function, provided that the function values at the lower (lb)
and upper (ub) bounds have opposite signs. The method repeatedly bisects the interval until
the absolute difference between successive estimates is smaller than the error tolerance
(tol) or the maximum number of iterations (max.it) is reached.
A list with the following components:
root: The estimated root of the function.
iter: The number of iterations performed.
accuracy: The final absolute difference between the last two interval
points with opposite signs.
Howard, J. P. (2017). Computational methods for numerical analysis with R. New York: Chapman and Hall/CRC.
est_score()
## Example: Find the theta value corresponding to a given probability
## of a correct response using the item response function of a 2PLM
## (a = 1, b = 0.2)
# Define a function of theta
find.th <- function(theta, p) {
p - drm(theta = theta, a = 1, b = 0.2, D = 1)
}
# Find the theta value corresponding to p = 0.2
bisection(.fun = find.th, p = 0.2, lb = -10, ub = 10)$root
# Find the theta value corresponding to p = 0.8
bisection(.fun = find.th, p = 0.8, lb = -10, ub = 10)$root
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.