R/coef.ridgeLinear.R

## coef method for ridgeLinear objects

#' @rdname coef
#' @export
coef.ridgeLinear <- function (object, all.coef = FALSE, ...) 
{
  scaledcoef <- t(as.matrix(object$coef/object$scales))
  if (object$Inter) {
    inter <- object$ym - scaledcoef %*% object$xm
    scaledcoef <- cbind(Intercept = inter, scaledcoef)
    colnames(scaledcoef)[1] <- "(Intercept)"
  }
  if(object$automatic && all.coef == FALSE)
    {
      scaledcoef <- scaledcoef[object$chosen.nPCs,]
    }
  drop(scaledcoef)
}

Try the ridge package in your browser

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

ridge documentation built on April 11, 2022, 5:05 p.m.