Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# st: RE: Re: about MLE of exponential distribution

 From Nick Cox <[email protected]> To "'[email protected]'" <[email protected]> Subject st: RE: Re: about MLE of exponential distribution Date Wed, 7 Mar 2012 16:57:24 +0000

```Other possibilities include -ereg- (undocumented, but still easy to use).

Nick
[email protected]

Maarten Buis

On Wed, Mar 7, 2012 at 4:40 PM, mahadeb poudel wrote me privately:
> I am using a six probability distribution function namely Normal, Beta,
> Gamma, Weibull, Lognormal, and Exponetial for the yield risk analysis of
> rice in my PhD dissertation research. I want to estimate the parameters of
> each distribution by using Maximum likelihood method. For this, I am using
> log likelihood estimation method. So, far I can estimate the parameters
> of Normal, Gamma, Weibull, and Lognormal, however I can not estimate the
> parameters of Beta and Exponential distribution. The exponential
> distribution I have applied is
>
> program define expon
>   1.version 11.0
>   2. args lnf lamda
>   3. quietly replace `lnf'= ln(`lamda ')-(`lamda')*(\$ML_Y1)
>   4. end
>
> ml model lf expon (theta:nepn=time timesq)
> ml search
> ml maximize
>
> I always get: invalid syntax r(198)
>
> the problem?

Questions like these should not be sent privately, but instead to the
statalist. Reasons for that are discussed here:
<http://www.stata.com/support/faqs/res/statalist.html#private>

I would not try to program that yourself, as it has already been done.
For the normal/Gaussian distribution you can just use -regress- or
the -betafit-, -gammafit- -weibullfit-, -lognfit- packages from SSC,
see: -help ssc-.

With the appropriate constraints you can use -gammafit- to estimate an
exponential distribution. In that case you don't want to use the
-alphavar()- option and constrain the constant of the alpha equation
to 1, and typically you parametrize an exponential distribution in
terms of a rate, which you can get by specifying the -alt- option:

constraint 1 [alpha]_b[_cons] = 1
gammafit varname, alt constr(1)

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```