# Moran’s I on Residuals

## Introduction

The first of our spatial diagnostics performs a Moran’s I test on the residuals of a linear regression to determine whether the error terms are spatially correlated. This Moran’s I test treats the residuals slightly differently to how the original Moran’s I test treats a variable (Cliff and Ord, 1973):

#### $$I = e’W_{e}/e’e$$

where $$e$$ is the regression residuals and $$W$$ the spatial weight matrix. As with the original Moran’s I, the I statistic has an asymptotic distribution that corresponds to the standard normal distribution after subtracting the mean and dividing by the standard deviation of the statistic (Anselin, 1988a: 102). A significant result would indicate that there are indeed spatially correlated error terms.

## Inputs

• Dataset – the spatial weight matrix to be used, probably derived from one of the methods above.
• Dataset – the dataset that contains the variable(s) to be tested.
• Moran’s I on Residuals Regression Dependent Variable – the dependent variable(s) of the regression equation.
• Moran’s I on Residuals Regression Independent Variables – the independent variable(s) of the regression equation.
• Moran’s I on Residuals Alternative Hypothesis – indicates the alternative hypothesis; can be two.sided, greater, meaning one sided greater than or less, meaning one sided less than.

## Outputs

• Moran’s I with its expectation and variance
• Moran’s I with the corresponding z-score and p-value
• The alternative hypothesis