*! version 1.0.3 13th September 2021

Title

moranplot -- Moran scatter plots

Syntax

moranplot
varlist(numeric)
[if]
[,
options]

Main
w(name) standardized spatial weight matrix

id(varname) individuals identification

note(numlist) note about graph

mlabel(varname) specify marker variable

mlabvp(varname) specify label position

Description

moranplot draws Moran scatter plots. Although it is currently possible to draw Moran scatter plots using the spatlsa command, but the graphics are not pretty.
The scatter plots has an black background and cannot be further edited.
It cannot be published in academic papers. To solve this problem, we developed the moranplot command.
This command can draw Moran scatter plots of multiple variables simultaneously, graphics are standard and pretty. To avoid the "variable w1_000000 not found" error, please use the new version of spmat.ado (Version 1.0.5, 26Nov2018) developed by Drukker, D. M., H. Peng, I. R. Prucha, and R. Raciborski. For convenience, I have put the relevant code in the ado file. This is the original work by Drukker et al.(2013). Thanks for their excellent contribution!

Options

Main

w(name) must be required. It specifies the name of the spatial weights matrix to be used in the computation of the requested local spatial autocorrelation statistics. This matrix must have been generated by spmat. This option must be entered with a standardized spatial weight matrix, and the extension of the spatial weight matrix must be .spmat. For example, W1.spmat.

id(varname) must be required. It specifies the name of the variable containing the identifier of each location object of analysis.

note(numlist) specifies a note in the bottom left corner of the Moran scatter plots. Only one numeric variable can be entered with this option, typically enter the year variable in this option, but it can also be ignored.

mlabel(varname) requests that - in the Moran scatter plots - locations be represented by an identifier instead of the default graphic symbol. You can enter character variables or numeric variables. For example, id or name.

mlabvp(varname) must be a numeric variable. You can specify the position of the variable with the time scale on the clock. For example, 5 or 12.

Examples

Using cross-section data:

. use moranplot_data.dta, clear

. moranplot y1 x1 y2 if year==2018, w(W1) id(id)

. moranplot y1 x1 y2 if year==2018, w(W1) id(id) note(2018)

. moranplot y1 x1 y2 if year==2018, w(W1) id(id) note(2018) mlabel(name)

. moranplot y1 if year==2018, w(W1) id(id) note(2018) mlabel(name) mlabvp(pos)

Using panel data:

. use moranplot_data.dta, clear

. forvalues time = 2014/2018 {

2. moranplot y1 x1 y2 if year==`time', w(W1) id(id) note(`time')

3. }

Author

Chen, Zhenhuan

College of Economics and Management, Northeast Forestry University, China

Email: czh2017@nefu.edu.cn, 317792209@qq.com

Reference

[1] Chen Z, Zhu H, Zhao W, Zhao M, Zhang Y. Spatial Agglomeration of China’s Forest Products Manufacturing Industry: Measurement, Characteristics and Determinants. Forests. 2021, 12(8):1006. https://doi.org/10.3390/f12081006.

[2] Drukker D M, Peng H, Prucha I R, et al. Creating and managing spatial-weighting matrices with the spmat command[J]. Stata Journal, 2013,13(2):242-286.

See Also

Related commands:

spatlsa (if installed)
splagvar (if installed) ssc install splagvar (to install this command)