{"id":233,"date":"2021-04-27T16:26:51","date_gmt":"2021-04-27T16:26:51","guid":{"rendered":"https:\/\/www.andreapasotti.it\/home\/?p=233"},"modified":"2021-04-27T17:07:50","modified_gmt":"2021-04-27T17:07:50","slug":"ireland-chargepoints","status":"publish","type":"post","link":"https:\/\/www.andreapasotti.it\/home\/statistics\/ireland-chargepoints\/","title":{"rendered":"Studying Electric Chargepoints in Ireland"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">This page is dedicated to the group project for the course of Applied Statistics, by professor Secchi, which I attended in 2019 at the Politecnico di Milano. We were given the task to analyze a huge dataset related to the usage of Charging Stations for electric vehicles in Ireland, and this webpage was designed to summarize our work and present all the obtained results.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Table of contents:<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\"><li><a href=\"#intro\">Introduction<\/a><\/li><li><a href=\"#anova\">Variability analysis &#8211; ANOVA<\/a><\/li><li><a href=\"#mds\">MDS (Multi Dimentional Scaling)<\/a><\/li><li><a href=\"#dbscan\">Charge point clustering &#8211; DBSCAN <\/a><\/li><li><a href=\"#kriging\">Prediction for new data &#8211; Kriging<\/a><\/li><li><a href=\"#conclusions\">Conclusions<\/a><\/li><li><a href=\"#bonus\">Bonus part<\/a><\/li><\/ol>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"intro\"><strong>Introduction<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">That of electric mobility is becoming a very hot topic nowadays.<br>The State of Ireland has invested a lot in it: in 2008 they wanted to diminish the use of fossil fuels and they set the target to have at least 10% of the national car fleet (equivalent to 200000 units) made by e-vehicles by 2020.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Unfortunately, their expectations weren&#8217;t quite fulfilled and the original target has dropped in 2017, as stated by the Irish Minister for the Environment in these few lines.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote blockquote { font-family: Georgia, serif; font-size: 16px; font-style: italic; width: 500px; margin: 0.25em 0; padding: 40px; line-height: 1.45; position: relative; color: #383838; border-left:3px dashed #c1c1c1; background:#eee; } cite #999999; 14px; display: block; margin-top: 5px; cite:before content: &quot;\\2014 \\2009&quot;; is-layout-flow wp-block-quote-is-layout-flow\"><p><em>There are about 5500 EVs in the country, the 0.26% of total licenced cars and it has been predicted that there will be just 8000 EVs on the country\u2019s roads by 2020.<\/em><\/p><cite> <strong>Denis Naughten<\/strong> &#8211;  <em>Minister for Communications, Climate Action and Environment [19 July 2017]<\/em><\/cite><\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">To further support the use of elecric cars, Irish government has created a powerful infrastructure of charging stations, made by a total of 343 charge points (that, at the moment, are available free-to-use). <\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img decoding=\"async\" src=\"https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/May2-FastSlow-HD-1.gif\" alt=\"\" class=\"wp-image-133\" width=\"-529\" height=\"-294\"\/><figcaption>Usage of Fast and Slow Charge Points in a specifc day of May 2018<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">As you can see from this picture, there exist two different types of charge points: the standard one that needs from 6 to 8 hours to charge a common e-car and the fast type, that can charge an electric vehicle up to 80% in just 25 minutes.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Our goal was to try to understand the strength and weaknesses of this powerful infrastructure of Charging stations, and to understand possible reasons for the overall low usage of them.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To do so, we were provided a dataset with all the characteristics of the Charge Points: an ID number, the type (Standard or Fast), a detail for the position location (urban, rural, industrial, motorway, shopping center, commercial), as well as others properties. <\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/Position.Detail-1024x585.png\" alt=\"\" class=\"wp-image-107\" width=\"335\" height=\"190\" srcset=\"https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/Position.Detail-1024x585.png 1024w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/Position.Detail-300x171.png 300w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/Position.Detail-768x439.png 768w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/Position.Detail.png 1400w\" sizes=\"auto, (max-width: 335px) 100vw, 335px\" \/><figcaption>Charge Point &#8211; Position Details<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">For each of the charging stations we then had another dataset, this one explaining the status of each charging unit (1 &#8211; currently under use \/ 0 &#8211; not used) calculated every 5 minutes for every day of the year 2018.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We started from these datasets by aggregating part of them (one of the things that we did, for example, was to evaluate the average annual usage of each charge point) and we performed different statistical analysis.<br>This to understand which were the most busy and why. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\"> We studied the spatio-temporal patterns of charge points usage in Ireland and the global variability, alongside with possible dependences on different external factors. <\/p>\n\n\n\n<figure class=\"wp-block-gallery alignwide columns-2 is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"662\" src=\"http:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/ChargePoint-Map-Copy-1024x662.png\" alt=\"\" data-id=\"114\" data-link=\"http:\/\/www.andreapasotti.it\/home\/chargepoint-map-copy\/\" class=\"wp-image-114\" srcset=\"https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/ChargePoint-Map-Copy-1024x662.png 1024w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/ChargePoint-Map-Copy-300x194.png 300w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/ChargePoint-Map-Copy-768x496.png 768w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/ChargePoint-Map-Copy.png 1051w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"blocks-gallery-item__caption\">Number of Charge Points {by County}<\/figcaption><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"664\" src=\"http:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/Population-Map-Copy-1024x664.png\" alt=\"\" data-id=\"115\" data-link=\"http:\/\/www.andreapasotti.it\/home\/population-map-copy\/\" class=\"wp-image-115\" srcset=\"https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/Population-Map-Copy-1024x664.png 1024w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/Population-Map-Copy-300x195.png 300w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/Population-Map-Copy-768x498.png 768w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/Population-Map-Copy.png 1110w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"blocks-gallery-item__caption\">Population {by County}<\/figcaption><\/figure><\/li><\/ul><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">In this gallery, you can see how the number of Charge Points per each County is qualitatively correlated to the population of the same County.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">While making this analysis, we noticed that there were some infrastructures used way less than others, and that the peaks were concentrated around the capital city of Dublin.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">After these first considerations, we stated the driving questions for all our analysis: what are the optimal positions for new stations? Does it make sense to add new turrets to increase the global use of the whole infrastracture?<br><\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"anova\"><strong>Variability analysis &#8211; ANOVA<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">In order to estimate any significant difference of usage between the various locations, we have performed 3 different ANOVA tests for the main subclasses (Type, Position Detail, Area).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To build the most valuable model, we estimated the annual usage through 2018\u2019s months in which there haven\u2019t been any complete shutdown of the charge points. We haven\u2019t spotted any particular usage pattern throughout different months, so we focused on the more representative ones. These months were the following: March, April, June, September, October, December.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here some explanatory boxplots for the variable of interest: the average use.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/ANNUAL_USE_ANOVA-1024x510.png\" alt=\"\" class=\"wp-image-118\" width=\"374\" height=\"185\" srcset=\"https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/ANNUAL_USE_ANOVA-1024x510.png 1024w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/ANNUAL_USE_ANOVA-300x149.png 300w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/ANNUAL_USE_ANOVA-768x382.png 768w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/ANNUAL_USE_ANOVA-1200x597.png 1200w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/ANNUAL_USE_ANOVA.png 1280w\" sizes=\"auto, (max-width: 374px) 100vw, 374px\" \/><figcaption>Boxplot for the average use <br>{annual \/ above specified months}<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">After this, we tested for an overall Gaussianity of our data:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/pvalue-prima-di-normalizzare-1.png\" alt=\"\" class=\"wp-image-161\" width=\"194\" height=\"65\"\/><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Then, even if not strictly necessary at this point, we decided to transform them via the Box Cox transformation suggested us by the function powerTransform().<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/trasformazione-lambda-a-cui-elevare.png\" alt=\"\" class=\"wp-image-162\" width=\"207\" height=\"43\"\/><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">The first class we\u2019ve analyzed was <em>Fast <\/em>vs <em>Standard <\/em>Charge Points, representing the velocity of the chargepoint.<br>Here the boxplot for the data.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/FAST_SANDARD-ANOVA_normalized-1024x510.png\" alt=\"\" class=\"wp-image-119\" width=\"546\" height=\"271\" srcset=\"https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/FAST_SANDARD-ANOVA_normalized-1024x510.png 1024w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/FAST_SANDARD-ANOVA_normalized-300x149.png 300w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/FAST_SANDARD-ANOVA_normalized-768x382.png 768w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/FAST_SANDARD-ANOVA_normalized-1200x597.png 1200w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/FAST_SANDARD-ANOVA_normalized.png 1280w\" sizes=\"auto, (max-width: 546px) 100vw, 546px\" \/><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">We first tested and verified the hypothesis of gaussianity within groups and homogeneity of variance between groups, and then we fitted the ANOVA model.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">From this analysis we concluded that there was no evidence to state that it exists a difference in the average usage between <em>Fast<\/em> or <em>Standard <\/em>charge points. <br>As previously stated, though, each <em>Fast <\/em>charge point performs three times better than a <em>Standard <\/em>one (on average), so we concluded that <em>Fast<\/em> charge points contribute the most in terms of number of vehicles recharged.<\/p>\n\n\n\n<div style=\"height:22px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">The second class of interest we analized, took into account the urban position type:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/POSITION_DETAILS-ANOVA_normalized-1024x510.png\" alt=\"\" class=\"wp-image-121\" width=\"541\" height=\"269\" srcset=\"https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/POSITION_DETAILS-ANOVA_normalized-1024x510.png 1024w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/POSITION_DETAILS-ANOVA_normalized-300x149.png 300w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/POSITION_DETAILS-ANOVA_normalized-768x382.png 768w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/POSITION_DETAILS-ANOVA_normalized-1200x597.png 1200w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/POSITION_DETAILS-ANOVA_normalized.png 1280w\" sizes=\"auto, (max-width: 541px) 100vw, 541px\" \/><figcaption>Percentage of usage by location of the Charging Stations<br><\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">We tested the model hypothesis over the groups:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/bartlett-position-det.png\" alt=\"\" class=\"wp-image-163\" width=\"272\" height=\"58\" srcset=\"https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/bartlett-position-det.png 435w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/bartlett-position-det-300x64.png 300w\" sizes=\"auto, (max-width: 272px) 100vw, 272px\" \/><\/figure><\/div>\n\n\n\n<pre class=\"wp-block-verse has-text-align-left\"># Pvalues per each class:<br>c1$p &lt;- 0.14586        c2$p &lt;- 0.09752<br>c3$p &lt;- 0.77797        c4$p &lt;- 0.36122<br>c5$p &lt;- 0.26376<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">and then we fitted the model:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"469\" height=\"86\" src=\"https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/modello-position-details-1.png\" alt=\"\" class=\"wp-image-167\" srcset=\"https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/modello-position-details-1.png 469w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/modello-position-details-1-300x55.png 300w\" sizes=\"auto, (max-width: 469px) 100vw, 469px\" \/><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">There is evidence over a difference in the average usage, so we proceeded the analysis with the construction of the univariate confidence intervals and the evaluation of the respective p-values of our tests:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/pvalue-univariati-position-details.png\" alt=\"\" class=\"wp-image-168\" width=\"361\" height=\"106\" srcset=\"https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/pvalue-univariati-position-details.png 513w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/pvalue-univariati-position-details-300x88.png 300w\" sizes=\"auto, (max-width: 361px) 100vw, 361px\" \/><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">As we can see, the only class having a significant difference in the average usage is the Motorway position, which has a lower usage.<\/p>\n\n\n\n<div style=\"height:22px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">The last class of interest involved the geographical position of the charge points:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/AREA-ANOVA_normalized-1024x510.png\" alt=\"\" class=\"wp-image-123\" width=\"442\" height=\"219\" srcset=\"https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/AREA-ANOVA_normalized-1024x510.png 1024w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/AREA-ANOVA_normalized-300x149.png 300w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/AREA-ANOVA_normalized-768x382.png 768w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/AREA-ANOVA_normalized-1200x597.png 1200w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/AREA-ANOVA_normalized.png 1280w\" sizes=\"auto, (max-width: 442px) 100vw, 442px\" \/><figcaption>Normalized boxplots of the percentage of usage by geographical position<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Again, we verified the hypothesis and fitted the ANOVA model, which gave us this result:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"465\" height=\"84\" src=\"https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/modello-area.png\" alt=\"\" class=\"wp-image-159\" srcset=\"https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/modello-area.png 465w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/modello-area-300x54.png 300w\" sizes=\"auto, (max-width: 465px) 100vw, 465px\" \/><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">There is enough evidence to believe that there is a difference in the average usage between the groups; evaluating the univariate confidence intervals we find a significant difference in the usage between the City group and both the others, as we can see from the p-values for the mean differences between the classes:<\/p>\n\n\n\n<pre class=\"wp-block-verse has-text-align-left\"># {H0: mui=muj  |  H1: H0^c}<br><br># p<br>[1] 0.00422 0.00072 0.37451<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">We concluded that the average usage of the Charge Points located in big cities is significantly higher than the other areas&#8217;, but there is not a significant difference between the  usages of those located in Countries and Towns.<br><\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"mds\"><strong>MDS (Multi Dimentional Scaling<\/strong>)<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Now we&#8217;ll get back to the study of our dataset in the framework of Geostatistics.<br>The first thing we asked ourselves when we started working on the data, was how to be as close to reality as possible in the representation of our Spatial Data.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As you might already know, in the most generic problems of Geostatics, it is sufficient to have the coordinates of a certain amount of points (belonging to a geographic domain D), in order to be able to evaluate the distance between each two of them, with a Euclidean approach.<br>Our concern, indeed, was that in our specific situation the Euclidean distance wasn\u2019t so much faithful to reality. This because we were studying a problem where the units\/observations were placed into a road network and the Euclidean representation of the problem just did not take this into account.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In order to solve this problem, we decided to create a matrix of \u201creal distances\u201d, based on the data provided by the API of Google Maps. <br>{n.d.r. At first we tried to circumvent the problem of creating an account on the Google Maps API Platform by performing the calculation \u201cby hand\u201d on the online website\u2026 And this is when we realized that we had 343 charging stations in our dataset and that 343^2 was a pretty high number, even for the most committed students}<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">After \u201cjust\u201d 6h of the API-code running {n.d.r. And 476$ spent of the beginner bonus provided by Google} we were able to look at our stunning 343&#215;343 matrix.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here we noticed that the notion of \u201cGoogle Distance\u201d wasn\u2019t at all a distance in the mathematical way.<br>Apart from the positivity, all other properties weren\u2019t fulfilled:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>The distance form A to B wasn\u2019t almost never equal to that from B to A<\/li><li>The triangular inequality didn\u2019t hold for a lot of triples<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">We solved the problem of asymmetry by defining a weighted average of the two distances and, unfortunately, we basically ignored the problem of missing the triangular inequality propriety.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here we just reported the distribution of the weighted difference between the Euclidean distance matrix evaluated from the initial dataset and the Google Maps Distance Matrix we just build.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/histogram-MDS-vs-Original-Coordinates-1024x542.png\" alt=\"\" class=\"wp-image-127\" width=\"527\" height=\"278\" srcset=\"https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/histogram-MDS-vs-Original-Coordinates-1024x542.png 1024w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/histogram-MDS-vs-Original-Coordinates-300x159.png 300w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/histogram-MDS-vs-Original-Coordinates-768x406.png 768w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/histogram-MDS-vs-Original-Coordinates-1200x635.png 1200w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/histogram-MDS-vs-Original-Coordinates.png 1827w\" sizes=\"auto, (max-width: 527px) 100vw, 527px\" \/><figcaption>Weighted percentage difference<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Then, even with our \u201cdistance\u201d matrix by the hands, we found out that not every of the standard algorithm in R worked with an arbitrary distance matrix.<br>This is when MDS (Multi Dimentional Scaling) entered in the game.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thanks to MDS, we made it possible to evaluate a new set of fictitious coordinates (x,y) such that the Euclidean distance between these coordinates best resembled the original Google Maps one.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/MDS-initial-map.png\" alt=\"\" class=\"wp-image-128\" width=\"464\" height=\"517\" srcset=\"https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/MDS-initial-map.png 803w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/MDS-initial-map-269x300.png 269w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/MDS-initial-map-768x858.png 768w\" sizes=\"auto, (max-width: 464px) 100vw, 464px\" \/><figcaption>Locations recovered from PCoA + ID name of each station<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">In the above plot we can notice the typical shape of the Ireland territories, just rotated a bit counterclockwise.<br>We may confirm the goodnes of this result by saying that the more dense part of the above picture on the center-right is interpretable as the capital city of Dublin (where most of the charge points are located) whereas the other dense area at the bottom is the city of Cork.<br><\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"dbscan\"><strong>Clustering &#8211; DBSCAN<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Started from the new distance matrix, we decided to perform a clustering study on charge points to understand the pattern of their usage. <br>We chose to use DBSCAN because it is the most &#8220;flexible&#8221; clustering algorithm, since it does not require to specify the number of clusters in the data a priori and it can find arbitrarily shaped clusters.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First, we applied a weighted DBSCAN<strong> <\/strong>to all the stations giving latitude, longitude and the percentage of annual usage as weight. The latitude and longitude we used are the ones recovered from Multi Dimensional Scaling. <br>As input we gave parameter minPoints and epsilon. We tried with different minPoints values and decided to take it equal to 10. Looking for a knee in the knndistplot we chose epsilon equal to 60000.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/Knndistplot-1024x844.png\" alt=\"\" class=\"wp-image-129\" width=\"378\" height=\"310\"\/><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">We obtained only two clusters, which are interpretable as the Dublin area versus the rest of the counties.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img decoding=\"async\" src=\"https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/Clustering_annual-1024x844.png\" alt=\"\" class=\"wp-image-130\" width=\"-618\" height=\"-509\" srcset=\"https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/Clustering_annual-1024x844.png 1024w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/Clustering_annual-300x247.png 300w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/Clustering_annual-768x633.png 768w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/Clustering_annual.png 1150w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption>Clustering on annual use<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">This first result was very interesting, as it highlighted the great difference that there&#8217;s between the Capital city and the remaining parts of the country.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In order to strengthen this result, we performed a weighted DBSCAN for every hour of the month May, 2018.<br>Weights were given by the percentage of usage of every hour. Most of the plots showed only two clusters, again interpretable as the Dublin area vs the rest of Ireland, while at particular times of the day we observed only one cluster, and in few other three.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/DBSCAN-GIF.gif\" alt=\"\" class=\"wp-image-92\" width=\"567\" height=\"354\"\/><figcaption>May 2, 2018 &#8211; DBSCAN Clustering Algorithm<br>{The darker the color, the higher the percentage of use for that hour}<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">The third cluster (that we can see in some hours of the day we reported) is interpretable as the urban area of Cork.<br>Indeed, Dublin and Cork are the first and second largest cities in the Republic of Ireland and the algorithm DBSCAN reported a significant higher usage in these two areas,  compared to the rest of the country. <br><\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"kriging\"><strong>Prediction of new data &#8211; KRIGING<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">The cluster analysis made with DBSCAN reminded us our biggest question: \u201cwhich are the best locations to add new charge points?\u201d<br>In order to answer it, we performed a geospatial analysis. In particular, we started from the knowledge aquired in the previous parts and we used a Kriging technique, for a quantitative understanding of our problem.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First of all, we imported the fictitious coordinates recovered via MDS from the Google Maps Distance Matrix.<br>We focused our attention on the percentage likelihood that every charge point is used in a certain time of the year, eliminating all the charging towers that had a null usage and creating a bubble plot for them.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"alignleft is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/KRIGING-bubble.plot-bello-annual-use.png\" alt=\"\" class=\"wp-image-135\" width=\"229\" height=\"252\" srcset=\"https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/KRIGING-bubble.plot-bello-annual-use.png 600w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/KRIGING-bubble.plot-bello-annual-use-273x300.png 273w\" sizes=\"auto, (max-width: 229px) 100vw, 229px\" \/><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Even here we can see the typical shape of Ireland, slightly rotated counterclockwise, and we can identify the two zones where the charge points are mostly used: Dublin and Cork.<br><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We then thought about the possibility to transform the variable Annual Use and make it symmetric. <br>With the following histogram we saw that the logarithm almost symmetrized the data, so we decided to use a logarithmic transformation.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/KRIGING-hist-annual-e-logannual-1024x570.png\" alt=\"\" class=\"wp-image-136\" width=\"606\" height=\"337\" srcset=\"https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/KRIGING-hist-annual-e-logannual-1024x570.png 1024w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/KRIGING-hist-annual-e-logannual-300x167.png 300w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/KRIGING-hist-annual-e-logannual-768x427.png 768w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/KRIGING-hist-annual-e-logannual-1200x668.png 1200w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/KRIGING-hist-annual-e-logannual.png 1456w\" sizes=\"auto, (max-width: 606px) 100vw, 606px\" \/><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">After that, we fitted the empirical variogram and we determined that the best model was a spherical model with partial sill 1, range 80000 and nugget 2.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/KRIGING-empirical-variogram-fit-spherical.png\" alt=\"\" class=\"wp-image-174\" width=\"306\" height=\"295\" srcset=\"https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/KRIGING-empirical-variogram-fit-spherical.png 798w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/KRIGING-empirical-variogram-fit-spherical-768x744.png 768w\" sizes=\"auto, (max-width: 306px) 100vw, 306px\" \/><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">To obtain a better understanding of the overall prediction of the new location on the entire Irish soil, we created a Gstat object and a Grid of points, starting from the minimum coordinate and ending with the maximum coordinate. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">After that comes the best part: the prediction itself. <br>In the following Heat Map, created with ggmap, we can see a qualitative pattern of the probability of finding occupied a charge point put in a new hypothetical location:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img decoding=\"async\" src=\"https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/KRIGING-prediction-on-a-new-grid-Original-Distances-1024x813.png\" alt=\"\" class=\"wp-image-137\" width=\"-464\" height=\"-368\" srcset=\"https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/KRIGING-prediction-on-a-new-grid-Original-Distances-1024x813.png 1024w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/KRIGING-prediction-on-a-new-grid-Original-Distances-300x238.png 300w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/KRIGING-prediction-on-a-new-grid-Original-Distances-768x610.png 768w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/KRIGING-prediction-on-a-new-grid-Original-Distances.png 1047w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption>Heat map for the expected usage of charge points, obtained via Kriging<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">This image is not quite precise and should be handled with care, so some more considerations on this part are necessary.<br>Unfortunately, we couldn&#8217;t take into account the Position details of every point of the grid in this analysis, nor we could consider the existance or not of a road network in the rural areas.<br>Another issue we might find is that the introduction of a new charge point in the network might affect the usage probalility of its closest neighbours.<br>However, the image is still quite easily interpretable: we have a higher probability of finding a charging tower occupied in the areas that are closest to the big cities (Dublin and Cork over all).<br>In general, the probability decreases when moving away from the urban centers. <br><\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"conclusions\"><strong>Conclusions<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Data released by Irish government in the last months, show that the number of electric vehicles in Ireland is quickly growing. Thus, there will likely be an increasing need for charging stations. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Our analysis showed that new stations should be of Fast type and positioned in urban areas. <br>More precisely, we would add most of them in the areas close to Dublin and Cork, which are the two largest cities of Ireland. <br>Adding them close to Shopping Centre areas would be useful as well, while adding more of them on Motorways is not needed at the moment.<br>Why we state this? One of the problems of e-Vehicles is their shorter range of autonomy when compared to traditional solutions, to counter this problem Irish Government has already installed on the main motorways one charging station every at most 50km. For what we observed, this seems to be enough to support the usage on high speed roads.<\/p>\n\n\n\n<div style=\"height:60px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/07\/IMG_7027-e1561978579161-1024x769.jpg\" alt=\"\" class=\"wp-image-180\" width=\"594\" height=\"445\" srcset=\"https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/07\/IMG_7027-e1561978579161-1024x769.jpg 1024w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/07\/IMG_7027-e1561978579161-300x225.jpg 300w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/07\/IMG_7027-e1561978579161-768x577.jpg 768w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/07\/IMG_7027-e1561978579161-1200x902.jpg 1200w, https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/07\/IMG_7027-e1561978579161-1860x1397.jpg 1860w\" sizes=\"auto, (max-width: 594px) 100vw, 594px\" \/><figcaption>E-Team<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Group:<\/strong><br>Benedetta Maria Argenio<br>Alberto Cavarzeran<br>Andrea Pasotti<br>Federica Principe<br>Maria Rombolotti<br><\/p>\n\n\n\n<p class=\"has-text-align-center wp-block-paragraph\"><a href=\"#top\">Go Back Up<\/a><br>or<br><br><a href=\"#bonus\">Read the Bonus part!<\/a><\/p>\n\n\n\n<div style=\"height:192px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"bonus\"><strong>Bonus Part<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">If you wish, take a closer look to our work, here you can find the two presentations for the Workshops and the final poster.<\/p>\n\n\n\n<div class=\"wp-block-file\"><a href=\"https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/workshop_presentazione.pdf\">Final Poster<\/a><a href=\"https:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/workshop_presentazione.pdf\" class=\"wp-block-file__button\" download>Download<\/a><\/div>\n\n\n\n<div style=\"height:23px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-file\"><a href=\"http:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/PRESENTAZIONE-DEFINITIVA.pdf\">Presentation Workshop 1<\/a><a href=\"http:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/PRESENTAZIONE-DEFINITIVA.pdf\" class=\"wp-block-file__button\" download>Download<\/a><\/div>\n\n\n\n<div class=\"wp-block-file\"><a href=\"http:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/Andrea_Pasotti.pdf\">Presentation Workshop 2<\/a><a href=\"http:\/\/www.andreapasotti.it\/home\/wp-content\/uploads\/2019\/06\/Andrea_Pasotti.pdf\" class=\"wp-block-file__button\" download>Download<\/a><\/div>\n\n\n\n<div style=\"height:136px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"has-text-align-center wp-block-paragraph\"><a href=\"#top\">Go Back Up<\/a><\/p>\n\n\n\n<div style=\"height:246px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This page is dedicated to the group project for the course of Applied Statistics, by professor Secchi, which I attended in 2019 at the Politecnico di Milano. We were given the task to analyze a huge dataset related to the usage of Charging Stations for electric vehicles in Ireland, and this webpage was designed to summarize our work and present [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":57,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[12,9,10,11],"class_list":["post-233","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-statistics","tag-dbscan","tag-electric-vehicles","tag-ireland","tag-statistics","clearfix"],"_links":{"self":[{"href":"https:\/\/www.andreapasotti.it\/home\/wp-json\/wp\/v2\/posts\/233","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.andreapasotti.it\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.andreapasotti.it\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.andreapasotti.it\/home\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.andreapasotti.it\/home\/wp-json\/wp\/v2\/comments?post=233"}],"version-history":[{"count":10,"href":"https:\/\/www.andreapasotti.it\/home\/wp-json\/wp\/v2\/posts\/233\/revisions"}],"predecessor-version":[{"id":261,"href":"https:\/\/www.andreapasotti.it\/home\/wp-json\/wp\/v2\/posts\/233\/revisions\/261"}],"wp:attachment":[{"href":"https:\/\/www.andreapasotti.it\/home\/wp-json\/wp\/v2\/media?parent=233"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.andreapasotti.it\/home\/wp-json\/wp\/v2\/categories?post=233"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.andreapasotti.it\/home\/wp-json\/wp\/v2\/tags?post=233"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}