R/ConfidenceIntervalsIndex.R

Defines functions ConfidenceIntervalsIndex

Documented in ConfidenceIntervalsIndex

#' Compute the confidence interval index by Minkah & de Wet (2018)
#'
#'@param Sig the significance level (alpha). Defaults to 0.05.
#'@param Coverage The empirical coverage - a number in (0,1).
#'@param Length The empirical length of the interval.
#'@details Comparison of Confidence Interval Estimators: An Index Approach. Minkah & de Wet, 2018.
#'@examples
#'ConfidenceIntervalsIndex(Sig = 0.1,Coverage = 0.95,Length = 0.2)
#'ConfidenceIntervalsIndex(Sig = 0.1,Coverage = 0.9,Length = 0.25)
#'@export
ConfidenceIntervalsIndex <- function(Sig=0.05,Coverage,Length){

      k <- (4-2*Sig)/(3-2*Sig) # scaling constant
      H <- function(eta,Sig){abs(1-Sig-eta)} # loss function (absolute)
      Index <- 1 - 0.5*((1 + H(eta=Coverage,Sig=Sig)) / (1 + (Coverage/(1 + Length))))

      return(Index)



  }
blebedenko/thescript2 documentation built on Dec. 19, 2021, 9:53 a.m.