R/Quant.R

Defines functions Quant

Documented in Quant

Quant <-
function(p,int,tolerance=.Machine$double.eps,...){
  F <- function(x)1-exp(-CumInt(x,int=int,...))
  fn <- function(p){
    lo <- up <- k <- 0;
    while(F(up)<p){up <- up + 2^k; k <- k+1}
    while(abs(lo-up)>tolerance){
      mid <- (lo+up)/2;
      if(F(mid)>=p){up <- mid}else{lo <- mid}
    }
    return((lo+up)/2)
  }
  sapply(p,fn)
}

Try the coxsei package in your browser

Any scripts or data that you put into this service are public.

coxsei documentation built on Feb. 8, 2020, 9:07 a.m.