<?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: Different Odds Ratio from PROC FREQ &amp;amp; PROC LOGISTIC in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Different-Odds-Ratio-from-PROC-FREQ-amp-PROC-LOGISTIC/m-p/340671#M17926</link>
    <description>Hm. Good point. I had thought of Simpson's Paradox, but didn't delve into it. Might need to take another look into that.&lt;BR /&gt;&lt;BR /&gt;And you're right: I'm not sure why I expected the odds ratio to be the same between the two situations. In fact, I re-ran the regression with just the Kennel Cough variable and lo-and-behold I got the PROC FREQ odds ratio.&lt;BR /&gt;&lt;BR /&gt;Thanks for knocking some sense into my tired brain!</description>
    <pubDate>Tue, 14 Mar 2017 06:19:26 GMT</pubDate>
    <dc:creator>kimbekaw</dc:creator>
    <dc:date>2017-03-14T06:19:26Z</dc:date>
    <item>
      <title>Different Odds Ratio from PROC FREQ &amp; PROC LOGISTIC</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Different-Odds-Ratio-from-PROC-FREQ-amp-PROC-LOGISTIC/m-p/340653#M17923</link>
      <description>&lt;P&gt;I'm working on a project and have run into an expected issue. After running PROC LOGISTIC on my data, I noticed that a few of the odds ratios and regression coefficients seemed to be the inverse of what they &lt;EM&gt;should be&lt;/EM&gt;. After some investigation using PROC FREQ to run the odds ratios, I believe there is some form of error with the odds ratios from PROC LOGISTIC.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The example below is of the response variable "MonthStay" and one of the variables in question "KennelCough". &lt;STRONG&gt;MonthStay&lt;/STRONG&gt; = Y and the event of interest is &lt;STRONG&gt;KennelCough&lt;/STRONG&gt; = N. PROC FREQ gives me the expected odds ratio, 1.7702. PROC LOGISTIC gives me the inverse 0.583 which doesn't seem correct.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't know how to remedy this suspected error. Am I missing something in my code to get the correct calculations from PROC LOGISITC? Or am I totally misunderstanding what's going on? Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the PROC FREQ code and result:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data = capstone.adopts_dog order = freq;
tables KennelCough*MonthStay / relrisk;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/7720i670BDFA073A16A0E/image-size/large?v=1.0&amp;amp;px=-1" border="0" alt="procfreq.PNG" title="procfreq.PNG" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here is the PROC LOGISTIC CODE and results:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;proc logistic data = capstone.adopts_dog plots(only)=(roc(id=prob) effect); 

class Breed(ref='Chihuahua') Gender(ref='Female') 
Color(ref='Black') Source(ref='Stray') EvalCat(ref='TR') SNAtIn(ref='No')
FoodAggro(ref='Y') AnimalAggro(ref='Y') KennelCough(ref='Y') Dental(ref='Y') 
Fearful(ref='Y') Handling(ref='Y') UnderAge(ref='Y') InJuris(ref='Alameda County')
InRegion(ref='East Bay SPCA - Dublin') OutRegion(ref='East Bay SPCA - Dublin')
/ param=ref;

model MonthStay(event='Y') = Age Gender Breed Weight Color Source EvalCat SNatIn
NumBehvCond NumMedCond FoodAggro AnimalAggro KennelCough Dental Fearful 
Handling UnderAge Injuris InRegion OutRegion 

/ lackfit aggregate scale = none selection = backward rsquare;
output out = probdogs4 PREDPROBS=I reschi = pearson h = leverage;
run;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/7721i4686FDD8CE46BD79/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="proclogistic_2.PNG" title="proclogistic_2.PNG" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Class Level Information&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/7722i1BC7A55A78C37001/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="proclogistic_3.PNG" title="proclogistic_3.PNG" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;Odds Ratios Estimates&lt;/STRONG&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/7723i511C8F57D00E151E/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="proclogistic_1.PNG" title="proclogistic_1.PNG" /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2017 04:52:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Different-Odds-Ratio-from-PROC-FREQ-amp-PROC-LOGISTIC/m-p/340653#M17923</guid>
      <dc:creator>kimbekaw</dc:creator>
      <dc:date>2017-03-14T04:52:29Z</dc:date>
    </item>
    <item>
      <title>Re: Different Odds Ratio from PROC FREQ &amp; PROC LOGISTIC</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Different-Odds-Ratio-from-PROC-FREQ-amp-PROC-LOGISTIC/m-p/340659#M17925</link>
      <description>&lt;P&gt;Usually that means the comparison is the inverse, ie Y vs N rather than N vs Y. To flip the direction you invert the odds ratio.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Double check what you would expect by comparing the raw numbers. Ie since kennel cough is yes and dogs with month stay yes is higher when comparing to others then I would expect Y vs N to be above 1, so if you compare to Y, then the number should be less than 0.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But...why would you expect the odds ratio from a full logistic regression to match the output from proc freq? Once other things factored in the relationship changes. You could be seeing Simpsons Paradox as well.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2017 05:25:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Different-Odds-Ratio-from-PROC-FREQ-amp-PROC-LOGISTIC/m-p/340659#M17925</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-03-14T05:25:45Z</dc:date>
    </item>
    <item>
      <title>Re: Different Odds Ratio from PROC FREQ &amp; PROC LOGISTIC</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Different-Odds-Ratio-from-PROC-FREQ-amp-PROC-LOGISTIC/m-p/340671#M17926</link>
      <description>Hm. Good point. I had thought of Simpson's Paradox, but didn't delve into it. Might need to take another look into that.&lt;BR /&gt;&lt;BR /&gt;And you're right: I'm not sure why I expected the odds ratio to be the same between the two situations. In fact, I re-ran the regression with just the Kennel Cough variable and lo-and-behold I got the PROC FREQ odds ratio.&lt;BR /&gt;&lt;BR /&gt;Thanks for knocking some sense into my tired brain!</description>
      <pubDate>Tue, 14 Mar 2017 06:19:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Different-Odds-Ratio-from-PROC-FREQ-amp-PROC-LOGISTIC/m-p/340671#M17926</guid>
      <dc:creator>kimbekaw</dc:creator>
      <dc:date>2017-03-14T06:19:26Z</dc:date>
    </item>
    <item>
      <title>Re: Different Odds Ratio from PROC FREQ &amp; PROC LOGISTIC</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Different-Odds-Ratio-from-PROC-FREQ-amp-PROC-LOGISTIC/m-p/340793#M17932</link>
      <description>&lt;P&gt;Logistic is going on only use rows in the data where all of the model variables are non-missing.&lt;/P&gt;
&lt;P&gt;Your proc freq results shows 5979 values used to calculate RR. The logistic output shows 5785 values of Month Stay. So that is likely to have a noticeable impact on the result.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2017 14:21:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Different-Odds-Ratio-from-PROC-FREQ-amp-PROC-LOGISTIC/m-p/340793#M17932</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-03-14T14:21:42Z</dc:date>
    </item>
  </channel>
</rss>

