<?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: Finding a gamma distribution from percentiles in SAS Forecasting and Econometrics</title>
    <link>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/Finding-a-gamma-distribution-from-percentiles/m-p/438225#M3022</link>
    <description>&lt;P&gt;It looks like it is a optimize problem. I remembered &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt; wrote a bolg about fitting a normal distribution. But he has many data,not like you only two. OR you could use CDF(),QUANTILE() function to enmuerate the alpha beta.&lt;/P&gt;</description>
    <pubDate>Sun, 18 Feb 2018 01:47:54 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2018-02-18T01:47:54Z</dc:date>
    <item>
      <title>Finding a gamma distribution from percentiles</title>
      <link>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/Finding-a-gamma-distribution-from-percentiles/m-p/437972#M3017</link>
      <description>&lt;P&gt;Dear Braintrust,&lt;/P&gt;&lt;P&gt;we are working on prior determination for finding a gamma distribution.&lt;/P&gt;&lt;P&gt;we have the 50th and 90th percentile of gamma distribution and want to find the parameters for defining the gamma distribution fitting our data.&lt;/P&gt;&lt;P&gt;Is there any specific procedure we can follow with SAS?&lt;/P&gt;&lt;P&gt;Thanks so much&lt;/P&gt;</description>
      <pubDate>Fri, 16 Feb 2018 13:59:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/Finding-a-gamma-distribution-from-percentiles/m-p/437972#M3017</guid>
      <dc:creator>SBuc</dc:creator>
      <dc:date>2018-02-16T13:59:10Z</dc:date>
    </item>
    <item>
      <title>Re: Finding a gamma distribution from percentiles</title>
      <link>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/Finding-a-gamma-distribution-from-percentiles/m-p/438015#M3018</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
proc univariate data=sashelp.class;
histogram height / gamma;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Check the bottom of Histogram Graphic.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Feb 2018 16:14:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/Finding-a-gamma-distribution-from-percentiles/m-p/438015#M3018</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-02-16T16:14:53Z</dc:date>
    </item>
    <item>
      <title>Re: Finding a gamma distribution from percentiles</title>
      <link>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/Finding-a-gamma-distribution-from-percentiles/m-p/438019#M3019</link>
      <description>&lt;P&gt;Thanks for this answer however I think my previous question was not clear enough.&lt;/P&gt;&lt;P&gt;Let 's say that I want to modelize a gamma distribution.&lt;/P&gt;&lt;P&gt;I only know that the 50th percentile of this gamma (alpha, beta) is pct50 and the 90th percentile is pct90.&lt;/P&gt;&lt;P&gt;how can I find alpha and&amp;nbsp; beta knowing pct50 and pct90 of the distribution?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 16 Feb 2018 16:41:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/Finding-a-gamma-distribution-from-percentiles/m-p/438019#M3019</guid>
      <dc:creator>SBuc</dc:creator>
      <dc:date>2018-02-16T16:41:34Z</dc:date>
    </item>
    <item>
      <title>Re: Finding a gamma distribution from percentiles</title>
      <link>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/Finding-a-gamma-distribution-from-percentiles/m-p/438225#M3022</link>
      <description>&lt;P&gt;It looks like it is a optimize problem. I remembered &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt; wrote a bolg about fitting a normal distribution. But he has many data,not like you only two. OR you could use CDF(),QUANTILE() function to enmuerate the alpha beta.&lt;/P&gt;</description>
      <pubDate>Sun, 18 Feb 2018 01:47:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/Finding-a-gamma-distribution-from-percentiles/m-p/438225#M3022</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-02-18T01:47:54Z</dc:date>
    </item>
    <item>
      <title>Re: Finding a gamma distribution from percentiles</title>
      <link>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/Finding-a-gamma-distribution-from-percentiles/m-p/438247#M3023</link>
      <description>&lt;P&gt;The gamma distribution has two parameters (alpha, beta) and you have two constraints, so this requires solving a nonlinear system of equations.Let p1=0.5 and p2=0.95 be the percentiles (expressed as quantiles in (0,1)).&lt;/P&gt;
&lt;P&gt;The nonlinear equations are&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Solve for (alpha, beta) that satisfy:&lt;/P&gt;
&lt;P&gt;Eq1: CDF("Gamma", X1, alkpha, beta) = p1&lt;/P&gt;
&lt;P&gt;Eq2: CDF("Gamma", X2, alkpha, beta) = p2&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This can be solved in many ways,&amp;nbsp;but since you posted to the ETS&amp;nbsp;community I assume you want to use SAS/ETS tools. You can &lt;A href="http://go.documentation.sas.com/?docsetId=etsug&amp;amp;docsetTarget=etsug_model_sect009.htm&amp;amp;docsetVersion=14.3&amp;amp;locale=en" target="_self"&gt;use PROC MODEL to solve simultaneous&amp;nbsp;equations&lt;/A&gt;. Your example might look like this, where I am using X1=4 for the observed&amp;nbsp;50th percentile and X2=9 for the observed 95th percentile:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data initial;
   alpha=1; beta=1;    /* initial guess for Newton's method */
   p1=0.5;  X1 = 4;   /* first percentile */
   p2=0.95; X2 = 9;   /* second percentile */
