R/lasso.klcompreg.R

Defines functions lasso.klcompreg

Documented in lasso.klcompreg

lasso.klcompreg <- function(y, x, alpha = 1, lambda = NULL, nlambda = 100, type = "grouped", xnew = NULL) {
  mod <- glmnet::glmnet(x, y, alpha = alpha, nlambda = nlambda, lambda = lambda, family = "multinomial",
                        type.multinomial = type)
  est <- NULL
  if ( !is.null(xnew) ) {
    est <- predict(mod, newx = xnew)
  }
  list(mod = mod, est = est)
}

Try the Compositional package in your browser

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

Compositional documentation built on Oct. 9, 2024, 5:10 p.m.