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

st: Defining variables for the ml procedure

Subject   st: Defining variables for the ml procedure
Date   Sun, 9 Oct 2005 12:59:34 -0400

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) = 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.


*   For searches and help try:

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