R and Matlab codes for the paper “A random locational M-estimation problem based on the L 2 -Wasserstein distance ” by A. Daouia and I. Van Keilegom (2015) Thibault LAURENT 21st of April 2015 This document was generated directly from RStudio using Markdown tool. It presents the R and Matlab codes used to obtain the figures included in the paper “A random locational M-estimation problem based on the L 2 -Wasserstein distance” written by A. Daouia and I. Van Keilegom (2015). The .pdf of this page is available here. Before starting Install the necessary packages: install.packages(c("rgdal", "gpclib", "maptools", "rgeos", "OpenStreetMap", "GISTools")) Load the packages : require("rgdal") require("maptools") require("rgeos") require("OpenStreetMap") require("GISTools") 1. Representation of the map of Sahel region - North Africa Import the world country boundaries into R : world <- readOGR(dsn="world", layer="Pays_WGS84") Perhaps you will need to run the following code the first time : require("gpclib") gpclibPermit() We consider some border cities located in the Algerian and Moroccan territories and characterized by the following Longitute/Latitude coordinates (given in decimal degrees): 1
17
Embed
RandMatlabcodesforthepaper“A random locational M ... · RandMatlabcodesforthepaper“A random locational M-estimation problem based on the L 2-Wasserstein distance”byA.DaouiaandI.Van
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
R and Matlab codes for the paper “A randomlocational M-estimation problem based on the
L2-Wasserstein distance” by A. Daouia and I. VanKeilegom (2015)
Thibault LAURENT21st of April 2015
This document was generated directly from RStudio using Markdown tool. It presents the R and Matlabcodes used to obtain the figures included in the paper “A random locational M-estimation problem based onthe L2-Wasserstein distance” written by A. Daouia and I. Van Keilegom (2015). The .pdf of this page isavailable here.
1. Representation of the map of Sahel region - North Africa
Import the world country boundaries into R :
world <- readOGR(dsn="world", layer="Pays_WGS84")
Perhaps you will need to run the following code the first time :
require("gpclib")gpclibPermit()
We consider some border cities located in the Algerian and Moroccan territories and characterized by thefollowing Longitute/Latitude coordinates (given in decimal degrees):
We are going to compute some distances between the points which delimit the frontier. For this reason, wemust convert the Spatial data into a CRS given in meters:
Historical data before the placement of the new station When converting the original borderlineinto a straight line with lower and upper endpoints a and b, representing respectively the coastal city of Saidiaand the eastern city of Figuig, the resulting client’s locations Xi and facility’s locations yj , along with theircorresponding capacities zj and allocation zones, are available in the file here that can be imported as follows:
The new situation after positioning the 7th station The estimated optimal location and capacity ofthe new monitoring station were obtained by using Matlab codes. The resulting optimal allocation zonesafter positioning the seventh monitoring station were determined as well. The file containing all these data isavailable here and can be imported as follows:
2nd graphic (the new situation after positioning the 7th station)
y7, ny1 y2 y3 y4 y5 y6*
CI
#dev.off()
● ●
y7, ny1 y2 y3 y4 y5 y6*
CI
3. Representation of the monitoring stations and associated clients on a map
The idea is to convert the segment [ab] into the original borderline on the map by considering the fact that acorresponds to the coastal city of Saidia and b to the city of Figuig. First, we define the locations of themonitoring centers and their allocations zones in a vector and then we sort this vector:
2nd graphic (the new situation after positioning the 7th station)
y1
y2
y3
y4
y5
y6
y7, n*
Melilla
Oujda
Saidia
Figuig
Ahfir Maghnia
Jerada
Berkane Tlemcen
Bouarfa
Tendrara
Ain Sefra
Ain−Beni−Mathar
Sebdou
Naama
Mecheria
El Aricha
#dev.off()
15
●
●
y1
y2
y3
y4
y5
y6
y7, n*
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
Melilla
Oujda
Saidia
Figuig
Ahfir Maghnia
Jerada
BerkaneTlemcen
Bouarfa
Tendrara
Ain Sefra
Ain−Beni−Mathar
Sebdou
Naama
Mecheria
El Aricha
4. Animation
In this application, we actually consider a dynamic setting where the patrol agents’ intervention sites {xi}vary over time, but the dataset at hand upon which we base the long term decision of positioning a newborder monitoring station is just a picture of the situation over a given period of time i = 1, . . . , 600.This kind of static location modeling is based on the implicit assumption that the time or effort neededfor the illegal immigration, drug trafficking and contraband smuggling to react is long enough to harvestthe main benefits of the new monitoring site. One way to check this assumption is by considering theevolution of the estimated optimal location and capacity (y∗
7,n, z∗7,n) starting from the subsample of the
first 300 recorded observations {x1, . . . , x300}. For each new patrol agents’ intervention i = 301, . . . , 600,we add the corresponding observation xi to the previous sample and then display the obtained resultssimilarly to the second graphic above. This leads to an animation on the straight line that can be found athttps://gremaq.univ-tlse1.fr/perso/laurent/code/DVK.html, and its conversion into the true borderline at