HTML Code:
clear all
program mom_cond
version 15.1
syntax [varlist] [if] [in], at(name) WTvar(varlist) MOMents(numlist)
local i 0
foreach var of local wtvar{
local ++i
tempvar W_`i'
gen double `W_`i'' = (`var' - `:word `i' of `moments'') `if'
local weightlist "`weightlist' `W_`i''"
}
local k: word count varlist:`wtvar'
local j=1
foreach v of local weightlist{
tempvar m_`j'
qui gen double `m_`j'' = 0 `if'
forvalues i=1/`k'{
qui replace `m_`j'' = `m_`j'' + `v'*`at'[1, `i'] `if'
}
local `++j'
}
forvalues i= 1/`k'{
local eq`i' `: word `i' of `wtvar''
qui replace `eq`i'' = `W_`i'' /(1+exp(`m_`i'')) `if'
}
end
sysuse auto, clear
gmm mom_cond, wtvar(price mpg weight) mom(6000 22 3000) nequations(3) nparameters(3) winitial(unadjusted, independent) onestepThank you in advance.
Rabiul
0 Response to Facing trouble with the moment evaluation program of GMM, need your kind help
Post a Comment