180 likes | 300 Vues
This document provides a comprehensive SAS program for performing logistic regression analysis using two datasets. The first dataset, logitex1, involves calculating the probability of success and generating weights for each observation before fitting a logistic regression model. The second dataset, logitex2, applies a stepwise selection method to identify significant predictors for the response variable. The results include both the weighted least squares estimates and the final logistic regression model outputs, helping statisticians and data analysts interpret the findings effectively.
E N D
SAS程序 data logitex1; input x n m; cards; 1.5 25 8 2.5 32 13 3.5 58 26 4.5 52 22 5.5 43 20 6.5 39 22 7.5 28 16 8.5 21 12 9.5 15 10 ; run;
data logitex1i; set logitex1; p=m/n; q=log(p/(1-p)); w=n*p*(1-p); run; procprint data=logitex1i; run; procreg data=logitex1i; model q=x; run; procglm data=logitex1i; model q=x; weight w; run; proclogistic data=logitex1; model m/n=x; run;
SAS程序 data logitex2; input x3 x1 x2 y; cards; 0 18 850 0 0 21 1200 0 0 23 850 1 0 23 950 1 0 28 1200 1 0 31 850 0 0 36 1500 1 0 42 1000 1 0 46 950 1 0 48 1200 0 0 55 1800 1 0 56 2100 1 0 58 1800 1 1 18 850 0 1 20 1000 0 1 25 1200 0 1 27 1300 0 1 28 1500 0
1 30 950 1 1 32 1000 0 1 33 1800 0 1 33 1800 1 1 33 1000 0 1 38 1200 0 1 41 1500 0 1 45 1800 1 1 48 1000 0 1 52 1500 1 1 56 1800 1 ; run; proclogistic data=logitex2; model y=x1 x2 x3/selection=stepwise; run;