The distance decay interaction index, DPxy, is a
spatial adaptation of interaction index `xPy`

.
The function can be used in two ways: to provide a distance matrix
or a external geographic information source (spatial object or shape file).

1 2 |

`x` |
- an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a population group, within spatial units. The number of columns should be greater than 1 (at least 2 population groups are required). You should not include a column with total population in each unit, because this will be interpreted as a group. |

`d` |
- a matrix of the distances between spatial unit centroids |

`distin` |
- input metric conversion, based on bink package and includes conversions from 'm', 'km', 'inch', 'ft', 'yd', 'mi', 'naut_mi', etc. |

`distout` |
- output metric conversion, based on bink package and includes conversions to 'm', 'km', 'inch', 'ft', 'yd', 'mi', 'naut_mi', etc. |

`diagval` |
- when providing a spatial object or a shape file, the user has the choice of the spatial matrix diagonal definition: diagval = '0' (by default) for an null diagonal and diagval = 'a' to compute the diagonal as 0.6 * square root (spatial units area) (White, 1983) |

`spatobj` |
- a spatial object (SpatialPolygonsDataFrame) containing geographic information |

`folder` |
- a character vector with the folder (directory) name indicating where the shapefile with the geographic information is located. |

`shape` |
- a character vector with the name of the shapefile (without the .shp extension) which contains the geographic information |

a numeric vector containing the distance-decay isolation index value for each population group

Morgan, B. S. (1983) *An Alternate Approach to the
Development of a Distance-Based Measure of Racial Segregation*.
American Journal of Sociology 88, pp. 1237-1249.

Isolation indices:
`xPx`

, `Eta2`

, `DPxx`

Interaction index: `xPy`

1 2 3 4 5 6 7 8 9 10 11 12 | ```
x <- segdata@data[ ,1:2]
ar <- area(segdata)
dist <- distance(segdata)
diag(dist)<-sqrt(ar) * 0.6
foldername <- system.file('extdata', package = 'OasisR')
shapename <- 'segdata'
DPxy(x, d = dist)
DPxy(x, spatobj = segdata, diagval = 'a')
DPxy(x, folder = foldername, shape = shapename, diagval = '0')
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.