<?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: How do I integrate pdf to cdf using SAS Enterpriseguide? in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-integrate-pdf-to-cdf-using-SAS-Enterpriseguide/m-p/789046#M40103</link>
    <description>I understand, but I did use lambda to get the final fitted gamma pdf. Lambda is a constant and we integrate pdf to get cdf , so if I simply multiply lambad by cdf("gamma", x, alpha, beta), I get very small number and it is no way near 1. What am I missing here?</description>
    <pubDate>Sat, 08 Jan 2022 16:49:13 GMT</pubDate>
    <dc:creator>star68</dc:creator>
    <dc:date>2022-01-08T16:49:13Z</dc:date>
    <item>
      <title>How do I integrate pdf to cdf using SAS Enterpriseguide?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-integrate-pdf-to-cdf-using-SAS-Enterpriseguide/m-p/789010#M40100</link>
      <description>&lt;P&gt;I have fitted a distribution curve using gamma probability density distribution with 3 parameters.&amp;nbsp; The following are my codes:&lt;/P&gt;&lt;P&gt;proc nlin data=worker_distribution&lt;BR /&gt;method=marquardt ;&lt;BR /&gt;parameters alpha=3 beta=2 lambda=0.01 ;&lt;BR /&gt;model percentcount=pdf("gamma",ratio,alpha,beta)*lambda;&lt;BR /&gt;output out=fitworker predicted=predworker parms= alpha beta lambda;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;How do I create the cdf in SAS EG based on the fitted gamma pdf distribution?&amp;nbsp; Thanks.&lt;/P&gt;</description>
      <pubDate>Sat, 08 Jan 2022 02:24:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-integrate-pdf-to-cdf-using-SAS-Enterpriseguide/m-p/789010#M40100</guid>
      <dc:creator>star68</dc:creator>
      <dc:date>2022-01-08T02:24:55Z</dc:date>
    </item>
    <item>
      <title>Re: How do I integrate pdf to cdf using SAS Enterpriseguide?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-integrate-pdf-to-cdf-using-SAS-Enterpriseguide/m-p/789027#M40101</link>
      <description>&lt;P&gt;Calling&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Jan 2022 11:27:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-integrate-pdf-to-cdf-using-SAS-Enterpriseguide/m-p/789027#M40101</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-01-08T11:27:14Z</dc:date>
    </item>
    <item>
      <title>Re: How do I integrate pdf to cdf using SAS Enterpriseguide?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-integrate-pdf-to-cdf-using-SAS-Enterpriseguide/m-p/789031#M40102</link>
      <description>&lt;P&gt;If you have the estimates for the alpha and beta parameters in the gamma distribution, you can use the PDF function to visualize the density and use the CDF function to visualize the cumulative probability, as discussed in the article, &lt;A href="https://blogs.sas.com/content/iml/2011/10/19/four-essential-functions-for-statistical-programmers.html" target="_self"&gt;"Four essential functions for statistical programmers."&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example, suppose the estimate of the shape parameter is 3.2 and the estimate for the scale parameter is 2.1. Then the following DATA step evaluates the PD and CDF at a set of values in [0, 20] and plots the result:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Gamma;
alpha = 3.2;  /* shape parameter */
beta = 2.1;   /* scale parameter */
do x = 0.1 to 20 by 0.1;
   pdf = PDF("gamma", x, alpha, beta);
   cdf = CDF("gamma", x, alpha, beta);
   output;
end;
run;

title "PDF and CDF of the Gamma Distribution";
title2 "Shape=3.2; Scale=2.1";
proc sgplot data=Gamma;
   series x=x y=PDF;
   series x=x y=CDF;
   yaxis grid;
   xaxis grid;
