<?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: Overlay historgram and distributions in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Overlay-historgram-and-distributions/m-p/307944#M10807</link>
    <description>&lt;P&gt;What is your question?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to create a Q-Q plot, as in your images, then &lt;A href="http://support.sas.com/documentation/cdl/en/procstat/68142/HTML/default/viewer.htm#procstat_univariate_syntax30.htm" target="_self"&gt;use the QQPLOT statement&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to specify values for the parameter, rather than have the software find maximum likelihood estimates, then specify the parameter values in parentheses after the name of the distribution. For example:&lt;/P&gt;
&lt;P&gt;HISTOGRAM&amp;nbsp;/ lognormal(mu=10 sigma=2) gamma(theta=0) weibull(theta=0 C=EST);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 28 Oct 2016 15:53:42 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2016-10-28T15:53:42Z</dc:date>
    <item>
      <title>Overlay historgram and distributions</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Overlay-historgram-and-distributions/m-p/307942#M10806</link>
      <description>&lt;P&gt;I've read &amp;amp; studied some of Risk's posts about overlaying histograms/distributions, but still not getting it.&lt;/P&gt;
&lt;P&gt;Been trying different things with Univariate, Capability, etc.&lt;/P&gt;
&lt;P&gt;I have continuous data (supplement intake plot below) that I'm trying to fit various distributions (gamma, beta, lognormal, exponential, invgauss). Having trouble specifying mu = , sigma = , etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;with help from the internet:&lt;/P&gt;
&lt;P&gt;title 'supplement';&amp;nbsp; ods graphics on;&lt;/P&gt;
&lt;P&gt;ods select histogram parameterestimates goodnessoffit fitquantiles;&lt;/P&gt;
&lt;P&gt;proc univariate data = growth;&amp;nbsp; var suppintake;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; histogram / midpoints = 0.2 to 0.8 by 0.2&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lognormal&amp;nbsp; weibull&amp;nbsp; gamm&amp;nbsp; odstitle = title;&lt;/P&gt;
&lt;P&gt;inset n mean (5.3) std = 'Std Dev' (5.3) skewness (5.3)&lt;/P&gt;
&lt;P&gt;&amp;nbsp; /pos = ne header = 'Summary Stats';&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/5544i441D9D901FBB7867/image-size/medium?v=v2&amp;amp;px=-1" alt="Supp intake graph.jpg" title="Supp intake graph.jpg" border="0" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/5546i4D75169ED3DB307E/image-size/medium?v=v2&amp;amp;px=-1" alt="goat serum graph.png" title="goat serum graph.png" border="0" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I got the following to work, but none of the distributions fit the continuous data (feed intake)&lt;/P&gt;
&lt;P&gt;DATA LAMB; SET grow;&lt;BR /&gt;PROC SORT; BY DAY ID JUN UREA;&lt;BR /&gt;RUN;QUIT;&lt;BR /&gt;&lt;BR /&gt;ods graphics on;&lt;BR /&gt;ods select Histogram ParameterEstimates GoodnessOfFit FitQuantiles;&lt;BR /&gt;proc univariate;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; var suppDMIkg;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; histogram / midpoints=0.2 to 0.8 by 0.2&lt;BR /&gt;&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;&amp;nbsp; lognormal&lt;BR /&gt;&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;&amp;nbsp; weibull&lt;BR /&gt;&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;&amp;nbsp; gamma;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; inset n mean(5.3) std='Std Dev'(5.3) skewness(5.3)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; / pos = ne&amp;nbsp; header = 'Summary Statistics';&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="border-radius: 2px; text-indent: 20px; width: auto; padding: 0px 4px 0px 0px; text-align: center; font: bold 11px/20px 'Helvetica Neue',Helvetica,sans-serif; color: #ffffff; background: #bd081c  no-repeat scroll 3px 50% / 14px 14px; position: absolute; opacity: 1; z-index: 8675309; display: none; cursor: pointer; top: 675px; left: 25px;"&gt;Save&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2016 17:14:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Overlay-historgram-and-distributions/m-p/307942#M10806</guid>
      <dc:creator>AgReseach7</dc:creator>
      <dc:date>2016-10-28T17:14:17Z</dc:date>
    </item>
    <item>
      <title>Re: Overlay historgram and distributions</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Overlay-historgram-and-distributions/m-p/307944#M10807</link>
      <description>&lt;P&gt;What is your question?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to create a Q-Q plot, as in your images, then &lt;A href="http://support.sas.com/documentation/cdl/en/procstat/68142/HTML/default/viewer.htm#procstat_univariate_syntax30.htm" target="_self"&gt;use the QQPLOT statement&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to specify values for the parameter, rather than have the software find maximum likelihood estimates, then specify the parameter values in parentheses after the name of the distribution. For example:&lt;/P&gt;
