R/ridge.R

Defines functions ridge

Documented in ridge

ridge <-
function (lambda = NULL, ...)
{
  lambda.check (lambda)  

  if (length (lambda) != 1)        ## Check on dimensionality of lambda
    stop ("lambda must be a scalar \n")

  names (lambda) <- "lambda"

  getpenmat <- function (beta = NULL, ...)
  {
      if (is.null (beta))
        stop ("'beta' must be the current coefficient vector \n")

      p <- length (beta)
      penmat <- diag (lambda, p)
      penmat
  }

  structure (list (penalty = "ridge", lambda = lambda, getpenmat = getpenmat), class = "penalty")
}

Try the lqa package in your browser

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

lqa documentation built on May 30, 2017, 3:41 a.m.