binary logistic regression -...

16
SPSS Logistic Regression Kittipong MD,MBA,PhD 1 Binary Logistic Regression >'DWD IURP v 6OHHS /RJLVWLF 5 v@ %LQDU\ ORJLVWLF UHJUHVVLRQ ツnーーチ} ヲウチ」 ナoツn 6LPSOH ELQDU\ ORJLVWLF UHJUHVVLRQ ヲウーoェ・エェツヲoチ。ク・ エェ 0XOWLSOH ELQDU\ ORJLVWLF UHJUHVVLRQ ヲウーoェ・エェツヲo、オェnオ エェ &OLFN $QDO\]H ! 5HJUHVVLRQ ! %LQDU\ /RJLVWLFh チィコーエェツヲオ、トュnnー 'HSHQGHQW nオチ} ツィウ トクノクハコー 'HSUHVVLRQ チィコーエェツヲoトュnnー &RYDULDWHV ナoツn &ODVV $JH 6H[ %0, FRGH 6OHHSLQHVV &DWHJRULFDOh チコノーオエェツヲ &ODVV 6H[ %0, FRGH 6OHHSLQHVV チ} &DWHJRULFDO 9DULDEOH oーホオョトョo チ} &DWHJRU\ チィコー、オトュnト &DWHJRULFDO &RYDULDWHV BBBBBBBBBBBBB &KDQJH &RQWUDVW &RQWUDVW チィコー ,QGLFDWRU トクノクハトョo &DWHJRU\ クノ、クnオoー・クノュサチ} 5HIHUHQFH チィコー BB )LUVW &KDQJH ヲウホオヲサエェツヲクノチ} &DWHJRU\ hh &RQWLQXH 2SWLRQVh チィコーオ、ツ」シ、キnーナクhhh &RQWLQXH 6DYHh 3UHGLFWHG 9DOXHV チィコー ü 3UREDELOLWLHV ü *URXS PHPEHUVKLS hhh &RQWLQXH

Upload: vandang

Post on 08-Nov-2018

221 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Binary Logistic Regression - med.swu.ac.thmed.swu.ac.th/preventive/images/CM.511/Binary_Logistic_Regression.pdf · SPSS Logistic Regression Kittipong MD,MBA,PhD 1 Binary Logistic

SPSS ­ Logistic Regression  Kittipong  MD,MBA,PhD 1 

Binary Logistic Regression 

[Data from “ Sleep (Logistic R) “] Binary logistic regression แบงออกเปน 2 ประเภท ไดแก 

1.  Simple binary logistic regression ประกอบดวยตัวแปรตนเพยีง 1 ตัว 2.  Multiple binary logistic regression ประกอบดวยตัวแปรตนมากกวา 1 ตัว 

Click Analyze > Regression > Binary Logistic… เลือกตัวแปรตามใสชอง Dependent:  (คาเปน 0 และ 1) ในทีน่ี้คือ Depression เลือกตัวแปรตนใสชอง  Covariates:  ไดแก Class, Age, Sex, BMI code, Sleepiness กด Categorical… เนื่องจากตัวแปร Class, Sex, BMI code, Sleepiness เปน Categorical Variable ตองกําหนดให เปน Category เลือกมาใสใน Categorical Covariates: _____________ Change Contrast Contrast: เลือก Indicator ในที่นีใ้ห Category ที่มีคานอยที่สุดเปน Reference  เลือก __ First กด Change กระทําจนครบทกุตัวแปรทีเ่ปน Category ……. กด Continue กด Options… เลือกตามแผนภูมิตอไปนี้  ………กด Continue 

กด Save… Predicted Values เลือก ü Probabilities ü Group membership  ………กด Continue

Page 2: Binary Logistic Regression - med.swu.ac.thmed.swu.ac.th/preventive/images/CM.511/Binary_Logistic_Regression.pdf · SPSS Logistic Regression Kittipong MD,MBA,PhD 1 Binary Logistic

SPSS ­ Logistic Regression  Kittipong  MD,MBA,PhD 2 

เลือก Method: Enter กด OK Enter  เปนวิธีการเลือกตัวแปรอิสระเขาสมการในขั้นตอนเดียว โดยพจิารณาจากระดับนัยสําคญั 

(significant) หรือตามขอสนับสนุนทางวิชาการ 

Logistic Regression 

Case Processing Summary 

Unweighted Cases(a)  N  Percent Included in Analysis  479  99.6 Missing Cases  2  .4 

Selected Cases 

Total  481  100.0 Unselected Cases  0  .0 Total  481  100.0 a  If weight is in effect, see classification table for the total number of cases. 

อธิบาย:  นําเสนอภาพรวมของจํานวนกลุมตัวอยางทีน่ํามาวิเคราะหซึ่งจํานวนกลุมตัวอยางมี ทั้งสิ้น 481 คน มีกลุมตัวอยางที่มีขอมูลไมครบจํานวน 2 คนคิดเปนรอยละ 0.4 Selected cases จํานวนทั้งหมดมาวิเคราะห 

Dependent Variable Encoding 

Original Value  Internal Value No Depression  0 Depression  1 

อธิบาย:  ตัวแปรตาม Depression คา 0 หมายถึง No Depression สวนคา 1 หมายถึง มีภาวะ Depression 

Categorical Variables Codings 

Parameter coding Frequency  (1)  (2)  (3) 

Underweight  88  .000  .000  .000 Normal  305  1.000  .000  .000 Risk to Overweight  42  .000  1.000  .000 

