options ls=60 ps=60 nodate nonumber;
data donnees;
input X1 X2 X3 X4 Y $ num $;
cards;
-0.4485 -0.4106 1.0865 0.4526 1 1-
-0.5633 -0.3114 1.5134 0.1642 1 2-
0.0643 0.0156 1.0077 0.3978 1 3-
-0.0721 -0.0930 1.4544 0.2589 1 4-
-0.1002 -0.0917 1.5644 0.6683 1 5-
-0.1421 -0.0651 0.7066 0.2794 1 6-
0.0351 0.0147 1.5046 0.7080 1 7-
-0.0653 -0.0566 1.3737 0.4032 1 8-
0.0724 -0.0076 1.3723 0.3361 1 9-
-0.1353 -0.1433 1.4196 0.4347 1 10-
-0.2298 -0.2961 0.3310 0.1824 1 11-
0.0713 0.0205 1.3124 0.2497 1 12-
0.0109 0.0011 2.1495 0.6969 1 13-
-0.2777 -0.2316 1.1918 0.6601 1 14-
0.1454 0.0500 1.8762 0.2723 1 15-
0.3703 0.1098 1.9941 0.3828 1 16-
-0.0757 -0.0821 1.5077 0.4215 1 17-
0.0451 0.0263 1.6756 0.9494 1 18-
0.0115 -0.0032 1.2602 0.6038 1 19-
0.1227 0.1055 1.1434 0.1655 1 20-
-0.2843 -0.2703 1.2722 0.5128 1 21-
0.5135 0.1001 2.4871 0.5368 2 22+
0.0769 0.0195 2.0069 0.5304 2 23+
0.3776 0.1075 3.2651 0.3548 2 24+
0.1933 0.0473 2.2506 0.3309 2 25+
0.3248 0.0718 4.2401 0.6279 2 26+
0.3132 0.0511 4.4500 0.6852 2 27+
0.1184 0.0499 2.5210 0.6925 2 28+
-0.0173 0.0233 2.0538 0.3484 2 29+
0.2169 0.0779 2.3489 0.3970 2 30+
0.1703 0.0695 1.7973 0.5174 2 31+
0.1460 0.0518 2.1692 0.5500 2 32+
-0.0985 -0.0123 2.5029 0.5778 2 33+
0.1398 -0.0312 0.4611 0.2643 2 34+
0.1379 0.0728 2.6123 0.5151 2 35+
0.1486 0.0564 2.2347 0.5563 2 36+
0.1633 0.0486 2.3080 0.1978 2 37+
0.2907 0.0597 1.8381 0.3786 2 38+
0.5383 0.1064 2.3293 0.4835 2 39+
-0.3330 -0.0854 3.0124 0.4730 2 40+
0.4785 0.0910 1.2444 0.1847 2 41+
0.5603 0.1112 4.2918 0.4443 2 42+
0.2029 0.0792 1.9936 0.3018 2 43+
0.4746 0.1380 2.9166 0.4487 2 44+
0.1661 0.0351 2.4527 0.1370 2 45+
0.5808 0.0371 5.0594 0.1268 2 46+
;
run;
proc print data=donnees;
data donnees;
set donnees;
if Y=1 then Y='Faillite';
if Y=2 then Y='OK';
run;
proc print data=donnees;
run;
/************************************************/
/* QUESTION 1 */
/***********************************************/
proc logistic data=donnees simple;
model Y= X1 X2 X3 X4;
run;
/***********************************************************/
/* QUESTION 2 */
/***********************************************************/
proc logistic data=donnees ;
model Y= X1 X2 X3 X4 /selection=backward;
output out=stat;
run;
/***********************************************************/
/* QUESTION 3 */
/***********************************************************/
proc logistic data=donnees;
model Y=X1 X2 X3 X4 ;
test X2=X4=0;
run;
/***********************************************************/
/* QUESTION 4 */
/***********************************************************/
proc logistic data=donnees;
model Y=X1 X3 / lackfit;
run;
/***********************************************************/
/* QUESTION 5 */
/***********************************************************/
data a;
set donnees;
If y=1 then label='-';
else label='+';
x5=(5.9674/3.0322)-(6.5887/3.0322)*X1;
proc plot data=a;
plot X3*X1=Y
X5*X1='*' / overlay;
run;
quit;
proc plot data=a;
plot X3*X1= ''$ num
X5*X1='*' / overlay;
run;
data q5;
set donnees;
i=num;
proba1=(-5.9674+6.5887*X1)/(-3.0322);
output;
run;
proc print data=q5;
run;
proc plot data=q5;
plot proba1*X1='.' X3*X1='' $ i / overlay ;
run;
quit;
/************************************************************/
/* QUESTIONS 6,7 et 8 */
/************************************************************/
data donnees1;
X1=0.1;
X2=0;
X3=2;
X4=0.4;
run;
data donnees1;
set donnees donnees1;
run;
proc print data=donnees1;
run;
proc logistic data=donnees1;
model Y= X1 X3 / ctable;
output out=out xbeta=xbeta stdxbeta=stdxbeta predicted=predicted lower=lower upper=upper reschi=reschi
resdev=resdev ;
run;
proc print data=out;
run;
/**************************************************************/
/* QUESTION 9 */
/*************************************************************/
proc logistic data=donnees1;
model Y=X3;
output out=out1 xbeta=xbeta1 stdxbeta=stxbeta1 predicted=pred1 lower=lower1 upper=upper1 reschi=reschi1
resdev=resdev1;
run;
proc print data=out1;
run;
symbol1 i=none v=. c=blue;
symbol2 i=none v=. c=red;
proc gplot data=out1;
plot pred1*X3=1 lower1*X3=2 upper1*X3=2 /overlay;
run;
quit;