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. 23, 2023, 5:09 p.m.