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

Re: st: Defining variables for the ml procedure


From   Ed Blackburne <[email protected]>
To   [email protected]
Subject   Re: st: Defining variables for the ml procedure
Date   Mon, 10 Oct 2005 18:42:08 -0500

Bjorn,

I do have a solution in mind that will do what you want.
When I get near a Stata machine, I will write a bit of code to show you.

I struggled with a problem close to what you're having, so I am glad to
help out if, in fact, it saves you some time.

If you are able to send me a brief message, perhaps offlist, detailing
the exact nature of the model you wish to estimate, I can get the code
as close as possible.

For example, it appears you have a panel dataset -- are you estimating
pooled coefficients (common slopes), heterogeneous panels, a
combination, or what?

My email address is blackburne at shsu dot edu

-Ed

On Mon, 2005-10-10 at 17:02 -0400, [email protected] wrote:
> Ed,
> 
> Thank you very much for your message, your code does accomplish what I
> want to do in principle.
> 
> Unfortunately, however, the regression equation I want to estimate is
> actually in logarithms:
> 
> log(consumption) = a + b*(log(c*income[_n-1] + invest))
> 
> (I am sorry, I should have mentioned this). In this case, I guess I
> cannot use this method since it is no longer possible to retrieve the
> parameter c, right? Would you have any ideas on an alternative method?
> 
> Thanks again for all your help!
> 
> Best Regards
> Bjorn
> 
> 
> 
> 
> Quoting Ed Blackburne <[email protected]>:
> 
> > Bjorn,
> >
> > I am perhaps misunderstanding your model.
> >
> > Here is a code snippet you can paste into to Stata and run.
> >
> > ****************Begin do file********************
> >
> > webuse lutkepohl
> >
> > *** Estimate consumption=a+b*(c*income[_n-1]+invest)
> > *** The reduced form is consumption=a + d*l.income + b*investment
> > *** This is what we will estimate with Stata
> >
> > regress consu l.income invest
> >
> > *** From these estimates, we can recover parameter c.
> > *** Since d=b*c, we have c=d/b
> > *** In Stata speak this is _b[l.income]/_b[investment]
> >
> > nlcom (_b[l.income]/_b[investment])
> >
> > *************End do file
> >
> >
> > Does that accomplish your task?
> >
> > Let me know.
> >
> > Ed
> >
> >
> > On Mon, 2005-10-10 at 13:47 -0400, [email protected] wrote:
> >> Hi Ed,
> >>
> >> Thank you for your reply.  Your Option 2 sounds very promising and I
> >> would be very grateful for any hints and advice you might have on how
> >> to use it.
> >>
> >> (As I understand it, I cannot use Option 1 because the variable Z is
> >> unobserved. Since it depends on the unknown coefficient c, the
> >> variable Z must somehow be generated as a part of (that is,
> >> simultaneously as) the estimation of the regression equation
> >>
> >> y = a + b*(c*Z[_n-1] + x))
> >>
> >> Please let me know if this is not clear, and thanks for your help!
> >>
> >> Best Regards
> >> Bjorn
> >>
> >>
> >>
> >> Quoting Ed Blackburne <[email protected]>:
> >>
> >> > Bjorn,
> >> >
> >> > My understanding is that you want to estimate an equation of the form
> >> > (it doesn't much matter whether it is Z or Z[_N-1] for this post):
> >> >
> >> > y=a+b(cZ+x)
> >> >
> >> > Is this correct?
> >> > If so, I see two options.
> >> >
> >> > Option 1: Estimate y=a+dZ+bx and use nlcom to recover c:
> >> > 	nlcom _b[Z]/_b[x]
> >> >
> >> > Option 2: You can estimate via conditional likelihood (aka profile
> >> > likelihoods) using the undocumented hold option of ml.
> >> >
> >> > If you would like a pointer at Option 2 let me know.
> >> >
> >> > -Ed
> >> >
> >> >
> >> > On Sun, 2005-10-09 at 12:59 -0400, [email protected] wrote:
> >> >> Dear Statalist,
> >> >>
> >> >> I am trying to estimate a nonlinear regression equation using the ml
> >> >> routine, and I am having problems defining one of my input variables.
> >> >>  Specifically, I would like to use the recursively defined variable
> >> >> Z(it):
> >> >>
> >> >> Z(it) = c*Z(it-1) + X(it)
> >> >>
> >> >> as an independent variable in my regression equation.  If the
> >> >> coefficient "c" is known, this variable can be generated as follows:
> >> >>
> >> >> gen Z = X
> >> >> bysort group (time): replace Z = c * Z[_n-1] + X if _n >= 2
> >> >>
> >> >> My problem is that I would like to estimate the coefficient "c" (along
> >> >> with the other regression coefficients) and therefore I need to define
> >> >> the variable Z(it) "within" the program itself.
> >> >>
> >> >> It seems, however, as if the "by" command and the "if" command are not
> >> >> allowed when specifying variables in the ml programs.  I would be most
> >> >> grateful if anyone would have any ideas on how to do this.
> >> >>
> >> >> Thank you for your help.
> >> >>
> >> >> Best
> >> >> Bjorn
> >> >>
> >> >>
> >> >>
> >> >> *
> >> >> *   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/
> >>
> >>
> >>
> >>
> >>
> >> *
> >> *   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/
> 
> 
> 
> 
> 
> *
> *   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/



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