| Statistics Toolbox | ![]() |
Parameter estimates for ridge regression.
Syntax
b = ridge(y,X,k)
Description
returns the ridge regression coefficients b = ridge(y,X,k)
b for the linear model y = X
+
, where:
When k = 0, b is the least squares estimator. For increasing k, the bias of b increases, but the variance of b falls. For poorly conditioned X, the drop in the variance more than compensates for the bias.
Example
This example shows how the coefficients change as the value of k increases, using data from the hald dataset.
load hald;
b = zeros(4,100);
kvec = 0.01:0.01:1;
count = 0;
for k = 0.01:0.01:1
count = count + 1;
b(:,count) = ridge(heat,ingredients,k);
end
plot(kvec',b'),xlabel('k'),ylabel('b','FontName','Symbol')
| regstats | robustdemo | ![]() |