Stata 15 help for estat moran

[SP] estat moran -- Moran test of residual correlation with nearby residuals

Syntax

estat moran, errorlag(spmatname) [errorlag(spmataname) ...]

Menu for estat

Statistics > Postestimation

Description

estat moran is a postestimation test that can be run after fitting a model using regress with spatial data. It performs the Moran test for spatial correlation among the residuals.

Option

errorlag(spmatname) specifies a spatial weighting matrix that defines the error spatial lag that will be tested. errorlag() is required. This option is repeatable to allow testing of higher-order error lags.

Examples

Setup . copy http://www.stata-press.com/data/r15/homicide1990.dta . . copy http://www.stata-press.com/data/r15/homicide1990_shp.dta . . use homicide1990 . spset

Create a contiguity weighting matrix with the default spectral normalization . spmatrix create contiguity W

Fit a linear regression . regress hrate

Conduct the Moran test . estat moran, errorlag(W)

Create an inverse-distance weighting matrix . spmatrix create idistance M

Conduct a joint test of whether one of the weighting matrices specify a spatial dependence . estat moran, errorlag(W) errorlag(M)

Stored results

estat moran stores the following in r():

Scalars r(chi2) chi-squared r(df) degrees of freedom of chi-squared r(p) p-value for model test

Macros r(elmat) weighting matrices used to specify error lag


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index