<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Coefficient/odds ratio of natural log transformed independent variable in logistic regression mo in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Coefficient-odds-ratio-of-natural-log-transformed-independent/m-p/928291#M46226</link>
    <description>&lt;P&gt;No, the ESTIMATE statement cannot be used. As I noted and as you can see in the expressions in each line of the FDATA= data set, the odds ratio estimate for increasing X by u units is computed by evaluating the model at x+u and at x and then differencing the results and finally exponentiating the difference. Each evaluation is a log odds, so their difference is a log odds ratio. Exponentiating then gives the odds ratio estimate. This computation is a nonlinear function of the model parameters. The ESTIMATE statement can only compute linear functions of the model parameters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I believe what you suggest with the ESTIMATE statement actually estimates the odds ratio for multiplying X by 5 or 10, not for adding 5 or 10 units:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;logit(5x)=a+b(log(5x)=a+b(log(x)+log(5)) &lt;BR /&gt;-logit(x)=&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;a+b(log(x))&lt;BR /&gt;= b*log(5)&lt;/P&gt;</description>
    <pubDate>Tue, 14 May 2024 15:41:50 GMT</pubDate>
    <dc:creator>StatDave</dc:creator>
    <dc:date>2024-05-14T15:41:50Z</dc:date>
    <item>
      <title>Coefficient/odds ratio of natural log transformed independent variable in logistic regression model</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Coefficient-odds-ratio-of-natural-log-transformed-independent/m-p/927832#M46183</link>
      <description>Anyone can help with following question? Thanks.&lt;BR /&gt;&lt;BR /&gt;In the logistic regression model, b1 is the coefficient of natural log transformed variable x, it is not the coefficient of original scale of x.&lt;BR /&gt;&lt;BR /&gt;logit (p/(1-p)) = b0+ b1 In (x)&lt;BR /&gt;&lt;BR /&gt;If b1=0.1,&lt;BR /&gt;&lt;BR /&gt;What is the OR for one unit increase in the natural log of x (e^0.1)? What is the OR for one unit increase in original scale of X?&lt;BR /&gt;&lt;BR /&gt;What is the OR for 5-unit increase in natural log of x ( ? What is the OR for 5-unit increase in X?</description>
      <pubDate>Fri, 10 May 2024 13:01:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Coefficient-odds-ratio-of-natural-log-transformed-independent/m-p/927832#M46183</guid>
      <dc:creator>sasprog</dc:creator>
      <dc:date>2024-05-10T13:01:50Z</dc:date>
    </item>
    <item>
      <title>Re: Coefficient/odds ratio of natural log transformed independent variable in logistic regression mo</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Coefficient-odds-ratio-of-natural-log-transformed-independent/m-p/927865#M46187</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/274110"&gt;@sasprog&lt;/a&gt;,&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/274110"&gt;@sasprog&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;In the logistic regression model, ...&lt;BR /&gt;logit (p/(1-p)) = b0+ b1 In (x)&lt;/BLOCKQUOTE&gt;
&lt;P&gt;First of all, I assume you mean logit(p) or, equivalently, ln(p/(1-p)) on the left-hand side of the model equation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;If b1=0.1,&lt;BR /&gt;&lt;BR /&gt;What is the OR for one unit increase in the natural log of x (e^0.1)?&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Correct, the odds ratio is (in SAS notation)&amp;nbsp;&lt;FONT face="courier new,courier"&gt;exp(0.1)&lt;/FONT&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;What is the OR for 5-unit increase in natural log of x ( ?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This is&amp;nbsp;&lt;FONT face="courier new,courier"&gt;exp(0.5)&lt;/FONT&gt; by the same reasoning (i.e., exponentiating the difference of the log odds).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;What is the OR for one unit increase in original scale of X?&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Similarly, but depending on x, this is &lt;FONT face="courier new,courier"&gt;exp(0.1*(log(x+1)-log(x))) = (1+1/x)**0.1&lt;/FONT&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now it's your turn.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;What is the OR for 5-unit increase in X?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;LI-SPOILER&gt;It is&amp;nbsp;&lt;FONT face="courier new,courier"&gt;exp(0.1*(log(x+5)-log(x))) = (1+5/x)**0.1&lt;/FONT&gt;.&lt;/LI-SPOILER&gt;</description>
      <pubDate>Fri, 10 May 2024 15:45:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Coefficient-odds-ratio-of-natural-log-transformed-independent/m-p/927865#M46187</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2024-05-10T15:45:44Z</dc:date>
    </item>
    <item>
      <title>Re: Coefficient/odds ratio of natural log transformed independent variable in logistic regression mo</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Coefficient-odds-ratio-of-natural-log-transformed-independent/m-p/928166#M46215</link>
      <description>&lt;P&gt;If you want to do this as part of an analysis of observed data and obtain estimates of the odds ratio at various values of X (since the odds ratio changes with X) along with tests that the odds ratio equals 1 and confidence intervals, you can use the &lt;A href="http://support.sas.com/kb/58775" target="_self"&gt;NLEST macro&lt;/A&gt;. That macro is needed since, as has been shown, the odds ratio on X is a nonlinear function of the model parameters. Following is an example with random data from known model logit(p)=a+bX with a and b values as specified. The model on log(x) is estimated and saved with PROC LOGISTIC and then the NLEST macro is used to evaluate the model at log(x+1) and log(x), for various x, and exponentiating their difference. As noted, the evaluating expressions in the FDATA= data set could be simplified to [(x+1)/x]**b. Change the "+1" in the expressions to another value if you want to evaluate an increase of other than 1 unit. Alternatively, you could use the macro to estimate the increase in risk (event probability) using data lines like&lt;BR /&gt;at x=1 , logistic(b_p1+log(1+1)*b_p2) - logistic(b_p1+log(1)*b_p2)&lt;BR /&gt;or even to evaluate the risk ratio for increasing X with data lines like&lt;BR /&gt;at x=1 , logistic(b_p1+log(1+1)*b_p2) / logistic(b_p1+log(1)*b_p2)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
n=10000; a=-2.5; b=2;
do lnx=0 to 1 by .1;
   x=exp(lnx);
   logit=a+b*lnx;
   truodds=exp(logit);
   truodxp1=exp(a+b*log(x+1));
   truor=truodxp1/truodds;
   p=logistic(logit);
   y=rand("binomial",p,n);
   output;
end;
run;

proc logistic data=a;
   model y/n = lnx;
   effectplot / link;
   store log;
   run;

data fd; 
   length label f $32767; 
   infile datalines delimiter=',';
   input label f; 
   datalines;
at x=1   , exp( (b_p1+log(1+1)*b_p2) - (b_p1+log(1)*b_p2) )
at x=1.5 , exp( (b_p1+log(1.5+1)*b_p2) - (b_p1+log(1.5)*b_p2) )
at x=2   , exp( (b_p1+log(2+1)*b_p2) - (b_p1+log(2)*b_p2) )
at x=2.5 , exp( (b_p1+log(2.5+1)*b_p2) - (b_p1+log(2.5)*b_p2) )
;
%nlest(instore=log, fdata=fd, null=1, title=ORs at various X values)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 May 2024 16:40:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Coefficient-odds-ratio-of-natural-log-transformed-independent/m-p/928166#M46215</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2024-05-13T16:40:02Z</dc:date>
    </item>
    <item>
      <title>Re: Coefficient/odds ratio of natural log transformed independent variable in logistic regression mo</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Coefficient-odds-ratio-of-natural-log-transformed-independent/m-p/928278#M46225</link>
      <description>&lt;P&gt;This is exactly what I am looking for. Thank you!&lt;/P&gt;&lt;P&gt;I am also wondering if the estimate statement can be use in proc logistic to achieve the same goal:&lt;/P&gt;&lt;P&gt;ln(5)=1.609 ln(10)=2.303&lt;/P&gt;&lt;P&gt;proc logistic data=a;&lt;/P&gt;&lt;P&gt;model y=ln(x);&lt;/P&gt;&lt;P&gt;estimate “5-unit increase” ln(x) 1.609 / exp cl;&lt;/P&gt;&lt;P&gt;estimate “10-unit increase” ln(x) 2.303 / exp cl;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2024 13:25:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Coefficient-odds-ratio-of-natural-log-transformed-independent/m-p/928278#M46225</guid>
      <dc:creator>sasprog</dc:creator>
      <dc:date>2024-05-14T13:25:37Z</dc:date>
    </item>
    <item>
      <title>Re: Coefficient/odds ratio of natural log transformed independent variable in logistic regression mo</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Coefficient-odds-ratio-of-natural-log-transformed-independent/m-p/928291#M46226</link>
      <description>&lt;P&gt;No, the ESTIMATE statement cannot be used. As I noted and as you can see in the expressions in each line of the FDATA= data set, the odds ratio estimate for increasing X by u units is computed by evaluating the model at x+u and at x and then differencing the results and finally exponentiating the difference. Each evaluation is a log odds, so their difference is a log odds ratio. Exponentiating then gives the odds ratio estimate. This computation is a nonlinear function of the model parameters. The ESTIMATE statement can only compute linear functions of the model parameters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I believe what you suggest with the ESTIMATE statement actually estimates the odds ratio for multiplying X by 5 or 10, not for adding 5 or 10 units:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;logit(5x)=a+b(log(5x)=a+b(log(x)+log(5)) &lt;BR /&gt;-logit(x)=&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;a+b(log(x))&lt;BR /&gt;= b*log(5)&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2024 15:41:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Coefficient-odds-ratio-of-natural-log-transformed-independent/m-p/928291#M46226</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2024-05-14T15:41:50Z</dc:date>
    </item>
  </channel>
</rss>

