<?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: REG vs GENMOD; WLS vs MLE in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/REG-vs-GENMOD-WLS-vs-MLE/m-p/162378#M8454</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A model on Y in GENMOD with LINK=LOG is not the same thing as a model on ln(Y) in REG. The former assumes Y is distributed as normal and models g(E(Y))=ln(E(Y)).&amp;nbsp; The latter assumes ln(Y) is distributed as normal (Y is lognormal) and models E(ln(Y)).&amp;nbsp; Generally, ln(E(Y)) is not the same as E(ln(Y)).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 02 Apr 2014 15:22:17 GMT</pubDate>
    <dc:creator>StatDave</dc:creator>
    <dc:date>2014-04-02T15:22:17Z</dc:date>
    <item>
      <title>REG vs GENMOD; WLS vs MLE</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/REG-vs-GENMOD-WLS-vs-MLE/m-p/162373#M8449</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 10pt;"&gt;Hello.&amp;nbsp; I'm using a very simple data set from an article in trying to further my understanding of GLMs. I've input the data using SAS, and I've run both the PROC REG and PROC GENMOD procedures on the data. In the PROC GENMOD procedure, I used a log link with a normal distribution; in the PROC REG procedure, I used the log of the response variable in the model.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 10pt;"&gt;My question is, why don't the parameter estimates of the two procedures match? My understanding is that PROC REG uses OLS/WLS to estimate the parameters, whereas PROC GENMOD uses MLE with a Newton-Raphson iterative process for estimation. But I had thought that, when the assumed distribution is normal and the relationship is linear (which, after the log transformation, it is in the GLM, right?), MLE is equal to OLS/WLS.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 10pt;"&gt;Here are the resulting parameters from the run:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; REG&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GENMOD&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 10pt;"&gt;A1&amp;nbsp;&amp;nbsp; 4.623&amp;nbsp;&amp;nbsp;&amp;nbsp; 4.579 &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 10pt;"&gt;A2&amp;nbsp;&amp;nbsp; 4.688&amp;nbsp;&amp;nbsp;&amp;nbsp; 4.730 &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 10pt;"&gt;A3&amp;nbsp;&amp;nbsp; 4.654&amp;nbsp;&amp;nbsp;&amp;nbsp; 4.654 &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 10pt;"&gt;B1&amp;nbsp;&amp;nbsp; (0.735)&amp;nbsp;&amp;nbsp;&amp;nbsp; (0.741)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 10pt;"&gt;B2&amp;nbsp;&amp;nbsp; (0.487)&amp;nbsp;&amp;nbsp;&amp;nbsp; (0.436)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 10pt;"&gt;And here is my code:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 10pt;"&gt;&lt;CODE&gt;data GLM;&lt;BR /&gt; input Y A1 A2 A3 B1 B2;&lt;BR /&gt; lnY = LOG(Y);&lt;BR /&gt; datalines;&lt;BR /&gt;95 1 0 0 0 0&lt;BR /&gt;115 0 1 0 0 0&lt;BR /&gt;105 0 0 1 0 0&lt;BR /&gt;55 1 0 0 1 0&lt;BR /&gt;45 0 1 0 1 0&lt;BR /&gt;30 1 0 0 1 1&lt;BR /&gt;; &lt;BR /&gt;&lt;BR /&gt;proc genmod data=GLM;&lt;BR /&gt; model Y = A1 A2 A3 B1 B2 / dist=normal link=log scale=deviance noint ;&lt;BR /&gt; weight Y;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;proc reg data=GLM;&lt;BR /&gt; model lnY = A1 A2 A3 B1 B2 / noint;&lt;BR /&gt; weight Y;&lt;BR /&gt;run;&lt;BR /&gt;&lt;/CODE&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 10pt;"&gt;&lt;CODE&gt;&lt;/CODE&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 10pt;"&gt;&lt;CODE&gt;As it turns out, if I run GENMOD with an identity link function and run REG using Y instead of LnY, I get the same answer.&amp;nbsp; So, for some reason the transformation from Y to LnY is causing the discrepancy, but mathematically I feel like the answers should still be equal.&lt;/CODE&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 10pt;"&gt;Any insight that anyone can contribute is greatly appreciated!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif;"&gt;&lt;CODE&gt; &lt;/CODE&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: calibri, verdana, arial, sans-serif; font-size: 10pt;"&gt;&lt;CODE&gt;&lt;/CODE&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 Mar 2014 19:42:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/REG-vs-GENMOD-WLS-vs-MLE/m-p/162373#M8449</guid>
      <dc:creator>Jabbawonga</dc:creator>
      <dc:date>2014-03-31T19:42:35Z</dc:date>
    </item>
    <item>
      <title>Re: REG vs GENMOD; WLS vs MLE</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/REG-vs-GENMOD-WLS-vs-MLE/m-p/162374#M8450</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It appears that the difference lies in the WEIGHT statement.&amp;nbsp; If you remove it, the estimates are identical.&amp;nbsp; The definitions are slightly different according to the documentation--in GENMOD, observations are weighted by dispersion parameter/weight variable, in REG, they are relative weights.&lt;/P&gt;&lt;P&gt;Steve Denham&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Apr 2014 13:10:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/REG-vs-GENMOD-WLS-vs-MLE/m-p/162374#M8450</guid>
      <dc:creator>SteveDenham</dc:creator>
      <dc:date>2014-04-01T13:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: REG vs GENMOD; WLS vs MLE</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/REG-vs-GENMOD-WLS-vs-MLE/m-p/162375#M8451</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the reply Steve.&amp;nbsp; If I run the code instead using an identity link function and don't log-transform the response in the REG procedure, I get the same answer whether I use weights or not.&amp;nbsp; If I use a log link in GENMOD and log-transform the response in REG I don't get the same answer, whether I use weights or not.&amp;nbsp; So I had concluded that weights weren't the issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did you run the code with a log transform without weights and get the same answer?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Actually, technically speaking, REG uses OLS and GENMOD uses MLE, which uses iteratively reweighted LS to estimate, so perhaps only the first iteration in GENMOD would match the REG answer...?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Apr 2014 13:00:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/REG-vs-GENMOD-WLS-vs-MLE/m-p/162375#M8451</guid>
      <dc:creator>Jabbawonga</dc:creator>
      <dc:date>2014-04-02T13:00:32Z</dc:date>
    </item>
    <item>
      <title>Re: REG vs GENMOD; WLS vs MLE</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/REG-vs-GENMOD-WLS-vs-MLE/m-p/162376#M8452</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, I just commented out the weight statement, and the results, for this sample dataset, were the same.&amp;nbsp; Also, I ran with and without the noint option.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To see if the first GENMOD iteration matches REG, you could specify the ITPRINT option in the model statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Steve Denham&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Apr 2014 14:56:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/REG-vs-GENMOD-WLS-vs-MLE/m-p/162376#M8452</guid>
      <dc:creator>SteveDenham</dc:creator>
      <dc:date>2014-04-02T14:56:40Z</dc:date>
    </item>
    <item>
      <title>Re: REG vs GENMOD; WLS vs MLE</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/REG-vs-GENMOD-WLS-vs-MLE/m-p/162377#M8453</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, I'm confused now.&amp;nbsp; Here's the exact code I'm running:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; GLM;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; Y A1 A2 A3 B1 B2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; lnY = LOG(Y);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;datalines&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black;"&gt;95 1 0 0 0 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black;"&gt;115 0 1 0 0 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black;"&gt;105 0 0 1 0 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black;"&gt;55 1 0 0 1 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black;"&gt;45 0 1 0 1 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: #ffffc0; color: black;"&gt;30 1 0 0 1 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;genmod&lt;/STRONG&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;=GLM;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;model&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; Y = A1 A2 A3 B1 B2 / &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;dist&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;=normal &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;link&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;=log &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;noint&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: green;"&gt;/* weight Y; */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;reg&lt;/STRONG&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;=GLM;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;model&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; lnY = A1 A2 A3 B1 B2 / &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue;"&gt;noint&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: green;"&gt;/*weight Y; */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I'm getting different answers.&amp;nbsp; What am I doing wrong?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Apr 2014 15:05:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/REG-vs-GENMOD-WLS-vs-MLE/m-p/162377#M8453</guid>
      <dc:creator>Jabbawonga</dc:creator>
      <dc:date>2014-04-02T15:05:51Z</dc:date>
    </item>
    <item>
      <title>Re: REG vs GENMOD; WLS vs MLE</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/REG-vs-GENMOD-WLS-vs-MLE/m-p/162378#M8454</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A model on Y in GENMOD with LINK=LOG is not the same thing as a model on ln(Y) in REG. The former assumes Y is distributed as normal and models g(E(Y))=ln(E(Y)).&amp;nbsp; The latter assumes ln(Y) is distributed as normal (Y is lognormal) and models E(ln(Y)).&amp;nbsp; Generally, ln(E(Y)) is not the same as E(ln(Y)).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Apr 2014 15:22:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/REG-vs-GENMOD-WLS-vs-MLE/m-p/162378#M8454</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2014-04-02T15:22:17Z</dc:date>
    </item>
    <item>
      <title>Re: REG vs GENMOD; WLS vs MLE</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/REG-vs-GENMOD-WLS-vs-MLE/m-p/162379#M8455</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@Jabbawonga:&amp;nbsp; So do I now.&amp;nbsp; I must have made some sort of error when I ran things before that I can no longer replicate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway, StatDave has the right answer.&amp;nbsp; I was thinking program-wise and not theory-wise.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Steve Denham&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Apr 2014 16:22:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/REG-vs-GENMOD-WLS-vs-MLE/m-p/162379#M8455</guid>
      <dc:creator>SteveDenham</dc:creator>
      <dc:date>2014-04-02T16:22:50Z</dc:date>
    </item>
    <item>
      <title>Re: REG vs GENMOD; WLS vs MLE</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/REG-vs-GENMOD-WLS-vs-MLE/m-p/162380#M8456</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Very helpful, thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Apr 2014 18:07:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/REG-vs-GENMOD-WLS-vs-MLE/m-p/162380#M8456</guid>
      <dc:creator>Jabbawonga</dc:creator>
      <dc:date>2014-04-02T18:07:56Z</dc:date>
    </item>
  </channel>
</rss>

