my.bisec {ebGenotyping} | R Documentation |
This function is to apply bisection method to find the root of a function f.
my.bisec(f, int.l, int.u, eps = 1e-06)
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. |
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.
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.
Na You <youn@mail.sysu.edu.cn> and Gongyi Huang<53hgy@163.com>
Na You and Gongyi Huang.(2016) An Empirical Bayes Method for Genotyping and SNP detection Using Multi-sample Next-generation Sequencing Data.
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)