BMIcode 

Obesity  44  .000  .000  1.000 No Daytime Sleepiness  245  .000 Sleepiness 

Daytime Sleepiness  234  1.000 

Male  192  .000 Sex Female  287  1.000 Pre­Clinic  296  .000 Class Clinic  183  1.000

Page 3: Binary Logistic Regression - med.swu.ac.thmed.swu.ac.th/preventive/images/CM.511/Binary_Logistic_Regression.pdf · SPSS Logistic Regression Kittipong MD,MBA,PhD 1 Binary Logistic

SPSS ­ Logistic Regression  Kittipong  MD,MBA,PhD 3 

อธิบาย:  เปนการสราง Dummy  variables  ซึ่งจํานวน Dummy  variables  จะเทากับจํานวน categories  – 1  เชน BMIcode แบงเปน 4 categories มีจํานวน Dummy variables เทากับ 3 โดยมี Underweight ซึ่งมีคา parameter coding = 0, 0, 0 เปนตัวอางอิงหรือ ตัวเปรียบเทียบ (reference) ตามที่กําหนดไวเปน First  reference  category ดังนั้น effect ที่เกิดขึ้นในแตละ category ของ BMIcode จะเปรียบเทียบกับ underweight 

Block 0: Beginning Block Iteration History(a,b,c) 

Coefficients 

Iteration ­2 Log likelihood  Constant 

1  409.626  ­1.407 2  402.068  ­1.714 3  401.995  ­1.748 

Step 0 

4  401.995  ­1.749 a  Constant is included in the model. b  Initial ­2 Log Likelihood: 401.995 c  Estimation terminated at iteration number 4 because parameter estimates changed by less than .001. 

อธิบาย:  เปนการประมาณคา Constant ใน model ที่ไมมีตัวแปรตนรวมอยูหรือ null model ดวย วิธี Maximum Likelihood Estimator method (MLE) โดยการหาคา coefficient (β) ที่ ทําใหคา parameter estimation มีคาเขาใกล 0 มากที่สุด นั่นคือ  P(Depression) = e β0 / 1+ e β0 เขาใกล 0 

Classification Table(a,b) 

Observed  Predicted 

Depression 

No Depression  Depression Percentage Correct 

Depression  No Depression  408  0  100.0 Depression  71  0  .0 

Step 0 

Overall Percentage  85.2 a  Constant is included in the model. b  The cut value is .500 

อธิบาย:  Classification Table เปนการนําเสนอ Null Model คือ model ที่ไมมีตัวแปรตนรวมอยู ใน model แสดงความสัมพันธระหวางคา observed กับคา predicted 

Variables in the Equation 

B  S.E.  Wald  df  Sig.  Exp(B) Step 0  Constant  ­1.749  .129  184.909  1  .000  .174 

อธิบาย:  Variables in the Equation หมายถึงคาคงที่ที่อยูใน null model ซึ่งไมมีตัวแปรตนเลย

Page 4: Binary Logistic Regression - med.swu.ac.thmed.swu.ac.th/preventive/images/CM.511/Binary_Logistic_Regression.pdf · SPSS Logistic Regression Kittipong MD,MBA,PhD 1 Binary Logistic

SPSS ­ Logistic Regression  Kittipong  MD,MBA,PhD 4 

Variables not in the Equation 

Score  df  Sig. CLASS(1)  .246  1  .620 AGE  2.536  1  .111 SEX(1)  .015  1  .904 BMICODE  24.717  3  .000 BMICODE(1)  10.656  1  .001 BMICODE(2)  4.712  1  .030 BMICODE(3)  17.807  1  .000 

Variables 

SLEEP(1)  69.107  1  .000 

Step 0 

Overall Statistics  96.585  7  .000 

อธิบาย:  Variables not in the Equation หมายถึงตัวแปรที่ไมอยูใน model ในที่นี้มีอยู 5 ตัวซึ่ง เปนตัวแปรตนทัง้หมด 

Block 1: Method = Enter Iteration History(a,b,c,d) 

Iteration ­2 Log likelihood  Coefficients 

Constant  CLASS(1)  AGE  SEX(1) BMICODE(1)  BMICODE(2)  BMICODE(3)  SLEEP(1) Step 1  1  343.917  ­3.693  ­.248  .080  .094  .039  .646  1.064  1.076 

2  303.025  ­6.135  ­.465  .143  .178  .054  1.109  1.667  2.056 3  293.361  ­7.676  ­.600  .177  .218  .046  1.343  2.001  2.867 4  292.033  ­8.310  ­.643  .185  .225  .040  1.403  2.115  3.315 5  291.981  ­8.436  ­.647  .186  .226  .039  1.408  2.130  3.426 6  291.981  ­8.442  ­.647  .186  .226  .039  1.408  2.130  3.432 7  291.981  ­8.442  ­.647  .186  .226  .039  1.408  2.130  3.432 

a  Method: Enter b  Constant is included in the model. c  Initial ­2 Log Likelihood: 401.995 d  Estimation terminated at iteration number 7 because parameter estimates changed by less than .001. 

ขั้นตอนแรกเปนการทดสอบเพื่อดูวาขอมูลที่มีกับ model เขากันไดหรือไมดังนี้ Omnibus Tests of Model Coefficients 

Chi­square  df  Sig. Step  110.013  7  .000 Block  110.013  7  .000 

Step 1 

Model  110.013  7  .000 

