--- Deepankar Basu wrote:
> I am trying to do a maximum likelihood estimation where some of the
> parameters of the model are probabilities; hence they should add up to
> unity.
>
> What is the best way to put restrictions on the relevant parameters and
> constrain them to add up to unity?
Deepankar Basu:
Constraints like these are achieved by transformations, for instance: a
variance is always positive. So when estimating a variance we want to
impose the constraint that it is positive. This is achieved by not
estimating the variance, but the natural logarithm of the variance, which
can be any positive or negative number. Similarly, a common transformation
that ensures a number remains between 0 and 1 is the logit transformation.
The multivariate extension for that would be the multinomial logit
transformation. So if you have three probabilities, the relevant part of
your code would look like:
program whatever_lf
args lnf mlp2 mlp3 ...
tempvar p1 p2 p3
gen double `p1' = 1/(1+exp(`mlp2')+exp(`mlp3'))
gen double `p2' = exp(`mlp2')/(1+exp(`mlp2')+exp(`mlp3'))
gen double `p3' = exp(`mlp3')/(1+exp(`mlp2')+exp(`mlp3'))
very smart likelihood function which uses `p1', `p2', and `p3'
end
Something similar was done in the -dirifit- command, though the code may
be a bit difficult to read since the number of probabilities was not
fixed in advance.
HTH,
Maarten
-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands
visiting adress:
Buitenveldertselaan 3 (Metropolitan), room Z214
+31 20 5986715
http://home.fsw.vu.nl/m.buis/
-----------------------------------------
*
* 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/