<?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 chi-squared distribution on histogram (proc univariate) in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Overlay-chi-squared-distribution-on-histogram-proc-univariate/m-p/235366#M55062</link>
    <description>&lt;P&gt;Yes, I saw this in a couple of places -&amp;nbsp;including Wicklin's simulation book, but needed more confirmation to feel totally confortable. So I used the below, since I had&amp;nbsp;2 degrees of freedom on the chi^2 distribution. Please let me know if this seems incorrect&lt;/P&gt;
&lt;PRE&gt;PROC UNIVARIATE DATA=plotdata;
   VAR x;
   HISTOGRAM x / gamma(alpha=1 sigma=2); 
RUN;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 18 Nov 2015 19:28:37 GMT</pubDate>
    <dc:creator>H</dc:creator>
    <dc:date>2015-11-18T19:28:37Z</dc:date>
    <item>
      <title>Overlay chi-squared distribution on histogram (proc univariate)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Overlay-chi-squared-distribution-on-histogram-proc-univariate/m-p/235236#M55033</link>
      <description>&lt;P&gt;So imagine I have a data that I believe is chi-squared distributed. I want to make a histogram in proc univariate or another program, and then overlay the chi-square distribution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Seems easy enough, though wondering why the chi-square is not an option in Univariate?&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2015 14:12:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Overlay-chi-squared-distribution-on-histogram-proc-univariate/m-p/235236#M55033</guid>
      <dc:creator>H</dc:creator>
      <dc:date>2015-11-18T14:12:57Z</dc:date>
    </item>
    <item>
      <title>Re: Overlay chi-squared distribution on histogram (proc univariate)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Overlay-chi-squared-distribution-on-histogram-proc-univariate/m-p/235240#M55034</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/33307"&gt;@AnnaBrown﻿&lt;/a&gt;&amp;nbsp;I believe this should be on the SAS Procedures community?&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2015 14:32:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Overlay-chi-squared-distribution-on-histogram-proc-univariate/m-p/235240#M55034</guid>
      <dc:creator>Sam_SAS</dc:creator>
      <dc:date>2015-11-18T14:32:46Z</dc:date>
    </item>
    <item>
      <title>Re: Overlay chi-squared distribution on histogram (proc univariate)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Overlay-chi-squared-distribution-on-histogram-proc-univariate/m-p/235309#M55046</link>
      <description>&lt;P&gt;If you mean the (common) chi-squared distribution and not the non-central chi-squared distribution,&amp;nbsp;I think you can make use of the facts that&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;The chi-squared distribution with n degrees of freedom is equal to the gamma distribution with shape parameter n/2 and&amp;nbsp;scale parameter 2. In terms of SAS syntax:&amp;nbsp;pdf('CHISQ', x, df) = pdf('GAMMA', x, df/2, 2).&lt;/LI&gt;
&lt;LI&gt;Unlike the chi-squared distribution, the gamma distribution is among the fitted continuous distributions which PROC UNIVARIATE offers.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;For&amp;nbsp;other, even user-defined density curves there is an article&amp;nbsp;&lt;A href="http://blogs.sas.com/content/iml/2013/04/24/overlay-density-curve-on-a-histogram.html" target="_blank"&gt;How to overlay a custom density curve on a histogram in SAS&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2015 17:07:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Overlay-chi-squared-distribution-on-histogram-proc-univariate/m-p/235309#M55046</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2015-11-18T17:07:39Z</dc:date>
    </item>
    <item>
      <title>Re: Overlay chi-squared distribution on histogram (proc univariate)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Overlay-chi-squared-distribution-on-histogram-proc-univariate/m-p/235366#M55062</link>
      <description>&lt;P&gt;Yes, I saw this in a couple of places -&amp;nbsp;including Wicklin's simulation book, but needed more confirmation to feel totally confortable. So I used the below, since I had&amp;nbsp;2 degrees of freedom on the chi^2 distribution. Please let me know if this seems incorrect&lt;/P&gt;
&lt;PRE&gt;PROC UNIVARIATE DATA=plotdata;
   VAR x;
   HISTOGRAM x / gamma(alpha=1 sigma=2); 
