I illustrate my question using an example from the documentation of
:
The estimate for b1 is .0034983.
Now I add a single line of code (I create a variable called junk) to the moment-evaluator program:
Although I thought the additional line should have no effect on the estimation results, the results do change in fact. The estimate for b1 now is .0258675.
Why?
Code:
help gmm
Code:
webuse auto
cap program drop gmm_ivreg
program gmm_ivreg
version 15.1
syntax varlist [if] , at(name) rhs(varlist) depvar(varlist)
tempvar m
quietly gen double `m' = 0 `if'
local i 1
foreach var of varlist `rhs' {
quietly replace `m' = `m' + `var'*`at'[1,`i'] `if'
local `++i'
}
quietly replace `m' = `m' + `at'[1,`i'] `if' // constant
quietly replace `varlist' = `depvar' - `m' `if'
end
gmm gmm_ivreg, nequations(1) nparameters(3) instruments(gear_ratio length headroom) depvar(mpg) rhs(gear_ratio turn)
Now I add a single line of code (I create a variable called junk) to the moment-evaluator program:
Code:
cap program drop gmm_ivreg
program gmm_ivreg
version 15.1
syntax varlist [if] , at(name) rhs(varlist) depvar(varlist)
tempvar m
quietly gen double `m' = 0 `if'
local i 1
foreach var of varlist `rhs' {
quietly replace `m' = `m' + `var'*`at'[1,`i'] `if'
local `++i'
}
quietly replace `m' = `m' + `at'[1,`i'] `if' // constant
quietly replace `varlist' = `depvar' - `m' `if'
cap drop junk
gen junk = turn
end
gmm gmm_ivreg, nequations(1) nparameters(3) instruments(gear_ratio length headroom) depvar(mpg) rhs(gear_ratio turn)
Why?

Comment