Description Usage Arguments Value Author(s) Examples
This function computes a distance matrix for the given date.
It selects all the active CShapes polygons, determines their distances and
outputs a distance matrix in kilometers. The function can compute different types of distance matrices,
specified by the "type" parameter: (i) capital distances, and (ii) centroid distances, and (iii) minimum distances
between polygons. The latter computation is very expensive if polygons have many nodes. For that reason, the function
simplifies the country polygons according to the Douglas-Peucker algorithm (http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm),
which eliminates points from the polygons and speeds up computation. The tolerance
parameter specifies the tolerance for the simplification;
a value of 0 disables it.
1 | distmatrix(date, type="mindist", tolerance=0.1, useGW=T)
|
date |
The date for which the distance matrix should be computed. This argument must be of type Date and must be in the range 1/1/1946 - 30/6/2012. |
type |
Specifies the type of distance matrix: |
useGW |
Boolean argument specifying the system membership coding. TRUE (Default): Gleditsch and Ward (1999). FALSE: Correlates of War. |
tolerance |
Tolerance for polygon simplification according the the Douglas-Peucker algorithm. Only used for mindist computation (type="mindist"). |
A quadratic weights matrix, with the row and column labels containing the country identifiers in the specified coding system (COW or G&W).
Nils B. Weidmann
1 2 3 4 5 6 7 8 9 10 11 | # Compute a matrix of minimum distances
# for the international system on 1/1/1946
# using the Correlates of War list and the default accuracy
## Not run: wmat <- distmatrix(as.Date("1946-1-1"), type="capdist", tolerance=0.5, useGW=FALSE)
# For model estimation, our matrix should contain
# the inverted distances
## Not run: wmat <- 1/wmat
# Fix the values along the diagonale
## Not run: diag(wmat) <- 0
|
Loading required package: sp
Loading required package: maptools
Checking rgeos availability: FALSE
Note: when rgeos is not available, polygon geometry computations in maptools depend on gpclib,
which has a restricted licence. It is disabled by default;
to enable gpclib, type gpclibPermit()
Loading required package: plyr
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.