Unformatted text preview:

EXST7034 : Regression Techniques Geaghan Logistic regression Page 1 1 ***********************************************************************; 2 *** EXST7034 Homework Example ***; 3 *** Problem from Neter, Kutner, Nachtsheim, Wasserman 1996,14.9 ***; 4 ***********************************************************************; 5 6 dm'log;clear;output;clear'; 7 options nodate nocenter nonumber ps=512 ls=132 nolabel; 8 ODS HTML style=minimal rs=none body='C:\Geaghan\Current\EXST7034\Fall2005\SAS\Toxicity01.html' ; NOTE: Writing HTML Body file: C:\Geaghan\Current\EXST7034\Fall2005\SAS\Toxicity01.html 9 10 DATA Toxicity indicator; INFILE CARDS MISSOVER; 11 TITLE1 'Logistic regression : Toxicity experiment'; 12 LABEL X = 'Dose level (log scale)'; 13 LABEL R = 'No of insects which died'; 14 LABEL N = 'No of insects exposed'; 15 LABEL P = 'Mortality proportion'; 16 INPUT X R N; 17 P = R / N; 18 LOGIT = LOG(P/(1-P)); 19 WT = N*P*(1-P); 20 output toxicity; 21 indicator = 1; output indicator; 22 R = N - R; indicator = 0; output indicator; 23 *** NOTE: expected variance of P is 1/(n*p*(1-p)) ***; 24 CARDS; NOTE: The data set WORK.TOXICITY has 6 observations and 7 variables. NOTE: The data set WORK.INDICATOR has 12 observations and 7 variables. NOTE: DATA statement used (Total process time): real time 0.03 seconds cpu time 0.03 seconds 24 ! RUN; 31 ; 32 PROC PRINT DATA=toxicity; VAR X R N P; 33 TITLE2 'Sorted Raw Data Listing : original data'; RUN; NOTE: There were 6 observations read from the data set WORK.TOXICITY. NOTE: The PROCEDURE PRINT printed page 1. NOTE: PROCEDURE PRINT used (Total process time): real time 0.11 seconds cpu time 0.00 seconds 34 PROC PRINT DATA=indicator; VAR X R N P indicator; 35 TITLE2 'Sorted Raw Data Listing : with indicator variable'; RUN; NOTE: There were 12 observations read from the data set WORK.INDICATOR. NOTE: The PROCEDURE PRINT printed page 2. NOTE: PROCEDURE PRINT used (Total process time): real time 0.05 seconds cpu time 0.01 seconds Logistic regression : Toxicity experiment Sorted Raw Data Listing : original data Obs X R N P 1 1 28 250 0.112 2 2 53 250 0.212 3 3 93 250 0.372 4 4 126 250 0.504 5 5 172 250 0.688 6 6 197 250 0.788 Logistic regression : Toxicity experiment Sorted Raw Data Listing : with indicator Obs X R N P indicator 1 1 28 250 0.112 1 2 1 222 250 0.112 0 3 2 53 250 0.212 1 4 2 197 250 0.212 0 5 3 93 250 0.372 1 6 3 157 250 0.372 0 7 4 126 250 0.504 1 8 4 124 250 0.504 0 9 5 172 250 0.688 1 10 5 78 250 0.688 0 11 6 197 250 0.788 1 12 6 53 250 0.788 0EXST7034 : Regression Techniques Geaghan Logistic regression Page 2 37 PROC REG DATA=toxicity; 38 TITLE2 'Using PROC REG'; 39 TITLE3 'As a Simple linear regression with proportion'; 40 MODEL P = X; 41 output out=next1 p=pred1 r=resid1; 42 RUN; 42 ! QUIT; NOTE: The data set WORK.NEXT1 has 6 observations and 9 variables. NOTE: The PROCEDURE REG printed page 3. NOTE: PROCEDURE REG used (Total process time): real time 0.11 seconds cpu time 0.05 seconds Logistic regression : Toxicity experiment Using PROC REG As a Simple linear regression with proportion The REG Procedure Model: MODEL1 Dependent Variable: P Number of Observations Read 6 Number of Observations Used 6 Analysis of Variance Sum of Mean Source DF Squares Square F Value Pr > F Model 1 0.34862 0.34862 677.88 <.0001 Error 4 0.00206 0.00051429 Corrected Total 5 0.35068 Root MSE 0.02268 R-Square 0.9941 Dependent Mean 0.44600 Adj R-Sq 0.9927 Coeff Var 5.08472 Parameter Estimates Parameter Standard Variable DF Estimate Error t Value Pr > |t| Intercept 1 -0.04800 0.02111 -2.27 0.0854 X 1 0.14114 0.00542 26.04 <.0001 44 PROC REG DATA=indicator; freq R; 45 TITLE3 'As a Simple linear regression with indicator variable'; 46 MODEL indicator = X; 47 output out=next2 p=pred2 r=resid2; 48 RUN; 48 ! QUIT; NOTE: The data set WORK.NEXT2 has 12 observations and 9 variables. NOTE: The PROCEDURE REG printed page 4. NOTE: PROCEDURE REG used (Total process time): real time 0.13 seconds cpu time 0.05 seconds Logistic regression : Toxicity experiment Using PROC REG As a Simple linear regression with indicator variable The REG Procedure Model: MODEL1 Dependent Variable: indicator Number of Observations Read 12 Number of Observations Used 12 Sum of Frequencies Read 1500 Sum of Frequencies Used 1500EXST7034 : Regression Techniques Geaghan Logistic regression Page 3 Frequency: R Analysis of Variance Sum of Mean Source DF Squares Square F Value Pr > F Model 1 87.15571 87.15571 460.57 <.0001 Error 1498 283.47029 0.18923 Corrected Total 1499 370.62600 Root MSE 0.43501 R-Square 0.2352 Dependent Mean 0.44600 Adj R-Sq 0.2346 Coeff Var 97.53557 Parameter Estimates Parameter Standard Variable DF Estimate Error t Value Pr > |t| Intercept 1


View Full Document
Download Logistic regression
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Logistic regression and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Logistic regression 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?