1、利用逻辑斯回归分析利用逻辑斯回归分析第12週講義 (12- 1 ) 利用邏輯斯迴歸分析 (Logistic Regression Analysis)作分類分析 Binary Response with one explanatory variable: :Response of the th sampling unit iYi= Y0or1i:predictor (explanatory variable) for the th sampling unit iXi,,xeP=P(Y =1| x) = x,,,x1,ePx,,,xloglogit P = = x1,Px,x若令P= P(Y =0
2、| x) ,則 logit P =。 xx,,xeP(y =1| x) =之圖形 ,,,x1,e,0,1,0,1 估計法:最大概似估計量或加權最小平方法。 對X=x有n個中c個反應變數為1。 iii:A:最大概似估計法 kn,n,ciciii,,概似函數 p1,p ,xx,iic1i,i,c,nci,,xiikin,e1,i, = ,,L,,,xx,iic1e1e,,1i,i, 找出使得以上之機率為最大。 :B:Weighted LSE (least square estimator) cciin,(1)np(1,p) c之Var(c)= 用 來估計 iiiixxiinnii1 給予權數:加權
3、數,加重數:。 Var ci第12週講義 (12- 2 ) Binary Response with several explanatory variables: 1,: the response of th individual, binary response i,YY,ii0,: p dim vector of covariate XX,(X,X,.,X)ii1i2ipiP,P(Y,1|X)iiiLogistic Regression model ,logitP,,X,.,X011iippiPlogitP,log1,P,,.,XX011ippie i.e.P,i,,,,.,,XX011i
4、ppi1,e,logitP(Y,1|X,r,1),logitP(Y,1|X,r)iiiiiP(Y,1|X,r,1)/P(Y,0|X,r,1)iiii,lnP(Y,1|X,r)/P(Y,0|X,r)iiii: log odds ratio corresponding to a unit change in predictor when all other are X,Xjiihold constants. ,2,G:H:,.,0(model0)p012,H:logitP,,X,.,Xiippi1011maxLikelihoodLH00LR,2logLR,2(logL,logL),,2logL,2
5、logLmm00maxLikelihoodLm,22G,2ln(LR)p故其值其值,以表示所選擇變數之相關重要性,2,D:(deviance)H:logitP,,X,.,Xpp0011H:saturatedmodel(models)1,2logLR,,2logL,2logLsm22,D,2ln(LR),np1故其值其值,表示fit好22G,D,2logL,2logLs0,H:logitP,0022,G,D,constant,之,2ln(LR) ,H:saturated1,第12週講義 (12- 3 ) Logistic Regression with One Continuous Covari
6、ate The SAS System 程式: The LOGISTIC Procedure options nodate nonotes; Data Set: WORK.P261 data p261; Response Variable (Events): C Response Profile input load n c;r=c/n; Response Variable (Trials): N Ordered Binary cards; Number of Observations: 10 Value Outcome Count 2500 50 10 Link Function: Logit
7、 1 EVENT 337 2700 70 17 2 NO EVENT 353 2900 100 30 Model Fitting Information and Testing 3100 60 21 Global Null Hypothesis BETA=0 3300 40 18 Intercept 3500 85 43 Intercept and 3700 90 54 Criterion Only Covariates Chi-Square for Covariates 3900 50 33 AIC 958.172 847.712 . 4100 80 60 SC 962.709 856.78
8、5 . 4300 65 51 -2 LOG L 956.172 843.712 112.460 with 1 DF (p=0.0001) ; Score . . 107.066 with 1 DF (p=0.0001) proc logistic; model c/n=load; Analysis of Maximum Likelihood Estimates output out=a Parameter Standard Wald Pr pred=pred; Variable DF Estimate Error Chi-Square Chi-Square run; INTERCPT 1 -5
9、.3397 0.5457 95.7500 0.0001 . . proc print; LOAD 1 0.00155 0.000158 96.6085 0.0001 run; Odds Ratio Estimates Point 95% Wald Effect Estimate Confidence Limits load 1.002 1.001 1.002 Association of Predicted Probabilities and Observed Responses Percent Concordant 68.0 Somers D 0.452 Percent Discordant
10、 22.9 Gamma 0.497 Percent Tied 9.1 Tau-a 0.226 Pairs 118961 c 0.726 Association of Predicted Probabilities and Observed Responses Concordant = 68.0% Somers D = 0.452 Discordant = 22.9% Gamma = 0.497 Tied = 9.1% Tau-a = 0.226 (118961 pairs) c = 0.726 OBS LOAD N C R PRED 1 2500 50 10 0.20000 0.18715 2
11、 2700 70 17 0.24286 0.23886 3 2900 100 30 0.30000 0.29959 4 3100 60 21 0.35000 0.36829 5 3300 40 18 0.45000 0.44278 6 3500 85 43 0.50588 0.51994 7 3700 90 54 0.60000 0.59616 8 3900 50 33 0.66000 0.66801 9 4100 80 60 0.75000 0.73280 10 4300 65 51 0.78462 0.78894 第12週講義 (12- 4 ) Logistic Regression wi
12、th Mixed Covariate Data crab; input color spine width satell weight; if satell0 then y=1; if satell=0 then y=0; n=1; weight = weight/1000; color=color-1; cards; 3 3 28.3 8 3050 4 3 22.5 0 1550 2 1 26.0 9 2300 . . 5 3 27.0 0 2625 3 2 24.5 0 2000 ; proc genmod; class color; model y/n = color width / d
13、ist=bin link=logit; proc logistic; model y = color weight width / selection=backward; run; PART OF OUTPUT: The GENMOD Procedure Model Information Data Set WORK.CRAB Distribution Binomial Link Function Logit Response Variable (Events) y Response Variable (Trials) n Observations Used 173 Number Of Eve
14、nts 111 Number Of Trials 173 Class Level Information Class Levels Values color 4 1 2 3 4 Criteria For Assessing Goodness Of Fit Criterion DF Value Value/DF Deviance 168 187.4570 1.1158 Scaled Deviance 168 187.4570 1.1158 Pearson Chi-Square 168 168.6590 1.0039 Scaled Pearson X2 168 168.6590 1.0039 Lo
15、g Likelihood -93.7285 Algorithm converged. Analysis Of Parameter Estimates Standard Wald 95% Confidence Chi- Parameter DF Estimate Error Limits Square Pr ChiSq Intercept 1 -12.7151 2.7618 -18.1281 -7.3021 21.20 .0001 color 1 1 1.3299 0.8525 -0.3410 3.0008 2.43 0.1188 color 2 1 1.4023 0.5484 0.3274 2
16、.4773 6.54 0.0106 color 3 1 1.1061 0.5921 -0.0543 2.2666 3.49 0.0617 color 4 0 0.0000 0.0000 0.0000 0.0000 . . width 1 0.4680 0.1055 0.2611 0.6748 19.66 ChiSq Likelihood Ratio 37.8336 3 .0001 Score 33.3887 3 .0001 Wald 27.8855 3 ChiSq Likelihood Ratio 36.6373 2 .0001 Score 32.7358 2 .0001 Wald 27.06
17、09 2 ChiSq 1.2031 1 0.2727 NOTE: No (additional) effects met the 0.05 significance level for removal from the model. Summary of Backward Elimination Effect Number Wald Step Removed DF In Chi-Square Pr ChiSq 1 weight 1 2 1.1778 0.2778 The LOGISTIC Procedure Analysis of Maximum Likelihood Estimates Standard Wald Parameter DF Estimate Error Chi-Square Pr ChiSq Intercept 1 10.0708 2.8069 12.8733 0.0003 color 1 0.5090 0.2237 5.1791 0.0229 width 1 -0.4583 0.1040 19.4129 .0001 Odds Ratio Estimates Point 95% Wald Effect Estimate Confidence Limits color 1.664 1.073 2.579 width 0.632 0.516 0.775
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1