LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (February 2008, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 8 Feb 2008 09:51:15 -0800
Reply-To:     Dale McLerran <stringplayer_2@YAHOO.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Dale McLerran <stringplayer_2@YAHOO.COM>
Subject:      Re: Logistic regression with ordinal Predictor variable
In-Reply-To:  <32259441.1202414127060.JavaMail.root@mswamui-thinleaf.atl.sa.earthlink.net>
Content-Type: text/plain; charset=iso-8859-1

There was an error in the code that I posted on this topic yesterday. I submitted the code:

proc nlmixed data=mydata; parms b0=0 b1=0 b2_2=-.1 to .1 by .2 b2_inc3=0 b3_2=-.1 to .1 by .2 b3_inc3=0 b3_inc4=0;

b2_3 = b2_2 + sign(b2_2)*exp(b2_inc3); b3_3 = b3_2 + sign(b3_2)*exp(b3_inc3); b3_4 = b3_2 + sign(b3_2)*exp(b3_inc4);

eta = b0 + b1*x1 + b2_2*(x2=2) + b2_3*(x2=3) + b3_2*(x3=2) + b3_3*(x3=3) + b3_4*(x3=4); p = exp(eta)/(1 + exp(eta)); model y ~ binary(p); estimate "log-odds ratio for b2=2" b2_2; estimate "log-odds ratio for b2=3" b2_3; estimate "log-odds ratio for b3=2" b3_2; estimate "log-odds ratio for b3=3" b3_3; estimate "log-odds ratio for b3=4" b3_4;

estimate "odds ratio for b2=2" exp(b2_2); estimate "odds ratio for b2=3" exp(b2_3); estimate "odds ratio for b3=2" exp(b3_2); estimate "odds ratio for b3=3" exp(b3_3); estimate "odds ratio for b3=4" exp(b3_4); run;

This code was incorrect on the line which constructed the log-odds for ordered level 4 of X3. As shown above, that line was

b3_4 = b3_2 + sign(b3_2)*exp(b3_inc4);

which only guarantees that the log-odds for level 4 relative to level 1 is further from zero than the log-odds for level 2 relative to level 1. What we want is for the log-odds for level 4 to be further from zero than the log-odds for level 3. Thus, we should code:

b3_4 = b3_3 + sign(b3_2)*exp(b3_inc4);

Complete revised code for the OP problem specification would be:

proc nlmixed data=mydata; parms b0=0 b1=0 b2_2=-.1 to .1 by .2 b2_inc3=0 b3_2=-.1 to .1 by .2 b3_inc3=0 b3_inc4=0;

b2_3 = b2_2 + sign(b2_2)*exp(b2_inc3); b3_3 = b3_2 + sign(b3_2)*exp(b3_inc3); b3_4 = b3_3 + sign(b3_2)*exp(b3_inc4);

eta = b0 + b1*x1 + b2_2*(x2=2) + b2_3*(x2=3) + b3_2*(x3=2) + b3_3*(x3=3) + b3_4*(x3=4); p = exp(eta)/(1 + exp(eta)); model y ~ binary(p); estimate "log-odds ratio for b2=2" b2_2; estimate "log-odds ratio for b2=3" b2_3; estimate "log-odds ratio for b3=2" b3_2; estimate "log-odds ratio for b3=3" b3_3; estimate "log-odds ratio for b3=4" b3_4;

estimate "odds ratio for b2=2" exp(b2_2); estimate "odds ratio for b2=3" exp(b2_3); estimate "odds ratio for b3=2" exp(b3_2); estimate "odds ratio for b3=3" exp(b3_3); estimate "odds ratio for b3=4" exp(b3_4); run;

Sorry for the mixup.

Dale

--------------------------------------- Dale McLerran Fred Hutchinson Cancer Research Center mailto: dmclerra@NO_SPAMfhcrc.org Ph: (206) 667-2926 Fax: (206) 667-5977 ---------------------------------------

____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ


Back to: Top of message | Previous page | Main SAS-L page