1 / 20

生物統計中心 諮詢師及種子教師訓練課程

生物統計中心 諮詢師及種子教師訓練課程. 96年5月8日(二)下午1:30~3:00 訓練講者:李郁芬. 訓練內容. 1. 邏輯斯迴歸 2. SAS PROC LOGISTIC 3. SAS MACRO 語法練習. 邏輯斯迴歸. Logistic Regression Binary Outcome Y Consider Prob(Y=1)= p One covariate X. The logistic function. 模式. Model. SAS Procedures.

dutch
Download Presentation

生物統計中心 諮詢師及種子教師訓練課程

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 生物統計中心諮詢師及種子教師訓練課程 96年5月8日(二)下午1:30~3:00 訓練講者:李郁芬

  2. 訓練內容 1. 邏輯斯迴歸 2. SAS PROC LOGISTIC 3. SAS MACRO 語法練習

  3. 邏輯斯迴歸 • Logistic Regression • Binary Outcome Y • Consider • Prob(Y=1)=p • One covariate X

  4. The logistic function

  5. 模式 • Model

  6. SAS Procedures • You have many choices of performing logistic regression in the SAS System: • CATMOD, • GENMOD, • LOGISTIC, and • PROBIT

  7. The LOGISTIC Procedure PROC LOGISTIC < options >; BY variables ; CLASS variable <(v-options)> <variable <(v-options)>... >                           < / v-options >; MODEL events/trials = < effects > < / options >; MODEL variable < (variable_options) > = < effects > < / options >; STRATA effects < / options >; UNITS independent1 = list1 < ... independentk = listk > < /option > ; WEIGHT variable </ option >; FREQ variable ;

  8. 資料範例 In an experiment comparing the effects of five different drugs. The outcome of each experiment is the presence or absence of a positive response in a subject. The following artificial data represent the number of responses r in the n subjects for the five different drugs, labeled A through E. The response is measured for different levels of a continuous covariate x for each drug.

  9. DATA I data drug; input drug$ x r n @@; datalines; A .1 1 10 A .23 2 12 A .67 1 9 B .2 3 13 B .3 4 15 B .45 5 16 B .78 5 13 C .04 0 10 C .15 0 11 C .56 1 12 C .7 2 12 D .34 5 10 D .6 5 9 D .7 8 10 E .2 12 20 E .34 15 20 E .56 13 15 E .8 17 20 ; run;

  10. SAS CODE I PROC LOGISTIC DATA=drug; CLASS drug(CODING=REF REF=‘A'); MODEL r/n = x drug; RUN;

  11. DATA II

  12. SAS CODE II PROC LOGISTIC DATA=new; CLASS drug(CODING=REF REF='A'); MODEL y(EVENT="1")=drug x; RUN; PROC LOGISTIC DATA=newDESCENDING; CLASS drug(CODING=REF REF='A'); MODEL y=drug x; RUN;

  13. HERE COMES THE PROBLEM

  14. HERE COMES THE PROBLEM

  15. HERE COMES THE PROBLEM • The original SAS code PROC LOGISTIC; CLASS z (CODING=REF REF=‘0'); MODEL y= x z; RUN; • 10 outcomes (Y’s) and 4 exposure matrixes (Z’s)  40 models

  16. SAS MACRO LANGUAGE • The SAS MACRO LANGUAGE %MACRO name <(parameter-list)>; ……… ……… %mend; (SAS code)

  17. Macro Facility Reserved Words

  18. SAS MACRO LANGUAGE • PROC LOGISTIC; • CLASS z (CODING=REF REF=“0”); • MODEL y= x z; • RUN; %MACRO xyz (depvar, indepvar); PROC LOGISTIC; CLASS &indepvar(CODING=REF REF=“0”); MODEL &depvar = x &indepvar ; RUN; %mend;

  19. SAS MACRO LANGUAGE • Call the self-defined MACRO %xyz(y1, z1); %xyz(y2, z2); …… …… %xyz(y4, z1); %xyz(y4, z2); • we can make it more efficient

  20. USEFUL LINK • http://www.ats.ucla.edu/STAT/sas/topics/programming.htm • Array • Macro

More Related