Omnibus Tests of Model Coefficients เปนวิธีทดสอบสมมติฐาน H 0 : β 1 = β 2 =β 3 =…….. =0 ผลการวิเคราะหพบวาคา sig.  ของ Model  <0.05  จึงปฏิเสธสมมติฐาน H 0 แสดงวาคา β หรือ สัมประสิทธิ์ของตัวแปรตนอยางนอย 1 ตัวมีคาไมเทากับ 0 นั่นคือ model นี้มีอยูจริงหรือมีปจจัย อยางนอย 1 ปจจัยมีผลตอภาวะซึมเศรา

Page 5: Binary Logistic Regression - med.swu.ac.thmed.swu.ac.th/preventive/images/CM.511/Binary_Logistic_Regression.pdf · SPSS Logistic Regression Kittipong MD,MBA,PhD 1 Binary Logistic

SPSS ­ Logistic Regression  Kittipong  MD,MBA,PhD 5 

Model Summary 

Step ­2 Log likelihood 

Cox & Snell R Square 

Nagelkerke R Square 

1  291.981  .205  .361 

Model Summary เปนวิธีทดสอบความเหมาะสมของ model โดยดูจากคา -2 Log likelihood (Deviance) และ Pseudo R Square (Cox & Snell R 2 , Nagelkerke R 2 )  คา Deviance ของ model ที่มีคาต่ํากวาแสดงวา model นั้นมีความเหมาะสมกวา สวนคา Pseudo R Square  นั้น คลายคา R Square ใน Linear Regression คือคาของความแปรปรวนของตัวแปรตามที่สามารถ อธิบายไดดวยตัวแปรตน 

Hosmer and Lemeshow Test 

Step  Chi­square  df  Sig. 1  7.768  8  .456 

Hosmer and Lemeshow Test เปนการทดสอบสมมติฐาน H 0 : Model fit จากการวิเคราะหพบวา คา sig.=0.456  ซึ่งมากกวาระดับนัยสําคัญ (<0.05) จึงยอมรับสมมติฐาน H 0  นั่นคือ model  มี ความเหมาะสม 

Contingency Table for Hosmer and Lemeshow Test 

Depression = 0  Depression = 1 

Observed  Expected  Observed  Expected  Total 1  50  49.673  0  .327  50 2  38  38.691  1  .309  39 3  40  39.641  0  .359  40 4  49  49.488  1  .512  50 5  46  46.756  2  1.244  48 6  42  40.970  5  6.030  47 7  40  35.474  4  8.526  44 8  41  39.927  10  11.073  51 9  28  30.289  12  9.711  40 

Step 1 

10  34  37.091  36  32.909  70 

Classification Table(a) 

Observed  Predicted 

Depression 

No Depression  Depression Percentage Correct 

Depression  No Depression  396  12  97.1 Depression  51  20  28.2 

Step 1 

Overall Percentage  86.8 a  The cut value is .500

Page 6: Binary Logistic Regression - med.swu.ac.thmed.swu.ac.th/preventive/images/CM.511/Binary_Logistic_Regression.pdf · SPSS Logistic Regression Kittipong MD,MBA,PhD 1 Binary Logistic

SPSS ­ Logistic Regression  Kittipong  MD,MBA,PhD 6 

Classification Table เปนการคํานวณความนาจะเปนของการพยากรณของ model (Predictive efficiency) โดยหาอัตราสวนระหวางคา Predicted  กับคา Observed  ไดเปน Percentage correct prediction ถามีคาสูงแสดงวา model นั้นมีความแมนยําในการพยากรณดี จากผลการ คํานวณคา Overall Percentage เทากับ 86.8% ซึ่งมากกวา 50% จึงคาดวานาจะเกิดเหตุการณนี้ 

Variables in the Equation 

B  S.E.  Wald  df  Sig.  Exp(B)  95.0% C.I.for EXP(B) 

Lower  Upper Step 1(a)  CLASS(1)  ­.647  .497  1.693  1  .193  .524  .198  1.388 

AGE  .186  .138  1.821  1  .177  1.205  .919  1.579 SEX(1)  .226  .322  .494  1  .482  1.254  .667  2.356 BMICODE  24.780  3  .000 BMICODE(1)  .039  .400  .009  1  .923  1.040  .474  2.279 BMICODE(2)  1.408  .552  6.501  1  .011  4.087  1.385  12.060 BMICODE(3)  2.130  .572  13.882  1  .000  8.416  2.744  25.808 SLEEP(1)  3.432  .547  39.330  1  .000  30.931  10.583  90.403 Constant  ­8.442  2.801  9.085  1  .003  .000 

a  Variable(s) entered on step 1: CLASS, AGE, SEX, BMICODE, SLEEP. 

Variables in the Equation ขั้นตอนนี้เปนขั้นตอนที่สองที่นําเสนอตัวแปรตนใน model ที่ใชพยากรณตัวแปรตามดวย 

วิธี Enter คา Exp(B) ในตารางคือคา Odds ratio การทดสอบปจจัยแตละตัวใช Wald test ซึ่งทา กับ [bi / SE(bi)] 2 

