moransI.v: Computes a vector of Moran's I statistics.

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/moransI.v.R

Description

Moran's I is one of the oldest statistics used to examine spatial autocorrelation. This global statistic was first proposed by Moran (1948, 1950). Later, Cliff and Ord (1973, 1981) present a comprehensive work on spatial autocorrelation and suggested a formula to calculate the I which is now used in most textbooks and software:

I = (n/W)*(Σ Σ w_{ij}*z_i*z_j/ Σ z_i^2)

where n is number of observations, W is the sum of the weights w_ij for all pairs in the system, z_i=x_i - mean(x) where x is the value of the variable at location i and mean(x) the mean value of the variable in question (Eq. 5.2 Kalogirou, 2003).

This function allows the computation of an number of Moran's I statistics of the same family (fixed or adaptive) with different kernel size. To achieve this it first computes the weights matrix using the w.matrix function and then computes the Moran's I using the moransI.w function for each kernel. The function returns a table with the results and a simple scatter plot with the Moran's I and the kernel size. The latter can be disabled by the user.

Usage

1
moransI.v(Coords, Bandwidths, x, WType='Binary', family='adaptive', plot = TRUE)

Arguments

Coords

a numeric matrix or vector or data frame of two columns giving the X,Y coordinates of the observations (data points or geometric / population weighted centroids)

Bandwidths

a vector of positive integers that defines the number of nearest neighbours for the calculation of the weights or a vector of Bandwidths relevant to the coordinate systems the spatial analysis refers to.

x

a numeric vector of a variable

WType

a string giving the weighting function used to compute the weights matrix. Options are: "Binary", "Bi-square", and "RSBi-square". The default value is "Binary".

Binary: weight = 1 for distances less than or equal to the distance of the furthest neighbour (H), 0 otherwise;

Bi-square: weight = (1-(ndist/H)^2)^2 for distances less than or equal to H, 0 otherwise;

RSBi-square: weight = Bi-square weights / sum (Bi-square weights) for each row in the weights matrix

family

a string giving the weighting scheme used to compute the weights matrix. Options are: "adaptive" and "fixed". The default value is "adaptive".

adaptive: the number of nearest neighbours (integer).

fixed: a fixed distance around each observation's location (in meters).

plot

a logical value (TRUE/FALSE) denoting whether a scatter plot with the Moran's I and the kernel size will be created (if TRUE) or not.

Details

The Moran's I statistic ranges from -1 to 1. Values in the interval (-1, 0) indicate negative spatial autocorrelation (low values tend to have neighbours with high values and vice versa), values near 0 indicate no spatial autocorrelation (no spatial pattern - random spatial distribution) and values in the interval (0,1) indicate positive spatial autocorrelation (spatial clusters of similarly low or high values between neighbour municipalities should be expected.)

Value

Returns a matrix with 8 columns and plots a scatter plot. These columns present the following statistics for each kernel size:

ID

an integer in the sequence 1:m, where m is the number of kernel sizes in the vector Bandwidths

k

the kernel size (number of neighbours or distance)

Moran's I

Classic global Moran's I statistic

Expected I

The Expected Moran's I (E[I]=-1/(n-1))

Z resampling

The z score calculated for the resampling null hypotheses test

P-value resampling

The p-value (two-tailed) calculated for the resampling null hypotheses test

Z randomization

The z score calculated for the randomization null hypotheses test

P-value randomization

The p-value (two-tailed) calculated for the randomization null hypotheses test

Author(s)

Stamatis Kalogirou <stamatis@lctools.science>

References

Cliff, A.D., and Ord, J.K., 1973, Spatial autocorrelation (London: Pion).

Cliff, A.D., and Ord, J.K., 1981, Spatial processes: models and applications (London: Pion).

Goodchild, M. F., 1986, Spatial Autocorrelation. Catmog 47, Geo Books.

Moran, P.A.P., 1948, The interpretation of statistical maps, Journal of the Royal Statistics Society, Series B (Methodological), 10, 2, pp. 243 - 251.

