R/pbd_durspec_quantile.R

Defines functions pbd_durspec_quantile

Documented in pbd_durspec_quantile

#' @export

pbd_durspec_quantile = function(pars,p)
{
   expdurspec = pbd_durspec_mean(pars)
   if(expdurspec < 1E-7)
   {
      q = 0
   } else {
      found = 0
      uptau = 100 * expdurspec
      while(found == 0)
      {
          if(pbd_durspec_cumdensity(pars,uptau) > p)
          {
              found = 1
          } else {
              uptau = 10*uptau
          }
      }
      q = stats::uniroot(function(x) pbd_durspec_cumdensity(pars,x) - p,c(0,uptau))$root
   }
   return(q)
}

Try the PBD package in your browser

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

PBD documentation built on May 2, 2019, 9:13 a.m.