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

Re: st: MLE parameters


From   Eddy <[email protected]>
To   [email protected]
Subject   Re: st: MLE parameters
Date   Tue, 10 Feb 2004 22:50:38 -0800 (PST)

Wednesday, February 11, 2004, 2:18:41 PM, Atip Asvanund wrote:

> Dear all,

> If I have a program with the following signature:

> program mobile2_1
>         version 8.1
>         args lnf plan_code voice mu sigma

> What I want to do is I want to use MLE to find the best "mu" and
"sigma"
> that will maximize my likelihood. These will be constants.
Parameters
> "plan_code" and "voice" are to be entered as arguments to the
likeihood
> estimation, although I do not want to estimate any coeficient about
them.
> Let's say I have data columns called "plan_code" and "voice" within
my
> dataset that I want to use in my likelihood calculation. For each
> observation I want to do something like:

> replace `lnf' = such and such if `voice' > 10 & `plan_code' == 1
> replace `lnf' = so and so if `voice' <= 10 & `plan_code' == 0

> You get the idea.

> Currently, I am bootstraping with:

> ml model lf mobile2_1 (plan_code) (voice) () ()

> However, it doesn't seem to be working.


If variables "voice" and "plan_code" won't change from data to data,
you may directly code the variable names in the ado file, as follows.

 args lnf mu sigma
 ......
 replace `lnf' = such and such if voice > 10 & plan_code == 1
 replace `lnf' = so and so if voice <= 10 & plan_code == 0

Then, in the do file,

  ml model lf mobile2_1  () ()

If, on the other hand, different variables are to be used in places
of "voice" and "plan_code", you may use global macro defining them in
the outset of the ML function, and use the macro in the ML ado file.
That is, in the ML ado file, you have something like the follows:

 args lnf mu sigma
 .....
 replace `lnf' = such and such if $myvoice > 10 & $myplan == 1
 replace `lnf' = so and so if $myvoice <= 10 & $myplan == 0

Then in your do file, you code

 global myvoice voice /* so that $myvoice is the variable "voice" */
 global myplan  plan_code /* so that $myplan is the variable
"plan_code" */
 ml model lf mobile2_1  () ()
 .....

You can define different variables for $myvoice and $myplan by
changing the first two lines above.

Hope this helps.

Eddy





__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html
*
*   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