run;

proc model data=initial;
  eq.one = cdf("Gamma", X1, alpha, beta) - p1;
  eq.two = cdf("Gamma", X2, alpha, beta) - p2;
  solve alpha beta / solveprint out=solved outpredict;
run;quit;

proc print data=solved noobs;
run;

/* Optional: check that the solution makes sense */
data Check;
set solved;
do x = 0 to 12 by 0.2;
   y = cdf("gamma", x, alpha, beta);
   output;
end;
run;

proc sgplot data=Check;
series x=x y=y;
refline 0.5 0.95 / axis=y;
refline 4 9 / axis=x;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;.&lt;/P&gt;</description>
      <pubDate>Sun, 18 Feb 2018 12:04:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/Finding-a-gamma-distribution-from-percentiles/m-p/438247#M3023</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2018-02-18T12:04:42Z</dc:date>
    </item>
    <item>
      <title>Re: Finding a gamma distribution from percentiles</title>
      <link>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/Finding-a-gamma-distribution-from-percentiles/m-p/438248#M3024</link>
      <description>&lt;P&gt;Thank you so much for your answer. it works with your example but when checking from this approach from a seminal paper the authors mention pct50 = 8.9 and pct90 = 4.4 the authors found a gamma(5.9, 0.7)&lt;/P&gt;&lt;P&gt;when replacing these values and pct90 vs pct95 from your solution have this warning:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The solution failed because 2 equations are missing or have extreme values for observation&lt;BR /&gt;1 at NEWTON iteration&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't know how to fix this properly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Feb 2018 12:24:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/Finding-a-gamma-distribution-from-percentiles/m-p/438248#M3024</guid>
      <dc:creator>SBuc</dc:creator>
      <dc:date>2018-02-18T12:24:21Z</dc:date>
    </item>
    <item>
      <title>Re: Finding a gamma distribution from percentiles</title>
      <link>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/Finding-a-gamma-distribution-from-percentiles/m-p/438276#M3025</link>
      <description>&lt;P&gt;What is the&amp;nbsp;reference? I believe that you (or the authors) have a typo somewhere. The 50th percentile must be less than the 90th percentile for any valid distribution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You should investigate the meaning of the parameters in your reference. I am using the standard parameterization where the first parameter (alpha) is the shape parameter and the second (beta) is the scale parameter. Other&amp;nbsp;researchers might use an alternative parameterization where the second parameter is a RATE parameter. The relationship&amp;nbsp;is RATE = 1/SCALE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can easily modify the code I provided to graph the CDF&amp;nbsp; for Gamm(5.9, 0.7) or Gamma(5.9, 1/0.7). You will see that neither curve gives the percentiles that you claim.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Check;
alpha = 5.9; beta=0.7;
do x = 0 to 15 by 0.2;
   yScale = cdf("gamma", x, alpha, beta);
   yRate = cdf("gamma", x, alpha, 1/beta);
   output;
end;
run;

proc sgplot data=Check;
series x=x y=yScale / curvelabel;
series x=x y=yRate / curvelabel;
refline 0.5 0.9 / axis=y;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I'll be out of town for the next week, but I&amp;nbsp;think these tips&amp;nbsp;should point you in the right direction. Good luck.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Feb 2018 17:14:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/Finding-a-gamma-distribution-from-percentiles/m-p/438276#M3025</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2018-02-18T17:14:51Z</dc:date>
    </item>
    <item>
      <title>Re: Finding a gamma distribution from percentiles</title>
      <link>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/Finding-a-gamma-distribution-from-percentiles/m-p/440836#M3031</link>
      <description>&lt;P&gt;I wrote a description of four different ways to solve&amp;nbsp;a system of nonlinear&amp;nbsp;equations in SAS. See the article &lt;A href="https://blogs.sas.com/content/iml/2018/02/28/solve-system-nonlinear-equations-sas.html" target="_self"&gt;"Solve a system of nonlinear equations with SAS."&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2018 11:12:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/Finding-a-gamma-distribution-from-percentiles/m-p/440836#M3031</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2018-02-28T11:12:31Z</dc:date>
    </item>
  </channel>
</rss>

