Dear Sebastian Kripfganz ,
I am trying to run multiple overidentification tests on random subsamples of my original dataset, however, I cannot find how to extract the test-statistic from the overid test...
I tried the following:
Also, the model I use above has 35 degrees of freedom. I am trying to figure out why this is 35 but I do not find why there are so many.
Thanks in advance!
Hein Willems
I am trying to run multiple overidentification tests on random subsamples of my original dataset, however, I cannot find how to extract the test-statistic from the overid test...
I tried the following:
Code:
clear all
cd "C:\Users\wille\OneDrive\Afstuderen2\Enexis\XGBoost\Output Data\with2023"
insheet using "double_risk.csv", comma clear
format year %ty
encode postcode, generate(id)
egen newid = group(id)
global id id
global year year
sort $id $year
xtset $id $year
mat overidentification = (.)
tempfile holding
save `holding'
set seed 1234
forval i = 1/5 {
use `holding', clear
keep id
duplicates drop
sample 50, count
merge 1:m id using `holding', assert (match using) keep(match) nogenerate
sort id
quietly xtdpdgmm L(0/1).consumption L(0/2).gas L(0/2).gdp heatdays, model(diff) gmm(consumption, lag(2 4)) gmm(gas, lag(2 4)) gmm(gdp, lag(2 4)) iv(heatdays, lag(1 2)) two vce(r) overid
estat overid
mat overidentification = (overidentification \ r(HansenJ))
}
Thanks in advance!
Hein Willems

Comment