MATLAB: Ridge regression y=a1*x1+a2*x2+a3*x3+C

MATLABridge regression

hi, I want to calculate the coefficient of equation using Ridge regression according to the following equation, y=a1*x1+a2*x2+a3*x3+C C is a constant i am using the command, a=ridge(y,[1 x1 x2 x3],0.5)
when I try to regenerate y using the coefficient and the x's it is not giving me the same values. Although the trend is looking same but values are scaled up. The data file containing y,x1,x2,x3 are attached. Please have a look and give me you expert opinion. I will be very thankful to you. SSR

Best Answer

From
help ridge
"B1 = ridge(Y,X,K) returns ... regression coefficients...
... The results are computed after centering and scaling
the X columns so they have mean 0 and standard deviation 1."
It goes on to point out that to avoid using the scaling internally, add a fourth argument
doc ridge
for details.