เมื่อพิจารณาจาก model พบวาตัวแปรตน BMICODE(2) หรือ Risk  to overweight  (ดู code จากตาราง Categorical Variables Codings ขางตน)มีภาวะซึมเศรา มากกวา BMICODE (กรณีที่ตัวแปรแบงออกมากกวา 2 คา คาที่ใชอางอิงของตัวแปรนั้นจะถูกนําเสนอในตารางดวย) หรือ Underweight เปน 4.087 เทา (95% CI: 1.385 – 12.060) อยางมีนัยสําคัญทางสถิติ และ BMICODE(3) หรือ Obesity มีภาวะซึมเศรามากกวา Underweight  เปน 8.416 เทา (95% CI: 2.744  –  25.808)  ในทํานองเดียวกันตัวแปรตน SLEEP(1)  หรือ Daytime  sleepiness  มีภาวะ ซึมเศรามากกวา SLEEP (กรณีที่ตัวแปรแบงออกเพียง 2 คา คาที่ใชอางอิงของตัวแปรนั้นจะไมถูก นําเสนอในตาราง) หรือ No daytime sleepiness เปน 30.931 เทา (95% CI: 10.583 – 90.403) อยางมีนัยสําคัญทางสถิติ

Page 7: Binary Logistic Regression - med.swu.ac.thmed.swu.ac.th/preventive/images/CM.511/Binary_Logistic_Regression.pdf · SPSS Logistic Regression Kittipong MD,MBA,PhD 1 Binary Logistic

SPSS ­ Logistic Regression  Kittipong  MD,MBA,PhD 7 

Correlation Matrix 

Constant  CLASS(1)  AGE  SEX(1)  BMICODE(1)  BMICODE(2)  BMICODE(3) SLEEP(1) Step 1  Constant  1.000  .747  ­.970  ­.220  ­.160  ­.157  ­.120  ­.186 

CLASS(1)  .747  1.000  ­.788  ­.097  ­.038  ­.111  ­.043  ­.036 AGE  ­.970  ­.788  1.000  .133  .039  .057  ­.010  .003 SEX(1)  ­.220  ­.097  .133  1.000  .176  .139  .268  ­.023 BMICODE(1)  ­.160  ­.038  .039  .176  1.000  .555  .560  .012 BMICODE(2)  ­.157  ­.111  .057  .139  .555  1.000  .431  .092 BMICODE(3)  ­.120  ­.043  ­.010  .268  .560  .431  1.000  .181 SLEEP(1)  ­.186  ­.036  .003  ­.023  .012  .092  .181  1.000 

Casewise List(b) 

Observed  Temporary Variable 

Case Selected Status(a)  Depression  Predicted 

Predicted Group  Resid  ZResid 

55  S  D**  .102  N  .898  2.971 74  S  D**  .049  N  .951  4.392 93  S  D**  .049  N  .951  4.392 206  S  D**  .008  N  .992  11.384 256  S  D**  .011  N  .989  9.635 a  S = Selected, U = Unselected cases, and ** = Misclassified cases. b  Cases with studentized residuals greater than 2.000 are listed. 

การวิเคราะห Multiple logistic regression ดวยขอมูลเดิมแตเปลี่ยนวิธีการคัดเลือกตัว แปรตนดวยวิธี Forward Stepwise ใชคําส่ัง Forward:LR เลือก Method: Forward:LR กด OK Forward Stepwise 

เปนวิธีการเลือกตัวแปรตนเขาสมการดวยวิธี Forward และ Backward อยางเปนขัน้ตอน โดยพิจารณานําเขาสมการจากอิทธิพลที่มีตอตัวแปรตามและคัดออกจากสมการตาม ระดับนัยสําคญั (significant) ที่ตั้งไวหรือถามีความสัมพนัธระหวางตัวแปรตนก็จะถูกคัด ออก (colinearity) ซึ่งมีขั้นตอนดังนี้ 

Step 1  Forward เลือกตัวแปรที่มีอิทธิพลมากที่สุดเขากอน Step 2  Forward เลือกตัวแปรที่มีอิทธิพลมากที่สุดตัวตอไป Step 3  Backward เริ่มคัดออกหลงัจากมตีัวแปรตนนําเขา 2 ตัว พิจารณาความสัมพันธระหวาง 

ตัวแปรตน (colinearity) ถามีจะคดัออก 1 ตัว เริ่มข้ันตอน Forward สลับกับขั้นตอน Backward เรื่อยไปจนไมมีการเลือกเขาและคัดออก จะได สมการ Multiple logistic regression ดวยวิธี Stepwise ตามตองการ

Page 8: Binary Logistic Regression - med.swu.ac.thmed.swu.ac.th/preventive/images/CM.511/Binary_Logistic_Regression.pdf · SPSS Logistic Regression Kittipong MD,MBA,PhD 1 Binary Logistic

SPSS ­ Logistic Regression  Kittipong  MD,MBA,PhD 8 

Logistic Regression (Output ขั้นตอนแรกจะเหมือนกับวิธี Enter) 

Block 1: Method = Forward Stepwise (Likelihood Ratio) 

Iteration History(a,b,c,d) 

Coefficients 

Iteration ­2 Log likelihood  Constant  SLEEP(1)  BMICODE(1)  BMICODE(2)  BMICODE(3) 

1  362.015  ­1.935  1.080 2  329.162  ­2.931  2.019 3  322.047  ­3.645  2.732 4  321.135  ­4.013  3.100 5  321.106  ­4.095  3.182 6  321.106  ­4.098  3.185 

Step 1 

7  321.106  ­4.099  3.185 1  345.282  ­2.093  1.087  .009  .623  1.029 2  305.070  ­3.261  2.076  .002  1.057  1.604 3  295.604  ­4.129  2.888  ­.014  1.264  1.926 4  294.305  ­4.587  3.333  ­.021  1.310  2.038 5  294.255  ­4.698  3.442  ­.022  1.313  2.054 6  294.255  ­4.704  3.448  ­.022  1.313  2.054 