&lt;P&gt;HISTOGRAM&amp;nbsp;/ lognormal(mu=10 sigma=2) gamma(theta=0) weibull(theta=0 C=EST);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2016 15:53:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Overlay-historgram-and-distributions/m-p/307944#M10807</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-10-28T15:53:42Z</dc:date>
    </item>
    <item>
      <title>Re: Overlay historgram and distributions</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Overlay-historgram-and-distributions/m-p/307968#M10810</link>
      <description>&lt;P&gt;Hey Rick.&lt;/P&gt;
&lt;P&gt;I initially posted &amp;amp; then edited (last part that I got to work).&lt;/P&gt;
&lt;P&gt;I attached the data if needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My specific questions:&lt;/P&gt;
&lt;P&gt;1. I guess that was my 1st question: how to specify mu sigma theta.&lt;/P&gt;
&lt;P&gt;2. Any issues with the following log statements?&lt;/P&gt;
&lt;P&gt;&amp;nbsp; NOTE: Since a threshold parameter (THETA) was not specified for the lognormal fit for&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; suppDMIkg, a zero threshold is assumed.&lt;BR /&gt;&amp;nbsp; NOTE: At least one W.D format was too small for the number to be printed. The decimal may&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; be shifted by the "BEST" format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. My data are continuous but for suppDMIkg (supplement intake), I can't get any distribution to fit &amp;amp; am thus, stuck.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your time&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2016 17:42:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Overlay-historgram-and-distributions/m-p/307968#M10810</guid>
      <dc:creator>AgReseach7</dc:creator>
      <dc:date>2016-10-28T17:42:26Z</dc:date>
    </item>
    <item>
      <title>Re: Overlay historgram and distributions</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Overlay-historgram-and-distributions/m-p/307971#M10811</link>
      <description>&lt;P&gt;There is nothing wrong with those notes in the log. They are not errors, just information. You can make the first NOTE go away by specifying lognormal(THETA=0).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As to the fit, by convention the distributions that we call lognormal, Weibull, and Gamma distributions have positive skewness.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, your data have negative skewness, so the data distribution doesn't look anything like these theoretical distributions.&lt;/P&gt;
&lt;P&gt;But that's no problem, because you can apply a linear&amp;nbsp;transformation of the form x --&amp;gt; a - b*x. This will "flip" the direction of the tail of the data so that the data distribution can be modeled by the standard distributions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example, the following data step creates a new variable "OneMinusSuppDMIkg" that has the value 1-SuppDMIkg. &amp;nbsp;This new variable has positive skew and the smallest value is 0.49 so you can model it as follows:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data A;
set growth;
OneMinusSuppDMIkg = 1 - suppDMIkg;
run;

proc univariate data=A;
histogram oneMinusSuppDMIkg / midpoints=0.475 to 0.8 by 0.025
          lognormal(theta=0.48)
          gamma(theta=0.48)
          weibull(theta=0.48);
run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Equivalently, you could define&amp;nbsp;Q = 0.52 - suppDMIkg and then use THETA=0 as the threashold.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Usually someone with domain knowledge can figure out a nice interpretable transformation. For example, if the measurements are "centimeters for a manufactured part," you might want to change units to "deviations less than the upper specification limit."&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2016 18:11:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Overlay-historgram-and-distributions/m-p/307971#M10811</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-10-28T18:11:15Z</dc:date>
    </item>
    <item>
      <title>Re: Overlay historgram and distributions</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Overlay-historgram-and-distributions/m-p/309413#M10870</link>
      <description>&lt;P&gt;For additional thoughts, discussion, and an example of "reversing the distribution" when the data has negative skewness, see&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.sas.com/content/iml/2016/11/02/reverse-data-before-fit-distribution.html" target="_self"&gt;"Sometimes you need to reverse the data before you fit a distribution."&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2016 20:54:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Overlay-historgram-and-distributions/m-p/309413#M10870</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-11-04T20:54:45Z</dc:date>
    </item>
  </channel>
</rss>

