Hello,
I'm attempting to use the SPSS Ridge Regression Macro for the first time. I am able to generate the new k values and corresponding R-squared values; however, the ANOVA table requested in the Ridge Regression Macro provided by SPSS is not printed in the output. Below is the part of the SPSS macro syntax I am referring to. Am I supposed to edit this section in order to see the regression results? Thanks in advance for your input! -Carrie *---------------------------------------------------------------------------. * If we are to print out estimation results, compute needed pieces and * print out header and ANOVA table. *---------------------------------------------------------------------------. do if (!k <> 999). .!let !rrtitle=!concat('****** Ridge Regression with k = ',!k). .!let !rrtitle=!quote(!concat(!rrtitle,' ****** ')). . compute sst=(n-1) * sy **2. . compute sse=sst * ( 1 - 2* t(b)*xy + t(b)*xpx*b). . compute ssr = sst - sse. . compute s=sqrt( sse / (n-nv-1) ). . print /title=!rrtitle /space=newpage. . print {sqrt(rsq);rsq;rsq-nv*(1-rsq)/(n-nv-1);s} /rlabel='Mult R' 'RSquare' 'Adj RSquare' 'SE' /title=' '. . compute anova={nv,ssr,ssr/(nv);n-nv-1,sse,sse/(n-nv-1)}. . compute f=ssr/sse * (n-nv-1)/(nv). . print anova /clabels='df' 'SS','MS' /rlabel='Regress' 'Residual' /title=' ANOVA table' /format=f9.3. . compute test=ssr/sse * (n-nv-1)/nv. . compute sigf=1 - fcdf(test,nv,n-nv-1). . print {test,sigf} /clabels='F value' 'Sig F'/title=' '. *---------------------------------------------------------------------------. * 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 bvec={b,seb,beta,ratio}. . print bvec/title='--------------Variables in the Equation----------------' /rnames=rnms /clabels='B' 'SE(B)' 'Beta' 'B/SE(B)'. . print /space=newpage. end if. *---------------------------------------------------------------------------. * Save kept results into file. The number of cases in the file will be * equal to the number of values of k for which results were produced. This * will be simply 1 if k was specified. *---------------------------------------------------------------------------. |
Free forum by Nabble | Edit this page |