R/mtp_chochberg.R

# c-Hochberg
# 2019-02-18 
# 2019-06-25 
# Jiangtao Gou
# Example: mtp.chochberg(pvec.sorted=rev(c(0.97,0.83,0.79,0.73,0.61,0.59,0.47,0.37,0.31,0.29,0.23,0.19,0.13,0.07,0.03)), alpha=0.30)
#
mtp.chochberg <- function (pvec.sorted, alpha) {
  pvec.length <- length(pvec.sorted)
  for (i in 1:pvec.length) {
    if (i == 2) {
      cc <- 1/2 - alpha/2
    } else if (i == 3) {
      cc <- 1/3 - alpha/36
    } else {
      cc <- 1/i
    }
    if (pvec.sorted[pvec.length-i+1] <= alpha*cc) {
      #
      rej.idx <- pvec.length-i+1
      #
      return (list(rej.idx=rej.idx, init.count=i))
    } # End of if 
  }
  return (list(rej.idx=0, init.count=pvec.length))
}

Try the elitism package in your browser

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

elitism documentation built on Sept. 3, 2023, 1:06 a.m.