R/group_lambda_zero.R

Defines functions group_lambda_zero

group_lambda_zero <- function(x, y, groups, pf) {
  xty <- Matrix::crossprod(Matrix::Matrix(x), y)
  l2 <- function(x){sqrt(sum(x))}
  norms <- tapply(Matrix::rowSums(xty^2), INDEX = factor(groups), FUN = l2)
  return(max(norms/pf))
}
ericdunipace/SLIMpaper documentation built on May 5, 2024, 3:43 p.m.