Hi,
I already posted my question last week, but I didn't receive any ideas of
answer. Maybe I was unclear, so I try again to explain.
I just would like to know if it is possible to treat the problem of endogeneity
estimating a system of equations (more especially using NLSUR).
In fact, I suppose some variables to be endogeneous but I don't know how to
specify my equations of instrumentation (differently from my main system) and
test the validity of my variables (like with the overid command after ivreg2).
I tried to write a little program estimating the following system of 2
equations :
w1 = a1 + a11 lnp1 + b1 lnp2 + b11 * (lnexp - lnP)
w2 = a2 + a12 lnp2 + b2 lnp2^2 + b12 (lnexp - lnP)
with lnP = a1 lnp1 + a2 lnp2 + a11*a12 + lnp1*lnp1 + lnp1*lnp2 + lnp2*lnp1 +
lnp2*lnp2
and I want to instrument the variable lnp2 that I suppose to be endogeneous
(with 2 instruments : expfd and p1 for example).
But it doesnt work and I have no idea how to correctly specify it.
Thank you for trying to help me.
val�rie
capture program drop nlsurtest
program nlsurtest
version 10
syntax varlist(min=5 max=7) if, at(name)
tokenize `varlist'
args w1 w2 lnp1 lnp2 lnm expfd p1
tempname a1 a2 a11 a12
scalar `a1' = `at'[1,1]
scalar `a2' = `at'[1,2]
scalar `a11' = `at'[1,3]
scalar `a12' = `at'[1,4]
tempname b1 b2 b11 b12
scalar `b1' = `at'[1,5]
scalar `b2' = `at'[1,6]
scalar `b11' = `at'[1,7]
scalar `b12' = `b11'
tempname t1 t2
scalar `t1' = `at'[1,8]
scalar `t2' = `at'[1,9]
quietly {
tempvar toto
gen double `toto' = `a1' * `lnp1' + `a2' * `lnp2' + `a11' * `a12'
forvalues i = 1/2 {
forvalues j=1/2 {
replace `toto' = `toto' + `lnp`i'' * `lnp`j''
}
}
replace `w1' = `a1' + `a11' * `lnp1' + `b1'*`lnp2' + `b11' * (`lnm' -
`toto')
replace `w2' = `a2' + `a12' * `lnp2' + `b2'*`lnp2'^2 + `b12' * (`lnm'
-
`toto')
replace `lnp2' = `t1' * `expfd' + `t2' * `p1' /*instrumentation
equation*/
}
end
use http://www.stata-press.com/data/r10/food,clear
nlsur test @ w1 w2 lnp1 lnp2 lnexp expfd p1 ,parameters(a1 a2 a11 a12 b1 b2
b11 ) neq(3) ifgnls
*
* 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/