Proc Logistic Without specification SAS models the first

  • Slides: 19
Download presentation
Proc Logistic

Proc Logistic

Without specification, SAS models the first value of dependent variable as the “event”, in

Without specification, SAS models the first value of dependent variable as the “event”, in this case, y=0. proc logistic data= a. chd 2018_a plots=none; model chd=age; run;

Without specification, SAS models the first value of dependent variable as the “event”, in

Without specification, SAS models the first value of dependent variable as the “event”, in this case, y=“Developed Chd”. proc freq data=s 5238. chd 2018; tables chd*age; run; proc logistic data= s 5238. chd 2018 plots=none; model chd=age; run;

Explicitly specify event value proc logistic data=a. chd 2018_a plots=none; model chd(event="1")=age; run;

Explicitly specify event value proc logistic data=a. chd 2018_a plots=none; model chd(event="1")=age; run;

Explicitly specify event value proc logistic data= s 5238. chd 2018 plots=none; model chd(event="Developed

Explicitly specify event value proc logistic data= s 5238. chd 2018 plots=none; model chd(event="Developed Chd")=age; run;

The descending option, in this case, the second value is modeled (y=1). proc logistic

The descending option, in this case, the second value is modeled (y=1). proc logistic data=a. chd 2018_a plots=none descending; model chd=age; run;

Scoring new data to_predict; do age=25 to 50; output; end; run; proc logistic data=a.

Scoring new data to_predict; do age=25 to 50; output; end; run; proc logistic data=a. chd 2018_a noprint; model chd(event="1")=age; score data=to_predict out=tmplog; run; proc print data=tmplog; run;

Scoring the data set used – the out= option proc logistic data=a. chd 2018_a

Scoring the data set used – the out= option proc logistic data=a. chd 2018_a noprint; model chd(event="1")=age; score out=tmplog; run; proc print data=tmplog; run;

Create a data set with estimated coefficients proc logistic data=a. chd 2018_a outest=betas noprint;

Create a data set with estimated coefficients proc logistic data=a. chd 2018_a outest=betas noprint; model chd(event="1")=age; run; proc print data=betas; run;

Create a file of estimated parameters using ODS. ods output parameterestimates=betas; ods select parameterestimates;

Create a file of estimated parameters using ODS. ods output parameterestimates=betas; ods select parameterestimates; proc logistic data=a. chd 2018_a; model chd(event="1")=age; run; proc print data=betas; run;

Create a file of estimated parameters using ODS. By group processing. proc sort data=a.

Create a file of estimated parameters using ODS. By group processing. proc sort data=a. chd 2018_a out=tmp; by male; run; ods output parameterestimates=betas; ods select parameterestimates; proc logistic data=tmp; by male; model chd(event="1")=age; run; proc print data=betas; run;

Add covariance matrix to output. proc logistic data=a. chd 2018_a outest=betas covout; model chd(event="1")=age;

Add covariance matrix to output. proc logistic data=a. chd 2018_a outest=betas covout; model chd(event="1")=age; run; proc print data=betas; format age 12. 10; run;

Display covariance matrix. proc logistic data=a. chd 2018_a; model chd(event="1")=age/covb; run;

Display covariance matrix. proc logistic data=a. chd 2018_a; model chd(event="1")=age/covb; run;

Examine ODS output files. ods trace on; proc logistic data=a. chd 2018_a; model chd(event="1")=age;

Examine ODS output files. ods trace on; proc logistic data=a. chd 2018_a; model chd(event="1")=age; run; ods trace off;

Put fit statistics into a file ods output fitstatistics=likelihood; ods select fitstatistics; proc logistic

Put fit statistics into a file ods output fitstatistics=likelihood; ods select fitstatistics; proc logistic data=a. chd 2018_a; model chd(event="1")=age; run; proc print data=likelihood; run;

Specify plots. proc logistic data=a. chd 2018_a plots=effect; model chd(event="Developed Chd")=age; run;

Specify plots. proc logistic data=a. chd 2018_a plots=effect; model chd(event="Developed Chd")=age; run;

The freq statement proc freq data=a. chd 2018_a noprint; tables age*chd/out=chdagecnt; run; proc print

The freq statement proc freq data=a. chd 2018_a noprint; tables age*chd/out=chdagecnt; run; proc print data=chdagecnt; run; proc logistic data=chdagecnt; model chd(event="Developed Chd")=age; freq count; run;

Create a binomial version of the data. Each observation is the number of observations

Create a binomial version of the data. Each observation is the number of observations and the number of events. proc sql; create table positives as select age, count(*) as n 1 from a. chd 2018_a where chd= 1 group by age ; create table counts as select age, count(*) as n from a. chd 2018_a group by age ; create table binary as select a. age, n 1, n from positives a, counts b where a. age=b. age ; select * from binary; quit;

ods select parameterestimates; proc logistic data=a. chd 2018_a; model chd(event="1")=age; run; ods select parameterestimates;

ods select parameterestimates; proc logistic data=a. chd 2018_a; model chd(event="1")=age; run; ods select parameterestimates; proc logistic data=binary; model n 1/n=age; run;