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

st: nl with lags


From   "Terra Curtis" <terra.curtis@cambridgefinance.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: nl with lags
Date   Fri, 26 Aug 2005 17:05:06 -0400

Dear Stata users,

I have unbalanced panel data on companies over years and am trying to run a
nonlinear regression in Stata which has lagged variables as regressors.  I
keep coming up with the r(480) message which says "starting values invalid
or some RHS variables have missing values." The code I have written is
below:

program nlnissim
	version 8.1
	if "`1'" == "?" {
		global S_1 "A G1 G2 G3 G4 G5 D1 D2 D3 D4 D5"
		global A=1
		global G1=1
		global G2=1
		global G3=1
		global G4=1
		global G5=1
		global G6=1
		global G7=1
		global G8=1
		global G9=1
		global G10=1
		global D1=1
		global D2=1
		global D3=1
		global D4=1
		global D5=1
		global D6=1
		global D7=1	
		global D8=1
		global D9=1
		global D10=1
		exit
	}
	replace `1' = $A*L.OIa + ($G1*L.ireal46 + $G2*L2.ireal46 +
$G3*L3.ireal46 + $G4*L4.ireal46 + $G5*L5.ireal46 + $G6*L6.ireal46 +
$G7*L7.ireal46 + $G8*L8.ireal46 + $G9*L9.ireal46 + $G10*L10.ireal46) +
$A*($G1*L2.ireal46 + $G2*L3.ireal46 + $G3*L4.ireal46 + $G4*L5.ireal46 +
$G5*L6.ireal46 + $G6*L7.ireal46 + $G7*L8.ireal46 + $G8*L9.ireal46 +
$G9*L10.ireal46 + $G10*L11.ireal46) + ($D1*L.imktg + $D2*L2.imktg +
$D3*L3.imktg + $D4*L4.imktg + $D5*L5.imktg + $D6*L6.imktg + $D7*L7.imktg +
$D8*L8.imktg + $D9*L9.imktg + $D10*L10.imktg) + $A*($D1*L2.imktg +
$D2*L3.imktg + $D3*L4.imktg + $D4*L5.imktg + $D5*L6.imktg + $D6*L7.imktg +
$D7*L8.imktg + $D8*L9.imktg + $D9*L10.imktg + $D10*L11.imktg) 
end                                     

nl nissim OIa ireal46 imktg

It is an 11 lag model and my guess is that the error is arising since not
all companies have all 11 lags.  Is there a way to tell Stata to ignore
those observations or any other way to get this to run?

Thanks much.
Terra

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index