
/*
Binary Regression Examples
FILE: Binary-Reg-Examples.doc
Examples (modified)
from Piegorsch and Bailer (2005)
ANALYZING ENVIRONMENTAL DATA
Wiley
*/
*====================================================================;
* SAS code to find LC50;
* logistic regression specified by d=logistic option;
data copper;
input conc ydead @@;
N = 20;
logconc = log(conc);
obs_prob = ydead/N;
datalines;
0.1 2 0.2 2 0.3 5 0.5 8
1.0 15 2.0 15 2.5 17
proc probit data=copper;
model ydead/N = logconc / d=logistic inversecl;
output out=copper_out p=pred_prob;
run;
proc gplot data=copper_out;
plot obs_prob*logconc pred_prob*logconc/overlay;
run;
*====================================================================;
* SAS code to fit logit, probit and CLL links;
data grndwtr;
input landuse $ sewer $ nitrate chloride ytce N @@;
datalines;
Unde yes 1.0 10 0 17 Unde no 0.8 17 0 59
Agrc yes 0.9 9 0 7 Agrc no 7.0 20 2 48
LowR yes 1.6 6 0 5 LowR no 3.5 14 2 21
MedR yes 3.9 18 12 43 MedR no 2.6 15 5 86
HigR yes 5.2 33 33 76 HigR no 4.2 18 1 17
Recr yes 2.3 16 3 26 Recr no 1.7 11 4 38
Inst yes 3.3 36 8 32 Inst no 0.9 11 0 22
Tran yes 4.0 66 7 29 Tran no 1.3 12 1 30
Comm yes 4.3 24 20 42 Comm no 1.1 30 0 7
Indu yes 3.7 23 17 33 Indu no 2.2 19 3 12
* fit logit link via PROC GENMOD;
proc genmod;
title "*********************logit link*********************";
class landuse sewer;
model ytce/N = landuse sewer nitrate chloride
/ dist=binomial link=logit expected;
* fit probit link via PROC GENMOD;
proc genmod;
title "*********************probit link*********************";