my.bisec: Bisection method to find the root

Description Usage Arguments Details Value Author(s) References Examples

Description

This function is to apply bisection method to find the root of a function f.

Usage

1
my.bisec(f, int.l, int.u, eps = 1e-06)

Arguments

f

the function for which the root is sought.

int.l

a vector containing the lower bound of the interval to be searched for the root. The length of the vector is the same as that of the input of function f.

int.u

a vector containing the upper bound of the interval to be searched for the root. The length of the vector is the same as that of the input of function f.

eps

a single value: a threshold to control the convergence criterion. The default is 1e-06.

Details

Both int.l and int.u must be specified: the upper bound must be strictly larger than the lower bound.

The function f must be well defined without invalid output(NA, nan, Inf, etc).

The length of the input of function f, the output of function f, int.l and int.u must be the same.

Value

a vector containing the root of the function. If there is no root in the interval (int.l, int.u), lower bound of the interval will be returned.

Author(s)

Na You <youn@mail.sysu.edu.cn> and Gongyi Huang<53hgy@163.com>

References

Na You and Gongyi Huang.(2016) An Empirical Bayes Method for Genotyping and SNP detection Using Multi-sample Next-generation Sequencing Data.

Examples

1
2
3
4
5
f <- function(x){
a <- 1:10
return(x-a)
}
my.bisec(f=f, int.l=rep(-1,10), int.u=rep(11,10), eps = 1e-08)


Search within the ebGenotyping package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.