如何用spss进行岭回归,并作岭迹图?我用的是spss17.0,请问具体的操作步骤是什么呢?

编程我试过,我的17.0的软件没有Ridge Regression. sps 。
2024-11-22 04:58:40
推荐回答(1个)
回答1:

SPSS做岭回归的Ridge Regression. sps代码如下:
*---------------------------------------------------------------------------.
* Calculate raw coefficients from standardized ones, compute standard errors
* of coefficients, and an intercept term with standard error. Then print
* out similar to REGRESSION output.
*---------------------------------------------------------------------------(从这里开始是给出系数估计)
. compute beta={b;0}.
. compute b= ( b &/ std ) * sy.
. compute intercpt=ybar-t(b)*t(xmean).
. compute b={b;intercpt}.
. compute xpx=(sse/(sst*(n-nv-1)))*inv(xpx+(k &* ident(nv,nv)))*xpx*
inv(xpx+(k &* ident(nv,nv))).
. compute xpx=(sy*sy)*(mdiag(1 &/ std)*xpx*mdiag(1 &/ std)).
. compute seb=sqrt(diag(xpx)).
. compute seb0=sqrt( (sse)/(n*(n-nv-1)) + xmean*xpx*t(xmean)).
. compute seb={seb;seb0}.
. compute rnms={varname,'Constant'}.
. compute ratio=b &/ seb.
. compute ppp=2*(1-tcdf(abs(ratio),n-nv-1)).
. compute bvec={b,seb,beta,ratio,ppp}.
. print bvec/title='--------------Variables in the Equation----------------'
/rnames=rnms /clabels='B' 'SE(B)' 'Beta' 'T' 'sig'.
. print /space=newpage.
end if.