Moran, P.A.P., 1950, Notes on continuous stochastic phenomena, Biometrika, 37, pp. 17 - 23.

Kalogirou, S. (2003) The Statistical Analysis and Modelling of Internal Migration Flows within England and Wales, PhD Thesis, School of Geography, Politics and Sociology, University of Newcastle upon Tyne, UK. http://gisc.gr/?mdocs-file=1245&mdocs-url=false

Kalogirou, S. (2015) Spatial Analysis: Methodology and Applications with R. [ebook] Athens: Hellenic Academic Libraries Link. ISBN: 978-960-603-285-1 (in Greek). https://repository.kallipos.gr/handle/11419/5029?locale=en

See Also

moransI.w, w.matrix

Examples

1
2
3
4
5
6
data(GR.Municipalities)
Coords<-cbind(GR.Municipalities@data$X, GR.Municipalities@data$Y)

#using an adaptive kernel
bws <- c(3, 4, 6, 9, 12, 18, 24)
moransI.v(Coords, bws, GR.Municipalities@data$Income01)

Example output

Loading required package: reshape
Loading required package: weights
Loading required package: Hmisc
Loading required package: lattice
Loading required package: survival
Loading required package: Formula
Loading required package: ggplot2

Attaching package: 'Hmisc'

The following objects are masked from 'package:base':

    format.pval, units

Loading required package: gdata
sh: 1: cannot create /dev/null: Permission denied
gdata: Unable to locate valid perl interpreter
gdata: 
gdata: read.xls() will be unable to read Excel XLS and XLSX files
gdata: unless the 'perl=' argument is used to specify the location of a
gdata: valid perl intrpreter.
gdata: 
gdata: (To avoid display of this message in the future, please ensure
gdata: perl is installed and available on the executable search path.)
sh: 1: cannot create /dev/null: Permission denied
gdata: Unable to load perl libaries needed by read.xls()
gdata: to support 'XLX' (Excel 97-2004) files.

gdata: Unable to load perl libaries needed by read.xls()
gdata: to support 'XLSX' (Excel 2007+) files.

gdata: Run the function 'installXLSXsupport()'
gdata: to automatically download and install the perl
gdata: libaries needed to support Excel XLS and XLSX formats.

Attaching package: 'gdata'

The following object is masked from 'package:stats':

    nobs

The following object is masked from 'package:utils':

    object.size

The following object is masked from 'package:base':

    startsWith

Loading required package: mice

Attaching package: 'mice'

The following objects are masked from 'package:base':

    cbind, rbind

Loading required package: pscl
Classes and Methods for R developed in the
Political Science Computational Laboratory
Department of Political Science
Stanford University
Simon Jackman
hurdle and zeroinfl functions by Achim Zeileis
Loading required package: MASS
     ID  k Moran's I  Expected I Z resampling P-value resampling
[1,]  1  3 0.6823382 -0.00308642     16.45594       7.602950e-61
[2,]  2  4 0.6796784 -0.00308642     18.85690       2.578894e-79
[3,]  3  6 0.6544124 -0.00308642     22.27952      5.838178e-110
[4,]  4  9 0.6421624 -0.00308642     26.77137      6.963959e-158
[5,]  5 12 0.6205717 -0.00308642     29.99775      1.050018e-197
[6,]  6 18 0.5801700 -0.00308642     34.81105      1.655190e-265
[7,]  7 24 0.5522848 -0.00308642     38.80864       0.000000e+00
     Z randomization P-value randomization
[1,]        16.55194          1.550289e-61
[2,]        18.96690          3.202160e-80
[3,]        22.40946         3.182707e-111
[4,]        26.92744         1.048335e-159
[5,]        30.17252         5.433810e-200
[6,]        35.01363         1.395577e-268
[7,]        39.03418          0.000000e+00

lctools documentation built on April 14, 2020, 6:04 p.m.