Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Interesting (?) -ml- question


From   Mark Schaffer <[email protected]>
To   [email protected]
Subject   st: Interesting (?) -ml- question
Date   Sat, 04 Sep 2004 17:56:19 +0100 (BST)

Dear Statalisters, and -ml- experts in particular:

I am trying to write an -ml- routine and have hit a peculiar roadblock.  I 
am an -ml- novice, so hopefully there's an easy answer.

The likelihood function that I want to minimize has the form of, say, one 
dependent variable y and 3 independent variables w, x and z.  However, of 
the independent variables, only x has a coefficient associated with it.  
The other two variables, w and z, are needed for calculating the 
likelihood but don't have coefficients.

My question - what's the best way of passing w and z to the likelihood 
function?

I can think of 3 ways, but all seem pretty hacky:

1. Save "w z" as a string in a global macro called, say, MyMLvars.  The 
likelihood program mymlprog knows to look in $MyMLvars to find them.

2. In the ml model command, list w and z as additional endogenous 
variables, e.g.,

ml model d0 mymlprog (y w z = x)

Then mymlprog can find w and z as $ML_y2 and $ML_y3.

3. The hackiest of all - list w and z as indep vars, but constrain the 
coeffs to be zero:

constraint 1 w=0
constraint 2 z=0
ml model d0 mymlprog (y = x w z)

Is there a better way?  Or, if there isn't, which of these is to be 
preferred?

-Mark

________________________________________________________________

DISCLAIMER:

This e-mail and any files transmitted with it are confidential
and intended solely for the use of the individual or entity to
whom it is addressed.  If you are not the intended recipient
you are prohibited from using any of the information contained
in this e-mail.  In such a case, please destroy all copies in
your possession and notify the sender by reply e-mail.  Heriot
Watt University does not accept liability or responsibility
for changes made to this e-mail after it was sent, or for
viruses transmitted through this e-mail.  Opinions, comments,
conclusions and other information in this e-mail that do not
relate to the official business of Heriot Watt University are
not endorsed by it.
________________________________________________________________
*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index