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
> that will maximize my likelihood. These will be constants.
> "plan_code" and "voice" are to be entered as arguments to the
> estimation, although I do not want to estimate any coeficient about
> Let's say I have data columns called "plan_code" and "voice" within
> 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.


Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
*   For searches and help try:

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