R/PoolMax.R

library(roxygen2)
library(devtools)

#' Max Test Meta Analysis
#'
#'This function uses the Maximum test to pool pvalues
#'It follows a beta distribution with degrees of freedom alpha=K and beta=1 under the null hypothesis.

#' @param input is a list of p-values

#' @return the maximum p-value as the test statistic
#'
#' @examples
#' pvalues<- c(0.486667826,0.154255057, 0.858419083, 0.486667826 ,0.405013316, 0.316372249, 0.173853520, 0.284391656, 0.370577866, 0.421579844, 0.221750129, 0.962561630, 0.392123661, 0.127102942, 0.896587161, 0.665359191)
#' pool.max(pvalues)


pool.max <- function(pvalues){
  k <- length(pvalues)
  TS <- max(pvalues)
  p.value <- pbeta(TS, shape1=k, shape2=1, lower.tail=F)
  return(p.value)
}
tinahart97/ams597PROJ documentation built on May 8, 2019, 12:55 a.m.