R/hommel-function.R

Defines functions hommel

Documented in hommel

hommel <- function(p, simes = TRUE)
{
  if(any(is.na(p))) 
    stop("missing values in input p-values")
  
  if(length(p)==0)
    stop("the pvalues vector is empty")    
  
  #save names in right order
  names <- names(p)
  
  perm <- order(p)
  sortedp <- p[perm]
  
  m <- length(p)
  
  simesfactor <- findsimesfactor(simes, m)
  
  jumpalpha <- findalpha(sortedp, m, simesfactor, simes)
  
  adjusted <- adjustedElementary(sortedp, jumpalpha, m, simesfactor)
  adjusted[perm] <- adjusted
  names(adjusted) <- names

  out <- new("hommel",
             p = p,
             jumpalpha = jumpalpha,
             sorter = perm,
             adjusted = adjusted,
             simesfactor = simesfactor,
             simes = simes)
  
  return(out)
  
}

Try the hommel package in your browser

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

hommel documentation built on Dec. 17, 2021, 5:11 p.m.