Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Local Moran's I test

    The estat moran postestimation command does not work with spxtregress command. Does anyone know how to test and map local moran's I in Stata:

    example data below:

    Code:
    copy https://www.stata-press.com/data/r16/homicide_1960_1990.dta .
    copy https://www.stata-press.com/data/r16/homicide_1960_1990_shp.dta .
    use homicide_1960_1990, clear
    xtset _ID year
    spset
    
    *Create a contiguity weighting matrix with the default spectral normalization
    spmatrix create contiguity W if year == 1990, replace
    
    *Fit a spatial autoregressive random-effects model
    spxtregress hrate ln_population ln_pdensity gini i.year, re dvarlag(W)
    estat moran, errorlag(W) // this gives an error

  • #2
    According to its help file, estat moran is a postestimation command for regress, not spxtregress. It apparently also cannot handle the panel data structure, so you need to run it separately for every year, e.g.
    Code:
    regress hrate ln_population ln_pdensity gini if year == 1990
    estat moran, errorlag(W)
    https://twitter.com/Kripfganz

    Comment

    Working...
    X