Ridge Regression Analysis Using SPSS

Open SPSS to enter data into SPSS.

Click File -> New -> Grammar in the upper left corner

enter

* Encoding: UTF-8.
INCLUDE 'D:\Program Files\IBM\SPSS\Statistics\27\Samples\Simplified Chinese\Ridge regression.sps'.
ridgereg enter x1 x2 x3 x4 x5 x6 x7 x8 x9 x10/dep=y.

The include content needs to be found by yourself, that is, the Ridge regression.sps file under the path of Samples\Simplified Chinese\Ridge regression.sps, and you can find it yourself according to your own installation directory. After enter, fill in the ridge regression independent variable, and dep is the ridge regression dependent variable. After typing, click Run -> All.

Click the viewer to view the results.

The smaller the value of k, the better, and choose a value of k that tends to be stable. It can be seen that the k value tends to be stable when it is between 0.2-0.3. Switch to the syntax interface and enter the following code:

* Encoding: UTF-8.
INCLUDE 'D:\Program Files\IBM\SPSS\Statistics\27\Samples\Simplified Chinese\Ridge regression.sps'.
ridgereg enter x1 x2 x3 x4 x5 x6 x7 x8 x9 x10/dep=y/start=0/stop=0.3/inc=0.02.

start indicates the starting point of the ridge trace diagram, stop indicates the end point of the ridge trace diagram, and inc indicates the abscissa interval (0, 0.02, 0.04...).

Click Run -> All

It can be seen that it tends to be stable at around 0.08. (This choice is more subjective) Then go back to the grammar interface and modify the grammar as follows:

* Encoding: UTF-8.
INCLUDE 'D:\Program Files\IBM\SPSS\Statistics\27\Samples\Simplified Chinese\Ridge regression.sps'.
ridgereg enter x1 x2 x3 x4 x5 x6 x7 x8 x9 x10/dep=y/k=0.08.

Click Run -> All, open the viewer to see the results

Rsquare is the r square,

parameter before the variable

is a constant term

Note: After determining the k value, it is best to restart the software and then enter the grammar

* Encoding: UTF-8.
INCLUDE 'D:\Program Files\IBM\SPSS\Statistics\27\Samples\Simplified Chinese\Ridge regression.sps'.
ridgereg enter x1 x2 x3 x4 x5 x6 x7 x8 x9 x10/dep=y/k=0.08.

Guess you like

Origin blog.csdn.net/mengzhilv11/article/details/129588810