run;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 08 Jan 2022 11:53:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-integrate-pdf-to-cdf-using-SAS-Enterpriseguide/m-p/789031#M40102</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2022-01-08T11:53:04Z</dc:date>
    </item>
    <item>
      <title>Re: How do I integrate pdf to cdf using SAS Enterpriseguide?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-integrate-pdf-to-cdf-using-SAS-Enterpriseguide/m-p/789046#M40103</link>
      <description>I understand, but I did use lambda to get the final fitted gamma pdf. Lambda is a constant and we integrate pdf to get cdf , so if I simply multiply lambad by cdf("gamma", x, alpha, beta), I get very small number and it is no way near 1. What am I missing here?</description>
      <pubDate>Sat, 08 Jan 2022 16:49:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-integrate-pdf-to-cdf-using-SAS-Enterpriseguide/m-p/789046#M40103</guid>
      <dc:creator>star68</dc:creator>
      <dc:date>2022-01-08T16:49:13Z</dc:date>
    </item>
    <item>
      <title>Re: How do I integrate pdf to cdf using SAS Enterpriseguide?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-integrate-pdf-to-cdf-using-SAS-Enterpriseguide/m-p/789053#M40104</link>
      <description>&lt;P&gt;What are the estimates of&amp;nbsp;&lt;SPAN&gt;alpha, beta, and lambda?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Jan 2022 17:33:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-integrate-pdf-to-cdf-using-SAS-Enterpriseguide/m-p/789053#M40104</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2022-01-08T17:33:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do I integrate pdf to cdf using SAS Enterpriseguide?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-integrate-pdf-to-cdf-using-SAS-Enterpriseguide/m-p/789058#M40105</link>
      <description>&lt;P&gt;I appreciate your quick responses.&amp;nbsp; Here are the parameters from the fitting procedure and I attached pdf graphs.&amp;nbsp; Once again, thank you for your help.&lt;/P&gt;&lt;P&gt;Alpha=3.1264265313&lt;/P&gt;&lt;P&gt;Beta=0.1878574508&lt;/P&gt;&lt;P&gt;Lambda=0.0096286931&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="star68_0-1641665399927.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/67228i0C2054DB30CC8E6A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="star68_0-1641665399927.png" alt="star68_0-1641665399927.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Jan 2022 18:10:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-integrate-pdf-to-cdf-using-SAS-Enterpriseguide/m-p/789058#M40105</guid>
      <dc:creator>star68</dc:creator>
      <dc:date>2022-01-08T18:10:37Z</dc:date>
    </item>
    <item>
      <title>Re: How do I integrate pdf to cdf using SAS Enterpriseguide?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-integrate-pdf-to-cdf-using-SAS-Enterpriseguide/m-p/789082#M40106</link>
      <description>I thought I responded, but could not find my post. Rick, Thank you so much for your quick responses. Here are the parameters from the fitted gamma pdf procedure. I tried to attach the fitted graph in the quick reply, but I was not able to&lt;BR /&gt;alpha=3.1264265313&lt;BR /&gt;beta=0.1878574508&lt;BR /&gt;lambda=0.0096286931&lt;BR /&gt;</description>
      <pubDate>Sat, 08 Jan 2022 21:37:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-integrate-pdf-to-cdf-using-SAS-Enterpriseguide/m-p/789082#M40106</guid>
      <dc:creator>star68</dc:creator>
      <dc:date>2022-01-08T21:37:30Z</dc:date>
    </item>
    <item>
      <title>Re: How do I integrate pdf to cdf using SAS Enterpriseguide?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-integrate-pdf-to-cdf-using-SAS-Enterpriseguide/m-p/789092#M40109</link>
      <description>&lt;P&gt;&lt;EM&gt;&amp;gt;&amp;nbsp;&amp;nbsp;I did use lambda to get the final fitted gamma pdf. Lambda is a constant and we integrate pdf to get cdf , so if I simply multiply lambda by cdf("gamma", x, alpha, beta), I get very small number and it is no way near 1. What am I missing here?&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might be missing that there are two quantities being estimated. You use lambda to estimate the &lt;STRONG&gt;model&lt;/STRONG&gt; for the percentCount variable. The predicted mean of percentCount at the ratio r is&amp;nbsp;&lt;/P&gt;
&lt;P&gt;predworker = lambda*(pdf("gamma", r, alpha, beta)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Notice that predworker is not a density. It does not integrate to unity. It will integrate to lambda, which for your data is approximately 0.01, which is "a very small number."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The following program simulates some data, then uses PROC NLIN to estimate the parameters. I then graph the PDF and the predicted mean for PredWorker.&amp;nbsp; The PDF integrates to unity. The predicted model does not integrate to unity.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Have;
call streaminit(1);
alpha=3;
beta=0.2;
lambda=0.01;
do i = 1 to 100;
    ratio = rand("uniform", 0, 3);
    percentcount=pdf("gamma",ratio,alpha,beta)*lambda + rand("Normal",0, 0.001);
    output;
end;
drop alpha beta lambda;
run;

title "Observed PercentCount per Ratio";
proc sgplot data=Have;
scatter x=ratio y=percentcount;
run;


proc nlin data=have method=marquardt ;
parameters alpha=3 beta=2 lambda=0.01 ;
model percentcount=pdf("gamma",ratio,alpha,beta)*lambda;
output out=fitworker predicted=predworker parms= alpha beta lambda;
run;

proc sort data=fitworker; by ratio; run;
proc sgplot data=fitworker;
scatter x=ratio y=percentcount;
series x=ratio y=predworker;
run;

data Gamma;
set fitworker(obs=1 keep=alpha beta lambda);
do x = 0.05 to 3 by 0.05;
   pdf = PDF("gamma", x, alpha, beta);
   cdf = CDF("gamma", x, alpha, beta);
   pred = pdf*lambda;
   output;
end;
run;

title "PDF('Gamma') and Predicted Values";
proc sgplot data=Gamma;
   series x=x y=PDF;
   series x=x y=pred;
   yaxis grid;
   xaxis grid;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If this does not answer your question, you'll have to post some sample data and the code you are using to integrate whatever function you are integrating.&lt;/P&gt;</description>
      <pubDate>Sat, 08 Jan 2022 23:55:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-integrate-pdf-to-cdf-using-SAS-Enterpriseguide/m-p/789092#M40109</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2022-01-08T23:55:48Z</dc:date>
    </item>
    <item>
      <title>Re: How do I integrate pdf to cdf using SAS Enterpriseguide?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-integrate-pdf-to-cdf-using-SAS-Enterpriseguide/m-p/789143#M40114</link>
      <description>Thank you very much, Rick. You have identified the problem that the predworker is not a density, so it does not integrate to unity.</description>
      <pubDate>Sun, 09 Jan 2022 16:19:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-do-I-integrate-pdf-to-cdf-using-SAS-Enterpriseguide/m-p/789143#M40114</guid>
      <dc:creator>star68</dc:creator>
      <dc:date>2022-01-09T16:19:18Z</dc:date>
    </item>
  </channel>
</rss>