Step 2 

7  294.255  ­4.704  3.448  ­.022  1.313  2.054 a  Method: Forward Stepwise (Likelihood Ratio) b  Constant is included in the model. c  Initial ­2 Log Likelihood: 401.995 d  Estimation terminated at iteration number 7 because parameter estimates changed by less than .001. 

Omnibus Tests of Model Coefficients 

Chi­square  df  Sig. Step  80.889  1  .000 Block  80.889  1  .000 

Step 1 

Model  80.889  1  .000 Step  26.851  3  .000 Block  107.740  4  .000 

Step 2 

Model  107.740  4  .000 

Model Summary 

Step ­2 Log likelihood 

Cox & Snell R Square 

Nagelkerke R Square 

1  321.106  .155  .274 2  294.255  .201  .355 

Hosmer and Lemeshow Test 

Step  Chi­square  df  Sig. 1  .000  0  . 2  1.359  4  .851

Page 9: Binary Logistic Regression - med.swu.ac.thmed.swu.ac.th/preventive/images/CM.511/Binary_Logistic_Regression.pdf · SPSS Logistic Regression Kittipong MD,MBA,PhD 1 Binary Logistic

SPSS ­ Logistic Regression  Kittipong  MD,MBA,PhD 9 

Contingency Table for Hosmer and Lemeshow Test 

Depression = No Depression 

Depression = Depression 

Observed  Expected  Observed  Expected  Total 1  241  241.000  4  4.000  245 Step 1 2  167  167.000  67  67.000  234 1  159  158.594  1  1.406  160 2  39  39.641  1  .359  40 3  43  42.765  2  2.235  45 4  113  113.406  32  31.594  145 5  38  37.359  10  10.641  48 

Step 2 

6  16  16.235  25  24.765  41 

Classification Table(a) 

Observed  Predicted 

Depression 

No Depression  Depression Percentage Correct 

Depression  No Depression  408  0  100.0 Depression  71  0  .0 

Step 1 

Overall Percentage  85.2 No Depression  392  16  96.1 Depression Depression  46  25  35.2 

Step 2 

Overall Percentage  87.1 a  The cut value is .500 

Variables in the Equation 

B  S.E.  Wald  df  Sig.  Exp(B)  95.0% C.I.for EXP(B) 

Lower  Upper Step 1(a)  SLEEP(1)  3.185  .524  36.884  1  .000  24.172  8.648  67.568 

Constant  ­4.099  .504  66.094  1  .000  .017 Step 2(b)  BMICODE  25.570  3  .000 

BMICODE(1)  ­.022  .393  .003  1  .955  .978  .453  2.111 BMICODE(2)  1.313  .542  5.870  1  .015  3.716  1.285  10.744 BMICODE(3)  2.054  .545  14.223  1  .000  7.800  2.682  22.684 SLEEP(1)  3.448  .547  39.789  1  .000  31.431  10.767  91.751 Constant  ­4.704  .625  56.670  1  .000  .009 

a  Variable(s) entered on step 1: SLEEP. b  Variable(s) entered on step 2: BMICODE. 

Correlation Matrix 

Constant  SLEEP(1)  Constant  BMICODE(1)  BMICODE(2)  BMICODE(3)  SLEEP(1) Step 1  Constant  1.000  ­.961 

SLEEP(1)  ­.961  1.000 Step 2  Constant  1.000  ­.486  ­.410  ­.507  ­.839 

BMICODE(1)  ­.486  1.000  .546  .545  .017 BMICODE(2)  ­.410  .546  1.000  .409  .081 BMICODE(3)  ­.507  .545  .409  1.000  .199 SLEEP(1)  ­.839  .017  .081  .199  1.000

Page 10: Binary Logistic Regression - med.swu.ac.thmed.swu.ac.th/preventive/images/CM.511/Binary_Logistic_Regression.pdf · SPSS Logistic Regression Kittipong MD,MBA,PhD 1 Binary Logistic

SPSS ­ Logistic Regression  Kittipong  MD,MBA,PhD 10 

Model if Term Removed 

Variable Model Log Likelihood 

Change in ­2 Log Likelihood  df 

Sig. of the Change 

Step 1  SLEEP  ­200.997  80.889  1  .000 BMICODE  ­160.553  26.851  3  .000 Step 2 SLEEP 

­190.681  87.107  1  .000 

Variables not in the Equation 

Score  df  Sig. CLASS(1)  .066  1  .797 AGE  1.556  1  .212 SEX(1)  .156  1  .693 BMICODE  30.213  3  .000 BMICODE(1)  10.185  1  .001 BMICODE(2)  5.950  1  .015 

Variables 

BMICODE(3)  21.785  1  .000 

Step 1 

Overall Statistics  32.191  6  .000 CLASS(1)  .149  1  .699 AGE  .222  1  .637 

Variables 

SEX(1)  .313  1  .576 

Step 2 

Overall Statistics  2.266  3  .519 

Casewise List(b) 

Observed  Temporary Variable 

Case Selected Status(a)  Depression  Predicted 

Predicted Group  Resid  ZResid 

