R/ggammacp.R

Defines functions ggammacp

Documented in ggammacp

#' @title Probabilistic estimation of earthquake recurrence interval using generalized gamma distribution
#' @description Computes the probability of an earthquake within a specified time "r" and elapsed time "te".
#'
#' @param fit Fit is the fitggamma object. See ?fitggamma for details.
#' @param r The specified time in which the probability of an earthquake is desired to be calculated.
#' @param te Elapsed time since the last earthquake
#' @references Pasari, S. and Dikshit, O. (2014). Impact of three-parameter Weibull models in probabilistic assessment of earthquake hazards. Pure and Applied Geophysics, 171, 1251-1281.
#' @export
#' @return A numeric value
#' @importFrom stats ks.test optim
#' @importFrom VGAM dpareto ppareto rpareto
#' @examples
#' fit=fitggamma(c(1,1,1),data=data_earthquake_6_6.5)
#' ggammacp(fit,r=2,te=5)

ggammacp=function(fit,r,te){
  if (missingArg(fit) == TRUE)
    stop("fit object is missing. The fit object must be fitggamma object. See ?fitggamma for details.")
  if (missingArg(r) == TRUE)
    stop("r object is missing.")
  if (missingArg(te) == TRUE)
    stop("te object is missing.")

  GG=cdfggamma(fit$mle,r+te)
  G=cdfggamma(fit$mle,te)
  f=(GG-G)/(1-G)
  return(f)
}

Try the ERPeq package in your browser

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

ERPeq documentation built on July 9, 2023, 5:27 p.m.