<?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: Estimating Logistic distribution parameters using MLE method in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Estimating-Logistic-distribution-parameters-using-MLE-method/m-p/576824#M13107</link>
    <description>&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have SAS Foundation 9.3 (I don't know exactly the maintainance version of the release). &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyway, I own other software as SAS Enterprise Guide 5.1, but it gives the same error...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there another way to do that??&lt;/P&gt;</description>
    <pubDate>Fri, 26 Jul 2019 07:42:05 GMT</pubDate>
    <dc:creator>pquant</dc:creator>
    <dc:date>2019-07-26T07:42:05Z</dc:date>
    <item>
      <title>Estimating Logistic distribution parameters using MLE method</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Estimating-Logistic-distribution-parameters-using-MLE-method/m-p/570896#M12051</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to estimate the scale and the shape parameters of the logistic distribution, given data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any knows about a built-in SAS procedure to do that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks all in advance.&lt;/P&gt;&lt;P&gt;Any help will be appreciated. &lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://communities.sas.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jul 2019 10:52:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Estimating-Logistic-distribution-parameters-using-MLE-method/m-p/570896#M12051</guid>
      <dc:creator>pquant</dc:creator>
      <dc:date>2019-07-03T10:52:00Z</dc:date>
    </item>
    <item>
      <title>Re: Estimating Logistic distribution parameters using MLE method</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Estimating-Logistic-distribution-parameters-using-MLE-method/m-p/570907#M12052</link>
      <description>&lt;P&gt;You could try PROC NLIN . and&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp; could give you a hand .&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jul 2019 11:09:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Estimating-Logistic-distribution-parameters-using-MLE-method/m-p/570907#M12052</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-07-03T11:09:49Z</dc:date>
    </item>
    <item>
      <title>Re: Estimating Logistic distribution parameters using MLE method</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Estimating-Logistic-distribution-parameters-using-MLE-method/m-p/570914#M12053</link>
      <description>Thanks &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt; for your help!!</description>
      <pubDate>Wed, 03 Jul 2019 11:14:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Estimating-Logistic-distribution-parameters-using-MLE-method/m-p/570914#M12053</guid>
      <dc:creator>pquant</dc:creator>
      <dc:date>2019-07-03T11:14:16Z</dc:date>
    </item>
    <item>
      <title>Re: Estimating Logistic distribution parameters using MLE method</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Estimating-Logistic-distribution-parameters-using-MLE-method/m-p/571268#M12136</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/275292"&gt;@pquant&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let me first say that I've used PROC NLIN only very rarely. (&lt;A href="https://communities.sas.com/t5/SAS-Procedures/Fitting-a-gamma-curve-and-mle/m-p/507093#M72846" target="_blank" rel="noopener"&gt;My only previous post involving this procedure&lt;/A&gt; was one of those exceptions.) So, regular users of&amp;nbsp;PROC NLIN could find my code awkward or inefficient (and then hopefully suggest a better solution), but here it is:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Create sample data for demonstration */

data have;
call streaminit(27182818);
do _n_=1 to 100;
  x=rand('logistic',10,1);
  output;
end;
run;

/* Determine initial estimates a0, b0 for     */
/* location parameter a and scale parameter b */

proc summary data=have;
var x;
output out=stats(drop=_:) n=n median=m std=s;
run;

data _null_;
set stats;
call symputx('n',n);
call symputx('a0',m);
call symputx('b0',sqrt(3)/constant('pi')*s);
run;

/* Prepare input dataset for PROC NLIN */

proc transpose data=have out=trans(drop=_:) prefix=x;
var x;
run;

data trans2;
set trans trans;
y=&amp;amp;n/_n_; /* RHS of maximum-likelihood equation (=LHS of "MODEL" */
run; /* 2 obs. */                 /* equation in PROC NLIN step) */

/* Solve for maximum-likelihood estimates */

ods select EstSummary ParameterEstimates;
ods output ParameterEstimates=est(keep=parameter estimate);
proc nlin data=trans2;
parms a=&amp;amp;a0 b=&amp;amp;b0;
array x[&amp;amp;n];
array z[2];
z1=0; z2=0;
do i=1 to &amp;amp;n;
  t=(x[i]-a)/b;
  z1+t*(1-2/(1+exp(t)));
  z2+1/(1+exp(t));
end;
model y=z[_obs_];
run;

proc print data=est noobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;PROC PRINT output:&lt;/P&gt;
&lt;PRE&gt;Parameter    Estimate

    a          9.9905
    b          1.0044&lt;/PRE&gt;
&lt;P&gt;(The deviations from the "true" parameters 10 and 1 are, of course, primarily due to random fluctuations in the sample of size 100.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The idea was to solve the maximum-likelihood equations (partial derivatives of the log-likelihood function equated to zero) with PROC NLIN. The first observation of input dataset TRANS2 corresponds to the&amp;nbsp;partial derivative&amp;nbsp;with respect to &lt;FONT face="courier new,courier"&gt;b&lt;/FONT&gt; (more precisely: "&lt;FONT face="courier new,courier"&gt;b&lt;/FONT&gt; &lt;EM&gt;hat&lt;/EM&gt;") and the second corresponds&amp;nbsp;to the&amp;nbsp;partial derivative with respect to &lt;FONT face="courier new,courier" size="3"&gt;â&lt;/FONT&gt;. I found the two equations in my standard reference [1], but it turned out that one of them contained a mistake (missing minus sign on the RHS: "...=n" should read "...=&lt;STRONG&gt;−&lt;/STRONG&gt;n", p.128). I recalculated the equations by hand and used my results in the code. Moreover, I double-checked the formula from [1], p. 125, for the variance of the logistic distribution (used in the &lt;FONT face="courier new,courier"&gt;data _null_&lt;/FONT&gt; step).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Reference:&lt;/P&gt;
&lt;P&gt;[1] Evans, M., Hastings, N. and Peacock, B. (2000), Statistical Distributions, 3rd ed., John Wiley &amp;amp; Sons, New York.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2019 18:02:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Estimating-Logistic-distribution-parameters-using-MLE-method/m-p/571268#M12136</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2019-07-04T18:02:22Z</dc:date>
    </item>
    <item>
      <title>Re: Estimating Logistic distribution parameters using MLE method</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Estimating-Logistic-distribution-parameters-using-MLE-method/m-p/576505#M13069</link>
      <description>&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for your answer, but the rand() sas function does not support the logistic distribution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;By running the first datastep, SAS gives the following error:&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;ERROR: The first argument of the RAND function must be a character string with a value of
       BERNOULLI, BETA, BINOMIAL, CAUCHY, CHISQUARE, ERLANG, EXPONENTIAL, F, GAMMA, GAUSSIAN,
       GEOMETRIC, HYPERGEOMETRIC, LOGNORMAL, NEGB, NORMAL, POISSON, T, TABLE, TRIANGULAR,
       UNIFORM, or WEIBULL.
NOTE: Argument 1 to function RAND at line 5 column 5 is invalid.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;So, it does not work!&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jul 2019 09:01:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Estimating-Logistic-distribution-parameters-using-MLE-method/m-p/576505#M13069</guid>
      <dc:creator>pquant</dc:creator>
      <dc:date>2019-07-25T09:01:40Z</dc:date>
    </item>
    <item>
      <title>Re: Estimating Logistic distribution parameters using MLE method</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Estimating-Logistic-distribution-parameters-using-MLE-method/m-p/576811#M13105</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/275292"&gt;@pquant&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;thanks for your answer, but the rand() sas function does not support the logistic distribution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By running the first datastep, SAS gives the following error ...&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/275292"&gt;@pquant&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The RAND function does support the logistic distribution in release SAS 9.4M5: see &lt;A href="https://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=p0fpeei0opypg8n1b06qe4r040lv.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en#p0n4d1rymy8b5qn188njfgd0854r" target="_blank" rel="noopener"&gt;documentation&lt;/A&gt;. Sorry, I wasn't aware that the logistic distribution is among the more recent additions to the RAND function (and that you are working with a different, likely older SAS release). These recent additions also include the convenient&amp;nbsp;&lt;A href="https://documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=p0fpeei0opypg8n1b06qe4r040lv.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en#p0i0papjdn73pzn1kxrjoyygmdfb" target="_blank" rel="noopener"&gt;"Integer" distribution&lt;/A&gt;, which I've been using frequently since I upgraded from 9.4M2 to M5. What is your version and maintenance release?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyway, you don't need to run that DATA step, which is there just to &lt;FONT face="courier new,courier"&gt;/* Create sample data for demonstration */&lt;/FONT&gt;. You would apply the steps below that DATA step to &lt;EM&gt;your&lt;/EM&gt; data for which you don't know the distribution parameter values, not to artificial sample data with known parameter values.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jul 2019 06:24:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Estimating-Logistic-distribution-parameters-using-MLE-method/m-p/576811#M13105</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2019-07-26T06:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: Estimating Logistic distribution parameters using MLE method</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Estimating-Logistic-distribution-parameters-using-MLE-method/m-p/576824#M13107</link>
      <description>&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have SAS Foundation 9.3 (I don't know exactly the maintainance version of the release). &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyway, I own other software as SAS Enterprise Guide 5.1, but it gives the same error...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there another way to do that??&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jul 2019 07:42:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Estimating-Logistic-distribution-parameters-using-MLE-method/m-p/576824#M13107</guid>
      <dc:creator>pquant</dc:creator>
      <dc:date>2019-07-26T07:42:05Z</dc:date>
    </item>
    <item>
      <title>Re: Estimating Logistic distribution parameters using MLE method</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Estimating-Logistic-distribution-parameters-using-MLE-method/m-p/576891#M13120</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/275292"&gt;@pquant&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Is there another way to do that??&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes, there is! You can create a random sample from a logistic distribution by transforming a random sample from a uniform distribution on the unit interval [0, 1], which &lt;EM&gt;is&lt;/EM&gt; available in your SAS version (&lt;FONT face="courier new,courier"&gt;rand('uniform')&lt;/FONT&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Specify the parameters of a logistic distribution */

%let a=10; /* location parameter (mean) */
%let b=1;  /* scale parameter, must be positive */

/* Create a random sample of size 100 from the logistic distribution 
   with location parameter (mean) &amp;amp;a and scale parameter &amp;amp;b&amp;gt;0 */

data have(drop=r);
call streaminit(27182818);
do _n_=1 to 100;
  r=rand('uniform');
  x=&amp;amp;a+&amp;amp;b*log(r/(1-r));
  output;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It turns out that the newer RAND('logistic',a,b) function seems to use the same algorithm internally (at least in my SAS version), so you may even get (almost) the same random numbers with the code shown above.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But, again, this is actually not necessary for the purpose we've discussed in this thread. It's only important that none of the &lt;EM&gt;other&lt;/EM&gt; steps, after the first DATA step fails because of unavailable features. It was just me who needed the DATA step because I don't have your data. Just replace "HAVE" by the name of your dataset in the PROC SUMMARY and PROC TRANSPOSE steps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;According to &lt;A href="https://blogs.sas.com/content/iml/2013/08/02/how-old-is-your-version-of-sas-release-dates-for-sas-software.html" target="_blank" rel="noopener"&gt;this blog entry&lt;/A&gt; SAS 9.4 was first released in 2013. &lt;A href="https://support.sas.com/en/software/enterprise-guide-support.html#documentation" target="_blank" rel="noopener"&gt;Documentation&lt;/A&gt; suggests that the current SAS Enterprise Guide version is &lt;STRONG&gt;8&lt;/STRONG&gt;.1. So, I would consider an upgrade to avoid issues like this.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jul 2019 13:21:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Estimating-Logistic-distribution-parameters-using-MLE-method/m-p/576891#M13120</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2019-07-26T13:21:14Z</dc:date>
    </item>
  </channel>
</rss>