74  S  D**  .066  N  .934  3.761 93  S  D**  .066  N  .934  3.761 206  S  D**  .009  N  .991  10.622 256  S  D**  .009  N  .991  10.505 a  S = Selected, U = Unselected cases, and ** = Misclassified cases. b  Cases with studentized residuals greater than 2.000 are listed. 

การวิเคราะห Multiple logistic regression ดวยขอมูลเดิมแตเปลี่ยนวิธีการคัดเลือกตัว แปรตนดวยวิธี Backward Stepwise ใชคําส่ัง Backward:LR เลือก Method: Backward:LR กด OK Backward Stepwise 

วิธีการนี้จะนําตัวแปรตนทั้งหมดใสเขาในสมการแลวคัดออกทีละตัว โดยคัดตัวแปรตนที่มี อิทธิพลต่ําที่สุดออกจากสมการ

Page 11: Binary Logistic Regression - med.swu.ac.thmed.swu.ac.th/preventive/images/CM.511/Binary_Logistic_Regression.pdf · SPSS Logistic Regression Kittipong MD,MBA,PhD 1 Binary Logistic

SPSS ­ Logistic Regression  Kittipong  MD,MBA,PhD 11 

Logistic Regression (Output ขั้นตอนแรกจะเหมือนกับวิธี Enter) 

Block 1: Method = Backward Stepwise (Likelihood Ratio) 

Iteration History(a,b,c,d) 

Iteration ­2 Log likelihood  Coefficients 

Constant  CLASS(1)  AGE  SEX(1)  BMICODE(1) BMICODE(2) BMICODE(3)  SLEEP(1) Step 1  1  343.917  ­3.693  ­.248  .080  .094  .039  .646  1.064  1.076 

2  303.025  ­6.135  ­.465  .143  .178  .054  1.109  1.667  2.056 3  293.361  ­7.676  ­.600  .177  .218  .046  1.343  2.001  2.867 4  292.033  ­8.310  ­.643  .185  .225  .040  1.403  2.115  3.315 5  291.981  ­8.436  ­.647  .186  .226  .039  1.408  2.130  3.426 6  291.981  ­8.442  ­.647  .186  .226  .039  1.408  2.130  3.432 7  291.981  ­8.442  ­.647  .186  .226  .039  1.408  2.130  3.432 

Step 2  1  344.240  ­3.567  ­.235  .077  .021  .619  1.023  1.080 2  303.507  ­5.828  ­.439  .134  .017  1.062  1.587  2.066 3  293.858  ­7.268  ­.568  .164  ­.003  1.290  1.901  2.880 4  292.532  ­7.889  ­.610  .173  ­.011  1.350  2.011  3.329 5  292.481  ­8.015  ­.614  .174  ­.012  1.356  2.025  3.439 6  292.481  ­8.021  ­.614  .174  ­.012  1.356  2.025  3.445 7  292.481  ­8.021  ­.614  .174  ­.012  1.356  2.025  3.445 

Step 3  1  345.010  ­2.594  .025  .008  .611  1.016  1.082 2  304.800  ­4.037  .039  .002  1.041  1.582  2.067 3  295.373  ­4.950  .041  ­.013  1.249  1.900  2.876 4  294.082  ­5.384  .040  ­.019  1.296  2.011  3.320 5  294.033  ­5.488  .039  ­.020  1.299  2.026  3.429 6  294.032  ­5.493  .039  ­.020  1.299  2.027  3.434 7  294.032  ­5.493  .039  ­.020  1.299  2.027  3.434 

Step 4  1  345.282  ­2.093  .009  .623  1.029  1.087 2  305.070  ­3.261  .002  1.057  1.604  2.076 3  295.604  ­4.129  ­.014  1.264  1.926  2.888 4  294.305  ­4.587  ­.021  1.310  2.038  3.333 5  294.255  ­4.698  ­.022  1.313  2.054  3.442 6  294.255  ­4.704  ­.022  1.313  2.054  3.448 7  294.255  ­4.704  ­.022  1.313  2.054  3.448 

a  Method: Backward Stepwise (Likelihood Ratio) b  Constant is included in the model. c  Initial ­2 Log Likelihood: 401.995 d  Estimation terminated at iteration number 7 because parameter estimates changed by less than .001.

Page 12: Binary Logistic Regression - med.swu.ac.thmed.swu.ac.th/preventive/images/CM.511/Binary_Logistic_Regression.pdf · SPSS Logistic Regression Kittipong MD,MBA,PhD 1 Binary Logistic

SPSS ­ Logistic Regression  Kittipong  MD,MBA,PhD 12 

Omnibus Tests of Model Coefficients 

Chi­square  df  Sig. Step  110.013  7  .000 Block  110.013  7  .000 

Step 1 

Model  110.013  7  .000 Step  ­.499  1  .480 Block  109.514  6  .000 

Step 2(a) 

Model  109.514  6  .000 Step  ­1.552  1  .213 Block  107.962  5  .000 

Step 3(a) 

Model  107.962  5  .000 Step  ­.222  1  .637 Block  107.740  4  .000 

Step 4(a) 

Model  107.740  4  .000 

a  A negative Chi­squares value indicates that the Chi­squares value has decreased from the previous step. 

Model Summary 

Step ­2 Log likelihood 

Cox & Snell R Square 

Nagelkerke R Square 

1  291.981  .205  .361 2  292.481  .204  .360 3  294.032  .202  .355 4  294.255  .201  .355 

Hosmer and Lemeshow Test 

Step  Chi­square  df  Sig. 1  7.768  8  .456 2  11.304  8  .185 3  7.741  7  .356 4  13.241  6  .039

