# Local indicators of spatial association

### Description

Calculate different statistics of local indicator of spatial association (LISA) for each cell in a raster data.

### Usage

1 | ```
lisa(x, y, d1=0, d2, cell, statistic="I")
``` |

### Arguments

`x` |
a raster object ( |

`y` |
a |

`d1` |
numeric. A number (distance), specifies local neighborhood size. Default is 0, means that the local neighborhood starts from the cell (distance = 0) and ends to a distance = d2 |

`d2` |
numeric. A number (distance), specifies local neighborhood size. It specifies the distance to which should be considered as a local neighborhood around a cell |

`cell` |
numeric (optional). A cell number or a vector of cell numbers in the Raster object, at which LISA should be calculated |

`statistic` |
a character string specifying the LISA statistic that should be calculated. This can be one of "I", "c", "G", "G*", and "K1" |

### Details

This function can calculate different LISA statistics at each grid cell in Raster object. The statistics, implemented in this function, include local Moran's I ("I"), local Geary's c ("c"), local G and G* ("G" and "G*"), and local K1 statistics. This function returns standardized value (Z) for Moran, G and G*, and K1 statistics. If a `SpatialPoints`

or a vector of numbers is defined for `y`

or `cell`

, the LISA is calculated only for the specified locations by points or cells.

### Value

`RasterLayer` |
if |

`RasterBrick` |
if |

`numeric vector` |
if |

### Author(s)

Babak Naimi naimi.b@gmail.com

### References

Anselin, L. 1995. Local indicators of spatial association, Geographical Analysis, 27, 93–115;
Getis, A. and Ord, J. K. 1996 Local spatial statistics: an overview. In P. Longley and M. Batty (eds) *Spatial analysis: modelling in a GIS environment* (Cambridge: Geoinformation International), 261–277.

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | ```
file <- system.file("external/spain.grd", package="usdm")
r <- brick(file) # reading a RasterBrick object including 10 rasters in Spain
r
plot(r) # visualize the raster layers
plot(r[[1]]) # visualize the first raster layer
r.I <- lisa(x=r[[1]],d1=0,d2=25000,statistic="I") # local Moran's I
plot(r.I)
# entering r instead of r[[1]], givees the indicator for each layer:
# r.I <- lisa(x=r,d1=0,d2=25000,statistic="I")
# plot(r.I)
r.c <- lisa(x=r[[1]],d1=0,d2=25000,statistic="c") # local Geary's c
plot(r.c)
#r.g <- lisa(x=r[[1]],d1=0,d2=25000,statistic="G") # G statistic
#plot(r.g)
#r.g2 <- lisa(x=r[[1]],d1=0,d2=25000,statistic="G*") # G* statistic
#plot(r.g2)
#r.K1 <- lisa(x=r[[1]],d1=0,d2=30000,statistic="K1") # gives K1 statistic for each layer
#plot(r.K1)
lisa(x=r,d1=0,d2=30000,cell=2000,statistic="I") # gives local Moran's I at cell number 2000
#for each raster layer in r
lisa(x=r,d1=0,d2=30000,cell=c(2000,2002,2003),statistic="c") # calculates local Moran's I
# at cell numbers of 2000,2002, and 2003 for each raster layer in r
sp <- sampleRandom(r[[1]],20,sp=TRUE) # draw 20 random points from r,
# and returns a SpatialPointsDataFrame
plot(r[[1]])
points(sp)
lisa(x=r,y=sp,d1=0,d2=30000,statistic="I") # calculates the local Moran's I at
# point locations in sp for each raster layer in r
``` |

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.