Learn R Programming

OasisR (version 1.0.0)

MCTest: A function to test segregation indexes using Monte Carlo simulations

Description

Monte Carlo tests for intragroup or multigroup segregation indexes.

Usage

MCTest(x, fun, type = 'user', proba = NULL, c = NULL,
 b = NULL, p=NULL, a = NULL, d = NULL, dc = NULL, fdist = 'l',
 center = 1, nsim = 99, spatobj = NULL, folder = NULL, shape = NULL)

Arguments

x
- an object of class matrix (or that 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 one (at least two population groups are require
fun
- a character vector with the segregation function to be tested (only intragroup or multigroup indexes)
type
- a character vector with type of simulation. If type='perm', the function will use the permutation test. If type='rand', the population is realocated in the spatial units randomly. If type='area', the location probabilities are proportional to the sp
proba
- a vector with location probabilities. By default proba = NULL being calculated depending on the simulation type. The parameter is necessary when a user method is specified.
c
- a binary contiguity (adjacency) symetric matrix where each element Cij equals 1 if i-th and j-th spatial units are adjacent, 0 otherwise. This parameter is necessary only for some segregation functions.
b
- a common boundaries matrix where each element Bij equals the shared boundary of i-th and j-th spatial units. This parameter is necessary only for some segregation functions.
p
- a vector with the perimeters of spatial units
a
- a vector with areas of spatial units
d
- a matrix with the distances between patial units centroid
dc
- a vector with distances from the spatial units cetroids to the center
fdist
- a parameter with the method used for distance calculations: 'l' for linear (by default) and 'e' for exponential function.
center
- a value giving the number of the spatial unit that represents the area's center
nsim
- the number of simulations
spatobj
- a spatial object (SpatialPolygonsDataFrame)
folder
- a character vector with the path where the shape file is located
shape
- a character vector with the shape file name #'

Value

  • A data frame with the simulations mean value of the index, the rank of the index in the simulation distribution and its pseudo p.value

References

Tivadar M., Schaeffer Y, Torre A. and Bray F. (2014) OASIS - un Outil d'Analyse de la Segregation et des Inegalites Spatiales. Cybergeo : European Journal of Geography, GeOpenMod, document 699

See Also

xgeo function which computes all geografical information necessary for segregation indices

Examples

Run this code
x <- slot(AnnHAge, 'data')[ ,3:5]
foldername <- system.file('extdata', package = 'OasisR')
shapename <- 'AnnHAge'
ar <- area(AnnHAge)
distc<- distcenter(AnnHAge, center = 19)
probavector<-ar/sum(ar)

MCTest(x, fun='Duncan', type='rand', nsim=999)

MCTest(x, fun='ACE', type='perm', a = ar , dc=distc)

MCTest(x, fun='Wong', type='area', folder = foldername,
shape = shapename)

MCTest(x, fun='Morill', type='user', proba=probavector,
spatobj = AnnHAge)

Run the code above in your browser using DataLab