Page 13: Binary Logistic Regression - med.swu.ac.thmed.swu.ac.th/preventive/images/CM.511/Binary_Logistic_Regression.pdf · SPSS Logistic Regression Kittipong MD,MBA,PhD 1 Binary Logistic

SPSS ­ Logistic Regression  Kittipong  MD,MBA,PhD 13 

Contingency Table for Hosmer and Lemeshow Test 

Depression = No Depression 

Depression = Depression 

Observed  Expected  Observed  Expected  Total 1  50  49.673  0  .327  50 2  38  38.691  1  .309  39 3  40  39.641  0  .359  40 4  49  49.488  1  .512  50 5  46  46.756  2  1.244  48 6  42  40.970  5  6.030  47 7  40  35.474  4  8.526  44 8  41  39.927  10  11.073  51 9  28  30.289  12  9.711  40 

Step 1 

10  34  37.091  36  32.909  70 1  43  42.852  3  3.148  46 2  39  39.301  4  3.699  43 3  51  48.756  3  5.244  54 4  39  37.678  3  4.322  42 5  50  47.735  4  6.265  54 6  49  46.554  4  6.446  53 7  37  42.422  12  6.578  49 8  38  40.509  10  7.491  48 9  34  36.846  15  12.154  49 

Step 2 

10  28  25.346  13  15.654  41 1  55  52.173  2  4.827  57 2  44  42.634  3  4.366  47 3  57  54.765  4  6.235  61 4  52  50.845  5  6.155  57 5  61  63.381  11  8.619  72 6  45  48.759  11  7.241  56 7  42  44.361  11  8.639  53 8  34  34.868  15  14.132  49 

Step 3 

9  18  16.214  9  10.786  27 1  54  50.944  2  5.056  56 2  57  55.030  4  5.970  61 3  44  48.311  10  5.689  54 4  58  56.845  6  7.155  64 5  67  63.381  5  8.619  72 6  43  45.361  9  6.639  52 7  35  39.986  13  8.014  48 

Step 4 

8  50  48.143  22  23.857  72

Page 14: Binary Logistic Regression - med.swu.ac.thmed.swu.ac.th/preventive/images/CM.511/Binary_Logistic_Regression.pdf · SPSS Logistic Regression Kittipong MD,MBA,PhD 1 Binary Logistic

SPSS ­ Logistic Regression  Kittipong  MD,MBA,PhD 14 

Classification Table(a) Observed  Predicted 

Depression No Depression  Depression 

Percentage Correct 

Depression  No Depression  396  12  97.1 Depression  51  20  28.2 

Step 1 

Overall Percentage  86.8 No Depression  397  11  97.3 Depression Depression  53  18  25.4 

Step 2 

Overall Percentage  86.6 No Depression  393  15  96.3 Depression Depression  51  20  28.2 

Step 3 

Overall Percentage  86.2 No Depression  392  16  96.1 Depression Depression  46  25  35.2 

Step 4 

Overall Percentage  87.1 a  The cut value is .500 

Variables in the Equation 

B  S.E.  Wald  df  Sig.  Exp(B)  95.0% C.I.for EXP(B) 

Lower  Upper Step 1(a) CLASS(1)  ­.647  .497  1.693  1  .193  .524  .198  1.388 

AGE  .186  .138  1.821  1  .177  1.205  .919  1.579 SEX(1)  .226  .322  .494  1  .482  1.254  .667  2.356 BMICODE  24.780  3  .000 BMICODE(1)  .039  .400  .009  1  .923  1.040  .474  2.279 BMICODE(2)  1.408  .552  6.501  1  .011  4.087  1.385  12.060 BMICODE(3)  2.130  .572  13.882  1  .000  8.416  2.744  25.808 SLEEP(1)  3.432  .547  39.330  1  .000  30.931  10.583  90.403 Constant  ­8.442  2.801  9.085  1  .003  .000 

Step 2(a) CLASS(1)  ­.614  .492  1.555  1  .212  .541  .206  1.421 AGE  .174  .136  1.633  1  .201  1.190  .911  1.553 BMICODE  24.434  3  .000 BMICODE(1)  ­.012  .394  .001  1  .975  .988  .457  2.138 BMICODE(2)  1.356  .545  6.182  1  .013  3.879  1.332  11.294 BMICODE(3)  2.025  .551  13.517  1  .000  7.580  2.575  22.316 SLEEP(1)  3.445  .547  39.675  1  .000  31.343  10.730  91.557 Constant  ­8.021  2.717  8.713  1  .003  .000 

Step 3(a) AGE  .039  .084  .222  1  .637  1.040  .883  1.225 BMICODE  24.402  3  .000 BMICODE(1)  ­.020  .393  .003  1  .959  .980  .454  2.116 BMICODE(2)  1.299  .542  5.732  1  .017  3.665  1.266  10.612 BMICODE(3)  2.027  .548  13.671  1  .000  7.590  2.592  22.224 SLEEP(1)  3.434  .547  39.487  1  .000  31.010  10.624  90.513 Constant  ­5.493  1.794  9.377  1  .002  .004 

Step 4(a) BMICODE  25.570  3  .000 BMICODE(1)  ­.022  .393  .003  1  .955  .978  .453  2.111 BMICODE(2)  1.313  .542  5.870  1  .015  3.716  1.285  10.744 BMICODE(3)  2.054  .545  14.223  1  .000  7.800  2.682  22.684 SLEEP(1)  3.448  .547  39.789  1  .000  31.431  10.767  91.751 Constant  ­4.704  .625  56.670  1  .000  .009 

