ResampleTest | R Documentation |
Resampling tests for segregation indexes.
ResampleTest(
x,
fun,
var = NULL,
simtype = "MonteCarlo",
sampleunit = "unit",
samplesize = NULL,
perc = c(0.05, 0.95),
outl = FALSE,
outmeth = "bp",
sdtimes = 2,
IQRrange = 1.5,
proba = NULL,
nsim = NULL,
spatobj = NULL,
folder = NULL,
shape = NULL,
delta = 0.5,
exact = FALSE,
d = NULL,
c = NULL,
a = NULL,
ck = NULL,
f = "exp",
b = NULL,
p = NULL,
spatmat = "c",
queen = FALSE,
distin = "m",
distout = "m",
diagval = "0",
fdist = "e",
itype = "multi",
dc = NULL,
center = 1,
polorder = 4,
pred = NULL,
K = 2,
ptype = "int",
variant = "s",
...
)
x |
an object of class matrix (or which can be coerced to that class), where each column represents the distribution of a group within spatial units. The number of columns should be greater than 1 (at least 2 groups are required). You should not include a column with total population, because this will be interpreted as a group. |
fun |
a character vector with the segregation function to be tested |
var |
vector with the variables to be tested |
simtype |
a character vector with the type of simulation. If simtype = 'Boot', the function generates bootstrap replications If simtype = 'Jack', the function generates jackknife replications If simtype = 'MonteCarlo', the function produces a randomization test using Monte Carlo simulations |
sampleunit |
= 'unit' (by default) when the sampling unit is the spatial/organisational unit and sampleunit = 'ind' for individual sampling |
samplesize |
the size of the sample used for bootstraping. If null, the samplesize equals the number of spatial/organizational units(sampleunit = 'unit') or the total total population (sampleunit = 'ind') |
perc |
the percentiles for the bootstrap replications |
outl |
logical parameter for jackknife simulations, if TRUE the function provides the outliers obtained by jackknife iterations |
outmeth |
- a character vector designing the outliers detection method: outmeth = 'bp' (by default) for boxplot method, outmeth = 'sd' for standard deviation method, outmeth = 'z' for normal scores method, outmeth = 't' for t Student scores method, outmeth = 'chisq' for chi-squared scores method, outmeth = 'mad' for median absolute deviation method. The estimations based on scoring methods are obtained using outliers package |
sdtimes |
multiplication factor of the standard deviation used for outliers detection with jackknife simulations (2 by default) |
IQRrange |
determines the boxplot thresholds (1.5 by default) as multiplication of IQR (Inter Quartile Range) |
proba |
for Monte Carlo simulations, proba is a vector with location probabilities. If proba = NULL, the vector is equiprobable. If outliers are determined with jackknife technique, proba indicates the probability (confidence interval) for scoring tests. |
nsim |
the number of simulations |
spatobj |
a spatial object (SpatialPolygonsDataFrame) with geographic information |
folder |
a character vector with the folder (directory) name indicating where the shapefile is located on the drive |
shape |
a character vector with the name of the shapefile (without the .shp extension). |
delta |
an inequality aversion parameter |
exact |
a logical variable to specifiy the index version: exact = FALSE (by default) for the approximate version of the index, and exact = TRUE for the exact version |
d |
a matrix of the distances between spatial unit centroids |
c |
a standard binary contiguity (adjacency) symmetric matrix where each element Cij equals 1 if i-th and j-th spatial units are adjacent, and 0 otherwise. |
a |
a numeric vector containing spatial unit areas |
ck |
a list containing contiguity matrices coresponding to each order (from 1 to K) |
f |
the distance function, f = 'exp' (by default) for negative exponential function and f = 'rec' for reciprocal function |
b |
a common boundaries matrix where each element Bij |
p |
a numeric vector containing spatial units perimeters. |
spatmat |
the method used for spatial calculations: 'c' for the contiguity matrix (by default) or any other user spatial interaction matrix and 'd' for the inverse exponential function of the distance. |
queen |
logical parameter defining criteria used for contiguity matrix computation, TRUE for queen, FALSE (by default) for rook |
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/organizational unitsarea) (White, 1983) |
fdist |
the method used for distance interaction matrix: e' for inverse exponential function (by default) and 'l' for linear. |
itype |
a character string defining the index type: itype = 'multi' (by default) for the multigroup index (White, 1986) or itype = 'between' for the between groups version (White, 1983) |
dc |
a numeric vector containing the distances between spatial units centroids and the central spatial unit |
center |
a numeric value giving the number of the spatial unit that represents the center in the table |
polorder |
order of the polynomial approximation (4 by default) |
pred |
a numerical vector with percentiles to be predicted. |
K |
the order of the contiguity matrix |
ptype |
a string variable giving two options for perimeter calculation when a spatial object or shapefile is provided: 'int' to use only interior boundaries of spatial units, and 'all' to use entire boundaries, including the boundaries to the exterior |
variant |
a character variable that allows to choose the index version: variant = 's' for the dissimilarity index adjusted for contiguous spatial units boundary lengths and perimeter/area ratio (by default) and variant = 'w' for the version without perimeter/area ratio |
... |
other specific parameters |
A list including: the index's name, the simulation type, the summary statistics of the simulations, the simulated index distribution, the simulated population distribution, a matrix with outliers (jackknife), a list with outliers values (jackknife)
Efron, B., and Tibshirani, R. J. (1993). An Introduction to the Bootstrap. New York, Chapman and Hall
Tivadar M. (2019) OasisR: An R Package to Bring Some Order to the World of Segregation Measurement. Journal of Statistical Software, 89 (7), pp 1-39
ResamplePlot
x <- segdata@data[ ,1:2]
xtest <- ResampleTest (x, fun ='ISMorrill', simtype = 'MonteCarlo',
sampleunit = 'ind', spatobj = segdata)
xtest$Summary
xtest <- ResampleTest (x, fun ='ISMorrill', simtype = 'Boot',
sampleunit = 'unit', spatobj = segdata)
xtest$Summary
xtest <- ResampleTest (GreHSize@data[,3:5], fun='ISDuncan', simtype = 'Jack',
sampleunit = 'unit', spatobj = GreHSize,
outl = TRUE, outmeth = 'sd', sdtimes = 3)
xtest$Summary
xtest$OutliersVal
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.