Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 73450

Moulton Problem Example

$
0
0
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:

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 |
  +-------------------------------+
I calculated the within cluster error correlation using:

Code:
xtreg e [fw=n], i(state) fe
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:

Code:
reg y x [fw=n]
reg y x [fw=n], vce(cluster state)
For the curious, my code is:

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)
What am I doing wrong here?

Viewing all articles
Browse latest Browse all 73450

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>