1、Freq count;Class drug/param=ref descending;Model response=drug degree/rsq scale=n aggregate;Run;Rsq显示R2Scale, SCALE= species method to correct overdispersion,指定参数,=n表示不需要修正。Aggregate计算卡方检验统计量Class 语句将分类变量化成虚拟变量,三种药用两个虚拟变量表示。The LOGISTIC ProcedureModel InformationData Set WORK.EX12_1Response Variable
2、 responseNumber of Response Levels 2Frequency Variable countModel binary logitOptimization Technique Fishers scoringNumber of Observations Read 12Number of Observations Used 12Sum of Frequencies Read 577Sum of Frequencies Used 577Response ProfileOrdered TotalValue response Frequency1 1 3152 0 262Pro
3、bability modeled is response=1.Class Level InformationDesignClass Value Variablesdrug 2 1 01 0 10 0 0Model Convergence StatusConvergence criterion (GCONV=1E-8) satisfied.Deviance and Pearson Goodness-of-Fit StatisticsCriterion Value DF Value/DF Pr ChiSqDeviance 0.3749 2 0.1874 0.8291Pearson 0.3689 2
4、 0.1844 0.8316模型拟合集优度检验,Number of unique profiles: 6Model Fit Statistics Intercept Intercept andCriterion Only CovariatesAIC 797.017 641.326SC 801.375 658.757-2 Log L 795.017 633.326R-Square 0.2444 Max-rescaled R-Square 0.3268Testing Global Null Hypothesis: BETA=0Test Chi-Square DF Pr Likelihood Rat
5、io 161.6907 3 .0001Score 148.1598 3 Wald 118.1394 3 drug 2 95.0859 degree 1 47.4607 Intercept 1 -1.9594 0.2229 77.2441 drug 2 1 1.8342 0.2406 58.0936 drug 1 1 2.2850 0.2479 84.9472 degree 1 1.3806 0.2004 47.4607 Likelihood Ratio 11.6428 2 0.0030 Score 15.1091 2 0.0005 Wald 13.0315 2 0.0015模型检验似然比检验(
6、likelihood ratiotest)、计分检验(score test)、Wald检验(Wald test)三种 Analysis of Maximum Likelihood EstimatesStandard WaldIntercept 1 -5.5592 1.1197 24.6503 Heat 1 0.0820 0.0237 11.9454 0.0005Soak 1 0.0568 0.3312 0.0294 0.8639系数检验 Odds Ratio Estimates Point 95% Wald Effect Estimate Confidence Limits Heat 1.08
7、5 1.036 1.137 Soak 1.058 0.553 2.026 Association of Predicted Probabilities and Observed Responses Percent Concordant 64.4 Somers D 0.460 Percent Discordant 18.4 Gamma 0.555 Percent Tied 17.2 Tau-a 0.028 Pairs 4500 c 0.730Using the parameter estimates, you can calculate the estimated logit of as Log
8、it(p)=log(p/1-p)=-5.5592+0.082 Heat+0.0568 Soak If Heat=7 and Soak=1, then logit(p)=-4.92584. Using this logit estimate, you can calculate as follows:P=1/(1+e4.9284)=0.0072Y表示骑车上班(Y=1bike,Y=0,BUS),X1年龄,X2月收入,X3性别(1男,0女)X3X1X2y18850211200231950283136150042100046485518005621005820252713003032333841455
9、2Data p256;Input X3 X1 X2 y;0 18 850 00 21 1200 00 23 850 10 23 950 10 28 1200 10 31 850 00 36 1500 10 42 1000 10 46 950 10 48 1200 00 55 1800 10 56 2100 10 58 1800 11 18 850 01 20 1000 01 25 1200 01 27 1300 01 28 1500 01 30 950 11 32 1000 01 33 1800 01 33 1000 01 38 1200 01 41 1500 01 45 1800 11 48
10、 1000 01 52 1500 11 56 1800 1Proc logistic data=p256 descending ;Model y=x1-x3;output out=pred p=phat lower=lcl upper=uclpredprobs=(individual crossvalidate);proc print data=pred; Data Set WORK.P256 Response Variable y Number of Response Levels 2 Number of Observations Read 28 Number of Observations
11、 Used 28 Ordered Total Value y Frequency 1 0 15 2 1 13 Probability modeled is y=0. AIC 40.673 33.971 SC 42.005 39.299 -2 Log L 38.673 25.971 Likelihood Ratio 12.7026 3 0.0053 Score 10.4135 3 0.0154 Wald 6.5331 3 0.0884Intercept 1 3.6547 2.0911 3.0545 0.0805X1 1 -0.0822 0.0521 2.4853 0.1149X2 1 -0.00
12、152 0.00187 0.6613 0.4161X3 1 2.5016 1.1578 4.6689 0.0307 X1 0.921 0.832 1.020 X2 0.998 0.995 1.002 X3 12.203 1.262 118.014 Percent Concordant 87.2 Somers D 0.744 Percent Discordant 12.8 Gamma 0.744 Percent Tied 0.0 Tau-a 0.384 Pairs 195 c 0.872序号样品数W其中有房屋数收 入(千元)10.01.52.0220.03.23.0325.04.0430.05.
13、0540.08.06.0650.012.0760.018.0880.028.013.09100.045.015.01070.036.01165.039.01233.01335.0141527.01638.01748.058.0Data ex1;Input no n n1 x;1 10.0 1.5 2.02 20.0 3.2 3.03 25.0 4.0 4.04 30.0 5.0 5.05 40.0 8.0 6.06 50.0 12.0 8.07 60.0 18.0 10.08 80.0 28.0 13.09 100.0 45.0 15.010 70.0 36.0 20.011 65.0 39.0 25.012 50.0 33.0 30.013 40.0 30.0 35.014 25.0 20.0 40.015 30.0 27.0 50.016 40.0 38.0 60.017 50.0 48.0 70.018 60.0 58.0 80.0Proc logistic data=ex1;Model n1/n=x;
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1