ridge() — Ridge regression

Linear regression with a penalty that shrinks the coefficients.

ridge(lambda, X, y)

Key idea

Definition

the penalty strength (>= 0)
the model coefficients
the size of the coefficients (the squared L2 norm)
the observed value

In plain words

Least squares can over-react and draw a crazy wiggly line. Ridge tells it to keep the line calm, and a bigger lambda means calmer.

Where you'd use it

Frequently asked questions

Ridge or lasso?
Ridge shrinks all coefficients (keeps every feature); lasso can zero some out (feature selection).