<?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: Weighted regression with PROC MCMC in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Weighted-regression-with-PROC-MCMC/m-p/276299#M58656</link>
    <description>&lt;P&gt;Well Rick, you nailed it.&amp;nbsp; Your simple modification produced HPD intervals that were improved by a factor of 10 on account of the weighting.&amp;nbsp; Additionally, the final betas were 99.9% similar to those achieved via weighted QUANTREG.&amp;nbsp; Both algorithms produced the same R-square, F-statistic, and RMSE, so I think it is safe to say they are converging on the same solution &lt;img id="smileyvery-happy" class="emoticon emoticon-smileyvery-happy" src="https://communities.sas.com/i/smilies/16x16_smiley-very-happy.png" alt="Smiley Very Happy" title="Smiley Very Happy" /&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;</description>
    <pubDate>Thu, 09 Jun 2016 15:47:46 GMT</pubDate>
    <dc:creator>maximalc</dc:creator>
    <dc:date>2016-06-09T15:47:46Z</dc:date>
    <item>
      <title>Weighted regression with PROC MCMC</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Weighted-regression-with-PROC-MCMC/m-p/276092#M58621</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a data set for which the reliability of certain measurements is known to be superior to others.&amp;nbsp; I would like to perform quantile regression using PROC MCMC (which I was able to figure out using the SAS documentation), however I would like to weight each datum according to a weight value included in the data set.&amp;nbsp; Is what I am attempting possible, and if so, how would one go about achieving it?&amp;nbsp; Please let me know if additional information is required in order to provide an appropriate solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Feel free to modify the following hypothetical example (weight can be represented by W) for this purpose:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class="AAprogramlisting"&gt;proc mcmc data=igg
          seed=5263
          propcov=congra
          ntu=1000
          mintune=10
          nmc=30000;
  begincnst;
    p=0.95;
  endcnst;
  parms (b0-b2) 0;
  prior b: ~ general(0);
  mu= b0 + b1*age + b2*age2;
  u = igg - mu;
  ll = log(p)+log(1-p) - 0.5*(abs(u)+(2*p-1)*u);
  model igg ~ general(ll);
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;*I am using the latest build of SAS v9.4&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jun 2016 20:09:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Weighted-regression-with-PROC-MCMC/m-p/276092#M58621</guid>
      <dc:creator>maximalc</dc:creator>
      <dc:date>2016-06-08T20:09:54Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted regression with PROC MCMC</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Weighted-regression-with-PROC-MCMC/m-p/276275#M58652</link>
      <description>&lt;P&gt;Two comments:&lt;/P&gt;
&lt;P&gt;1. &lt;A href="http://support.sas.com/documentation/cdl/en/statug/68162/HTML/default/viewer.htm#statug_qreg_toc.htm" target="_self"&gt;The QUANTREG procedure&lt;/A&gt; performs quantile regression and supports a WEIGHT statement. Why not use that?&lt;/P&gt;
&lt;P&gt;2. For any weighted fit, you need to include the weight variable in the computation of the (log) likelihood function. &lt;A href="http://support.sas.com/documentation/cdl/en/statug/68162/HTML/default/viewer.htm#statug_qreg_details01.htm" target="_self"&gt;The "Details" section of the QUANTREG doc&lt;/A&gt; shows how to incorporate weights into a quantile regression. &amp;nbsp;I'm not sure how you derived your log-likelihood function, but maybe modify it to be something like&amp;nbsp;&lt;/P&gt;
&lt;PRE class="AAprogramlisting"&gt;u = w*(igg - mu);&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jun 2016 14:24:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Weighted-regression-with-PROC-MCMC/m-p/276275#M58652</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-06-09T14:24:39Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted regression with PROC MCMC</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Weighted-regression-with-PROC-MCMC/m-p/276294#M58653</link>
      <description>&lt;P&gt;Thanks for your response, Rick.&amp;nbsp; Regarding your first point, part of my interest in achieving quantile regression via MCMC is to compare its efficacy to QUANTREG for my particular data set.&amp;nbsp; I also like the idea of knowing the distribution of betas that come with resampling in this manner.&amp;nbsp; And, somewhat to my surprise, the MCMC procedure solves the same problem more rapidly than QUANTREG (about twice as quickly if I recall correctly), so there is the time factor as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regarding your question about the log-likelihood function, it's taken from an example in the SAS knowledge base (&amp;nbsp;&lt;A href="https://support.sas.com/rnd/app/examples/stat/BayesQuantile/quantile.htm" target="_blank"&gt;https://support.sas.com/rnd/app/examples/stat/BayesQuantile/quantile.htm&lt;/A&gt; ). It specifies an asymmetric laplace distribution for the dependent variable for the purpose of quantile regression.&amp;nbsp; My knowledge of different types of distributions is very limited, so I don't claim to know the theoretical basis for this choice of function, however I can say that the betas it generates are very similar to those resultant from the unweighted QUANTREG procedure for the same problem, so I do believe it to be applicable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If implementing weighting via MCMC is as simple as muliplying the error term by the weight factor as you've described, then that would be splendid.&amp;nbsp; I will give it a shot and see how the result compares to weighted QUANTREG.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jun 2016 15:12:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Weighted-regression-with-PROC-MCMC/m-p/276294#M58653</guid>
      <dc:creator>maximalc</dc:creator>
      <dc:date>2016-06-09T15:12:53Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted regression with PROC MCMC</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Weighted-regression-with-PROC-MCMC/m-p/276295#M58654</link>
      <description>&lt;P&gt;Sounds good. I'm certainly not an expert in this area, so experiment and let me know what you discover.&amp;nbsp; It's good that you'll be able to compare weighted results from the two procedures.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regarding speed: PROC QUANTREG has four different methods for solving the optimization. Some might be more efficient than others.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jun 2016 15:18:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Weighted-regression-with-PROC-MCMC/m-p/276295#M58654</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-06-09T15:18:28Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted regression with PROC MCMC</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Weighted-regression-with-PROC-MCMC/m-p/276299#M58656</link>
      <description>&lt;P&gt;Well Rick, you nailed it.&amp;nbsp; Your simple modification produced HPD intervals that were improved by a factor of 10 on account of the weighting.&amp;nbsp; Additionally, the final betas were 99.9% similar to those achieved via weighted QUANTREG.&amp;nbsp; Both algorithms produced the same R-square, F-statistic, and RMSE, so I think it is safe to say they are converging on the same solution &lt;img id="smileyvery-happy" class="emoticon emoticon-smileyvery-happy" src="https://communities.sas.com/i/smilies/16x16_smiley-very-happy.png" alt="Smiley Very Happy" title="Smiley Very Happy" /&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jun 2016 15:47:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Weighted-regression-with-PROC-MCMC/m-p/276299#M58656</guid>
      <dc:creator>maximalc</dc:creator>
      <dc:date>2016-06-09T15:47:46Z</dc:date>
    </item>
    <item>
      <title>Re: Weighted regression with PROC MCMC</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Weighted-regression-with-PROC-MCMC/m-p/276300#M58657</link>
      <description>&lt;P&gt;Everybody gets lucky sometimes! Glad it worked.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jun 2016 15:49:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Weighted-regression-with-PROC-MCMC/m-p/276300#M58657</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-06-09T15:49:53Z</dc:date>
    </item>
  </channel>
</rss>

