# st: RE: Likelihood function of uniform distribution

 From "Verkuilen, Jay" <[email protected]> To <[email protected]> Subject st: RE: Likelihood function of uniform distribution Date Tue, 1 Apr 2008 15:13:25 -0400

```What is your friend trying to do? The problem as posed doesn't make
sense to me. It strikes me that the Stata cart is being put before the
theoretical horse here.

-If you assert that a distribution is U(0,1), there's no free parameter
to do MLE on. Is the idea trying to test whether a given RV is U(0,1)?
In this case, there are numerous tests, many already in Stata, that will
happily do this. Is the idea trying to estimate whether a variable is in
a larger class that also includes U(0,1) as a special case? If so, check
out betafit, which will estimate beta distributions.

-Likelihood estimation of univariate uniform distribution with unknown
upper and lower bound doesn't need anything more than sort because the
MLE is just the sample min and sample max (if I recall correctly). The
distribution theory for quantiles gives you nice confidence intervals.
Given that this is an irregular problem, i.e., on the boundary of the
parameter space, ordinary optimization theory doesn't apply and
asymptotic normality won't give you sensible answers anyway.

Or maybe (probably) it's something else entirely and I can't figure out
what.

Jay

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Bob Hammond
Sent: Tuesday, April 01, 2008 1:58 PM
To: [email protected]
Subject: st: Likelihood function of uniform distribution

This message is from a friend who is having trouble sending a message to

the list. Sorry if his message comes through later as a duplicate.

Hi,

In order to run a Maximum Likelihood Estimation, I need to define the
likelihood function for a uniform distribution. But I am not sure how to

define a uniform probability distribution function in Stata. For
example, I don't know how to define the following function or the
associated likelihood function in Stata:

f(x)=1 if 0<x<1
=0 otherwise.

I have tried the following commands to define the log-likelihood
function of a uniform distribution; however, I think it is NOT an
appropriate way to do it since theta is not penalized when it falls
outside the interval [0,1]:

program myunif
args lnf theta
quietly replace `lnf' =ln(`theta') if \$ML_y1==1
quietly replace `lnf' =ln(1-`theta') if \$ML_y1==0
end

Also, how do you define the following triangular probability
distribution function?

f(x)= 4x if 0<x<0.5
=4-4x if 0.5<x<1
=0 otherwise.

I appreciate any help or comment in advance.

Thanks,

Mostafa

-----------------------------------------------------------------

Mostafa Beshkar
PhD Candidate
Dept of Economics, Vanderbilt University
Phone: 1(615)522-1775
Fax: 1(615)343-8495
www.people.vanderbilt.edu/~mostafa.beshkar
SSRN page:
http://papers.ssrn.com/sol3/cf_dev/AbsByAuth.cfm?per_id=418146
--
------------------------------------------------------------------------
Bob Hammond
Department of Economics
Vanderbilt University http://people.vanderbilt.edu/~robert.g.hammond/
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```