R/get_fit_methods.r

Defines functions fit.methods.helper.add.name get.path.fit.methods get.fit.methods

get.fit.methods <- function() {
  fit.methods <- c(lasso = lm.lasso.min,
                   elastic = lm.elastic.half,
                   relaxo = lm.relaxo,
                   mcp = lm.mcp,
                   scad = lm.scad)
  return(fit.methods.helper.add.name(fit.methods))
}

get.path.fit.methods <- function() {
  path.fit.methods <- list(lasso = lm.lasso.path,
                           elastic = lm.elastic.half.path,
                           relaxo = lm.relaxo.path,
                           scad = lm.scad.path,
                           mcp = lm.mcp.path)
  return(fit.methods.helper.add.name(path.fit.methods))
}

## ----- helper function -----
fit.methods.helper.add.name <- function(fit.methods) {
  for (fit.method.name in names(fit.methods)) {
    fit.method <- fit.methods[[fit.method.name]]
    attr(fit.method, "name") <- fit.method.name
    fit.methods[[fit.method.name]] <- fit.method
  }
  return(fit.methods)
}

Try the CSUV package in your browser

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

CSUV documentation built on Oct. 23, 2020, 5:49 p.m.