I am trying to illustrate the famous Moulton variance inflation problem from ignoring clustering. I created a toy data set with 4 states of 20 observations, where each cluster has 2 types:
I calculated the within cluster error correlation using:
From the formula on pp. 5-6 in http://cameron.econ.ucdavis.edu/rese...5_February.pdf, this implies that 1+1*0.415518*(20-1)=8.894842, so the standard errors should be (8.894842)^.5=2.9824222 times too big.
However, that does not seem to be the case when I compare the output:
For the curious, my code is:
What am I doing wrong here?
Code:
+-------------------------------+ | y x e state n | |-------------------------------| | 5.35 0 -.65 0 10 | | 7.35 0 1.35 0 10 | |-------------------------------| | 3 1 -2 1 10 | | 5 1 0 1 10 | |-------------------------------| | 4 2 0 2 10 | | 6 2 2 2 10 | |-------------------------------| | 1.65 3 -1.35 3 10 | | 3.65 3 .65 3 10 | +-------------------------------+
Code:
xtreg e [fw=n], i(state) fe
However, that does not seem to be the case when I compare the output:
Code:
reg y x [fw=n] reg y x [fw=n], vce(cluster state)
Code:
set more off /* fake data */ clear set obs 8 gen state = mod(_n,4) sort state gen x = state gen y = 6 - 1*x gen e = cond(mod(state,2)==1,-1,1) + cond(mod(_n,2),-1,1) + cond(state==0,-0.65,cond(state==3,0.65,0)) replace y = y+e gen n=10 corr x e [fw=n] xtreg e [fw=n], i(state) fe list y x e state n, noobs sepby(state) reg y x [fw=n] reg y x [fw=n], vce(cluster state)
Comment