<?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: Proc Lifereg Predicted Values Calculation in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Lifereg-Predicted-Values-Calculation/m-p/417187#M21906</link>
    <description>&lt;P&gt;Are you trying to manually recreate the calculations? Or is something happening that you think is incorrect?&lt;/P&gt;</description>
    <pubDate>Wed, 29 Nov 2017 19:12:01 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-11-29T19:12:01Z</dc:date>
    <item>
      <title>Proc Lifereg Predicted Values Calculation</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Lifereg-Predicted-Values-Calculation/m-p/417186#M21905</link>
      <description>&lt;P&gt;Good Day.&lt;BR /&gt;&lt;BR /&gt;I'm trying to determine how SAS calculates the predicted values in proc lifereg.&amp;nbsp; The calculation is described here:&amp;nbsp;&lt;A href="https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_lifereg_sect020.htm" target="_blank"&gt;https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_lifereg_sect020.htm&lt;/A&gt; .&amp;nbsp; The default value of p is .5.&amp;nbsp; The code below shows an example.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.SomeStuff (drop = i);

call streaminit(666);

do i = 1 to 100000;

	PredictorVariable = rand('uniform');

	LinearPartOfTheMean = 2 * PredictorVariable + 3;

	/* Create a gamma random variable */

	GammaVariable = rand('gamma', exp(LinearPartOfTheMean));

	output;

end;

run;

proc lifereg data = work.SomeStuff
outest = work.GammaEstimates (keep = Intercept PredictorVariable _scale_ _shape1_
rename = (Intercept = GammaIntercept PredictorVariable = GammaPredictorVariable _scale_ = GammaScale _shape1_ = GammaShape));
model GammaVariable = PredictorVariable / distribution = gamma;
output out = work.SomeStuff02 (drop = _prob_) predicted = GammaPrediction;
run;

data work.SomeStuff02 (drop = GammaIntercept GammaPredictorVariable GammaScale GammaShape);
set work.SomeStuff02;

if _n_ = 1 then set work.GammaEstimates;

GammaPrediction02 = exp(GammaIntercept + GammaPredictorVariable * PredictorVariable);

Ratio = GammaPrediction / GammaPrediction02;

run;

proc print data = work.SomeStuff02 (obs = 10);
where GammaPrediction &amp;lt; GammaPrediction02;
run;

proc means data = work.SomeStuff02 min max;
var Ratio;
run;

proc print data = work.GammaEstimates;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The SAS documentation indicates that I need to add the scale parameter multiplied by the value of u_p, which for the gamma distribution is computed numerically, to what is exponentiated in GammaPrediction02.&amp;nbsp; How is the value of u_p computed?&amp;nbsp; Moreover, since the scale parameter in the example is positive, the value of u_p must be negative to achieve a value less than 1 for the value of Ratio.&amp;nbsp; However, this is impossible since u_p is a quantile from a gamma distribution which has only positive support.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your time and attention in this matter.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2017 19:10:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Lifereg-Predicted-Values-Calculation/m-p/417186#M21905</guid>
      <dc:creator>IanDeters</dc:creator>
      <dc:date>2017-11-29T19:10:14Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Lifereg Predicted Values Calculation</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Lifereg-Predicted-Values-Calculation/m-p/417187#M21906</link>
      <description>&lt;P&gt;Are you trying to manually recreate the calculations? Or is something happening that you think is incorrect?&lt;/P&gt;</description>
      <pubDate>Wed, 29 Nov 2017 19:12:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Lifereg-Predicted-Values-Calculation/m-p/417187#M21906</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-11-29T19:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Lifereg Predicted Values Calculation</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Lifereg-Predicted-Values-Calculation/m-p/417218#M21911</link>
      <description>I'm trying to manually recreate the calculations to better understand the procedure. I've been able to do it for all other distributions using the SAS documentation.</description>
      <pubDate>Wed, 29 Nov 2017 20:20:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Lifereg-Predicted-Values-Calculation/m-p/417218#M21911</guid>
      <dc:creator>IanDeters</dc:creator>
      <dc:date>2017-11-29T20:20:29Z</dc:date>
    </item>
  </channel>
</rss>