RUN;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2015 19:28:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Overlay-chi-squared-distribution-on-histogram-proc-univariate/m-p/235366#M55062</guid>
      <dc:creator>H</dc:creator>
      <dc:date>2015-11-18T19:28:37Z</dc:date>
    </item>
    <item>
      <title>Re: Overlay chi-squared distribution on histogram (proc univariate)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Overlay-chi-squared-distribution-on-histogram-proc-univariate/m-p/235385#M55067</link>
      <description>&lt;P&gt;For a basic plot this should be fine.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can create a large sample of&amp;nbsp;&lt;FONT face="courier new,courier"&gt;rand('CHISQ',2)&lt;/FONT&gt; values to see the good fit. With this simulated data you can also change the parameter values for alpha and sigma to EST in order to let SAS estimate the parameters. You will see how close these estimates will be to 1 and 2, respectively.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2015 20:55:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Overlay-chi-squared-distribution-on-histogram-proc-univariate/m-p/235385#M55067</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2015-11-18T20:55:52Z</dc:date>
    </item>
    <item>
      <title>Re: Overlay chi-squared distribution on histogram (proc univariate)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Overlay-chi-squared-distribution-on-histogram-proc-univariate/m-p/235459#M55078</link>
      <description>&lt;P&gt;1.&amp;nbsp;A chi-square distribution with d degrees of freedom is equivalent to a Gamma(d/2, 2) distribution, so, yes, you can use the gamma distribution to overlay a chi-square curve.&lt;/P&gt;
&lt;P&gt;2) In general, the way to overlay a known probability density to&amp;nbsp;a sampling distribution (presumably created through Monte Carlo simulation or bootstrapping) is to use the GTL. Since you refer to my book, see p. 40-41, Also see the article &lt;A href="http://blogs.sas.com/content/iml/2013/04/24/overlay-density-curve-on-a-histogram.html" target="_self"&gt;"How to overlay a custom density curve on a histogram in SAS."&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;3) You asked "why the chi-square is not an option in Univariate."&amp;nbsp; The answer is that UNIVARIATE models data distributions, and real-world data is rarely&amp;nbsp;generated by a process that gives rise to t, F, or chi-square distribution. Those distributions are used to describe the sampling distribution of statistics.&amp;nbsp;That is, they arise from a theoretical investigation of how a statistic varies across many random samples of data.&amp;nbsp; Consequently, we don't usually fit the parameters in the t, F, and chi-square families. Instead, the parameters (usually called degrees of freedom) are&amp;nbsp;determined by the sample size of the data and are used for inference, such as testing hypotheses, forming confidence intervals, and computing p-values.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Nov 2015 14:07:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Overlay-chi-squared-distribution-on-histogram-proc-univariate/m-p/235459#M55078</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2015-11-19T14:07:13Z</dc:date>
    </item>
    <item>
      <title>Re: Overlay chi-squared distribution on histogram (proc univariate)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Overlay-chi-squared-distribution-on-histogram-proc-univariate/m-p/235521#M55093</link>
      <description>&lt;P&gt;Thank you Freelance and Rick!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes, my first approach was to simulate these data when I did not see the chi^2 option. I then better educated myself, and realized the chi^2 was a specal case of the gamma distribution. This seemed familiar, but I was a little mistrusting of going forward without confirmation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Funny enough Rick, I currently had the simulation book open to page 39 when writing this reply. I had seen the code you mentioned, but was falsely discourage when seeing how long it was. I know, I want flexibility of writing code, but also point and click options at times. To put this in perspective, I am actually using this as a comparative for generated&amp;nbsp;Mahalanobis squared distances -&amp;nbsp;in the pursuit of examining for outlers. I had seen your Do Loop piece on this and it helped&amp;nbsp; in my understanding and I was hoping to use it as a complement to the&amp;nbsp;chi^2 Quantile&amp;nbsp;plots.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Question, are the robust Mahalanobis distances more appropriate&amp;nbsp;for data that may be questionably multivariate normal?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Nov 2015 18:51:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Overlay-chi-squared-distribution-on-histogram-proc-univariate/m-p/235521#M55093</guid>
      <dc:creator>H</dc:creator>
      <dc:date>2015-11-19T18:51:19Z</dc:date>
    </item>
    <item>
      <title>Re: Overlay chi-squared distribution on histogram (proc univariate)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Overlay-chi-squared-distribution-on-histogram-proc-univariate/m-p/235557#M55099</link>
      <description>&lt;P&gt;More appropriate for what? Outlier detection?&amp;nbsp; Since the MV means and covariance are influenced by outliers, I would say that if your data are MV normal plus contamination, then yes the robust MD would be a better choice for outlier detection.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Some possibly relevant references:&lt;/P&gt;
&lt;P&gt;1. &lt;A href="http://blogs.sas.com/content/iml/2012/02/02/detecting-outliers-in-sas-part-3-multivariate-location-and-scatter.html" target="_self"&gt;"Detecting outliers in SAS"&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;2. pp. 7-9 of Wicklin (2010) &lt;A href="http://support.sas.com/resources/papers/proceedings10/329-2010.pdf" target="_self"&gt;"Rediscovering SAS/IML Software: Modern Data Analysis for the Practicing Statistician"&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Nov 2015 21:11:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Overlay-chi-squared-distribution-on-histogram-proc-univariate/m-p/235557#M55099</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2015-11-19T21:11:14Z</dc:date>
    </item>
  </channel>
</rss>

