R/featrank_glm.R

Defines functions featrank_glm

#' @export
featrank_glm <- function(Y, X, family, obsWeights = NULL, ties_method = "last", ...) {
  
  # X must be a dataframe, not a matrix.
  if (is.matrix(X)) {
    X = as.data.frame(X)
  }
  
  fit.glm <- suppressWarnings(glm(Y ~ ., data = X, family = family, weights = obsWeights))
  
  # Extract p-values.
  p_vals = summary(fit.glm)$coefficients[-1, 4]
  return(rank(p_vals, ties.method = ties_method))
}
ck37/featurerank documentation built on April 12, 2022, 12:24 a.m.