a  Variable(s) entered on step 1: CLASS, AGE, SEX, BMICODE, SLEEP.

Page 15: Binary Logistic Regression - med.swu.ac.thmed.swu.ac.th/preventive/images/CM.511/Binary_Logistic_Regression.pdf · SPSS Logistic Regression Kittipong MD,MBA,PhD 1 Binary Logistic

SPSS ­ Logistic Regression  Kittipong  MD,MBA,PhD 15 

Correlation Matrix 

Model if Term Removed 

Variable Model Log Likelihood 

Change in ­2 Log Likelihood  df 

Sig. of the Change 

CLASS  ­146.837  1.693  1  .193 AGE  ­146.899  1.816  1  .178 SEX  ­146.240  .499  1  .480 BMICODE  ­159.025  26.069  3  .000 

Step 1 

SLEEP  ­188.596  85.210  1  .000 CLASS  ­147.016  1.552  1  .213 AGE  ­147.052  1.624  1  .203 BMICODE  ­159.044  25.607  3  .000 

Step 2 

SLEEP  ­189.382  86.284  1  .000 AGE  ­147.127  .222  1  .637 BMICODE  ­159.778  25.523  3  .000 

Step 3 

SLEEP  ­190.048  86.064  1  .000 BMICODE  ­160.553  26.851  3  .000 Step 4 SLEEP  ­190.681  87.107  1  .000 

Constant  CLASS(1)  AGE  SEX(1)  BMICODE(1) BMICODE(2) BMICODE(3)  SLEEP(1) Step 1  Constant  1.000  .747  ­.970  ­.220  ­.160  ­.157  ­.120  ­.186 

CLASS(1)  .747  1.000  ­.788  ­.097  ­.038  ­.111  ­.043  ­.036 AGE  ­.970  ­.788  1.000  .133  .039  .057  ­.010  .003 SEX(1)  ­.220  ­.097  .133  1.000  .176  .139  .268  ­.023 BMICODE(1)  ­.160  ­.038  .039  .176  1.000  .555  .560  .012 BMICODE(2)  ­.157  ­.111  .057  .139  .555  1.000  .431  .092 BMICODE(3)  ­.120  ­.043  ­.010  .268  .560  .431  1.000  .181 SLEEP(1)  ­.186  ­.036  .003  ­.023  .012  .092  .181  1.000 

Step 2  Constant  1.000  .745  ­.973  ­.127  ­.129  ­.069  ­.200 CLASS(1)  .745  1.000  ­.784  ­.019  ­.096  ­.020  ­.040 AGE  ­.973  ­.784  1.000  .017  .036  ­.044  .010 BMICODE(1)  ­.127  ­.019  .017  1.000  .545  .539  .015 BMICODE(2)  ­.129  ­.096  .036  .545  1.000  .413  .100 BMICODE(3)  ­.069  ­.020  ­.044  .539  .413  1.000  .192 SLEEP(1)  ­.200  ­.040  .010  .015  .100  .192  1.000 

Step 3  Constant  1.000  ­.937  ­.177  ­.095  ­.083  ­.251 AGE  ­.937  1.000  .008  ­.052  ­.098  ­.043 BMICODE(1)  ­.177  .008  1.000  .545  .541  .017 BMICODE(2)  ­.095  ­.052  .545  1.000  .411  .085 BMICODE(3)  ­.083  ­.098  .541  .411  1.000  .199 SLEEP(1)  ­.251  ­.043  .017  .085  .199  1.000 

Step 4  Constant  1.000  ­.486  ­.410  ­.507  ­.839 BMICODE(1)  ­.486  1.000  .546  .545  .017 BMICODE(2)  ­.410  .546  1.000  .409  .081 BMICODE(3)  ­.507  .545  .409  1.000  .199 SLEEP(1)  ­.839  .017  .081  .199  1.000

Page 16: Binary Logistic Regression - med.swu.ac.thmed.swu.ac.th/preventive/images/CM.511/Binary_Logistic_Regression.pdf · SPSS Logistic Regression Kittipong MD,MBA,PhD 1 Binary Logistic

SPSS ­ Logistic Regression  Kittipong  MD,MBA,PhD 16 

Variables not in the Equation 

Score  df  Sig. Variables  SEX(1)  .495  1  .482 Step 2(a) Overall Statistics  .495  1  .482 

CLASS(1)  1.562  1  .211 Variables SEX(1)  .356  1  .551 

Step 3(b) 

Overall Statistics 2.041  2  .360 

CLASS(1)  .149  1  .699 AGE  .222  1  .637 

Variables 

SEX(1)  .313  1  .576 

Step 4(c) 

Overall Statistics  2.266  3  .519 a  Variable(s) removed on step 2: SEX. b  Variable(s) removed on step 3: CLASS. c  Variable(s) removed on step 4: AGE. 

Casewise List(b) 

Observed  Temporary Variable 

Case Selected Status(a)  Depression  Predicted 

Predicted Group  Resid  ZResid 

74  S  D**  .066  N  .934  3.761 93  S  D**  .066  N  .934  3.761 206  S  D**  .009  N  .991  10.622 256  S  D**  .009  N  .991  10.505 a  S = Selected, U = Unselected cases, and ** = Misclassified cases. b  Cases with studentized residuals greater than 2.000 are listed.