Je tiens dans un premier temps à témoigner ma profonde reconnaissance à Camelia et Clément. Je ne pouvais rêver mieux comme encadrants et collègues. Cela a été un grand plaisir de travailler avec eux. Ils ont toujours été à l'écoute et de très bons conseils, et ce, depuis bien avant le début de la thèse. J'ai beaucoup appris grâce à eux de part leurs connaissances, leur rigueur, leur expérience... Je m'estime chanceuse d'avoir pu partager ma passion des mathématiques avec eux. Enfin, ils ont été bien plus que mes directeurs de thèse, ils ont été également un soutien constant durant ces trois années. J'ai découvert à quel point tout deux faisaient preuve d'une gentillesse incroyable envers moi. Ils m'ont tout de suite épaulé lorsque cela a été difficile pour moi, au cours de la deuxième année de thèse, sur le plan personnel. Et cette relation, bien plus que professionnelle, n'a pas de prix et je ne les remercierai jamais assez. Merci Camelia. Merci Clément.

Enfin dans un deuxième temps, la personne ayant également joué un rôle important dans cette thèse est Ben. Je n'aurais jamais pensé, le jour où je l'ai contacté innocemment concernant ses travaux, faire cette collaboration me permettant de lui rendre visite pendant 4 semaines à Lancaster en Angleterre et de réaliser étroitement avec lui une partie des travaux de cette thèse. J'ai rencontré une personne formidable et d'une gentillesse énorme. Merci Ben.

Je tiens également à adresser mes sincères remerciements aux membres de mon jury de thèse. Je remercie Marie Kratz et Anne Ruiz-Gazen qui ont accepté d'être les rapporteures de cette thèse. J'ai été heureuse de rencontrer Marie Kratz lors d'une conférence à Lyon en Juin 2022, qui m'a tout de suite exprimé son intérêt dans les travaux que j'avais présenté ce jour là. Quant à Anne, j'ai également été heureuse de la rencontrer en tant que chair de ma session lors d'une conférence à Besançon en Décembre 2021 et de partager un repas convivial avec elle, quelques jours suivants, à Dijon. J'ai apprécié les commentaires que vous avez porté sur mon manuscrit.

Je tiens aussi à remercier Anne Gégout-Petit qui a accepté de faire partie de mon jury de thèse. Ce fut un plaisir de la revoir à Lyon en Juin 2022 lors d'une conférence, elle qui avait gentiment accepté l'année précédente d'être dans mon comité de suivi de thèse. Merci pour les retours et les conseils exprimés à ces occasions. Merci à Joël d'être présent afin de représenter la Gendarmerie Nationale et qui, malgré le COVID, a toujours exprimé un très grand intérêt pour cette thèse. Merci aussi à Manon Blandin d'avoir tout de suite été intéressée pour faire partie du jury et de représenter le Grand Besançon. possible. Elles sont également toujours présentes et prêtes à aider pour quoi que ce soit. Merci à Ulrich pour mon comité de thèse, ses retours et ses conseils. Merci à Christophe le directeur du LmB et Louis le directeur de l'école doctorale Carnot Pasteur. Et merci à tous les autres, Romain

Introduction

Over the very last years, the Gendarmerie Nationale is interested in using Machine Learning and Artificial Intelligence methods in order to effectively find solutions to different issues of national interest such as the prevention of the cybercrime, the airport security as it is stipulated in the document of the Gendarmerie Nationale "Plan stratégique de la recherche et de l'innovation 2017-2022". The prevention of road crashes is not clearly stated in this document but it obviously stands in this innovative research direction and may be of great interest for the Gendarmerie Nationale. The origin of the work presented in this report is a small study asked in 2019 by the Gendarmerie Nationale de Besançon, more precisely by colonel Joël Armand, focused on the multivariate analysis of road crash data from Franche-Comté. I had the opportunity to be part of the 2nd Master degree student team in charge of carrying out this project and the results obtained after one month work were presented to the members of the Gendarmerie Nationale de Besançon including the colonel Joël Armand. The Gendarmerie Nationale de Besançon was very interested in continuing this preliminary statistical analysis and funding from the Grand Besançon Métropole (CAGB -Communauté d'Agglomération du Grand Besançon) enabled this project to continue in the form of a thesis at the Mathematics Laboratory of Besançon (LmB -Laboratoire de Mathématiques de Besançon) from the University of Franche-Comté and started in 2019. The first year of this thesis project faced many difficulties due to COVID-19 and impacted the rest of the thesis. First of all, road crashes data from 2020 and 2021 could not be used because the numerous lockdowns made them atypical. In addition, meetings and communications with the Gendarmerie Nationale, the Police Nationale and the Doubs prefecture in order to collect data and to discuss their interests in terms of accidentology were impacted and thus caused an important delay in the progress of the work. Finally, it was impossible to present the work at statistics conferences in 2020 as almost all national and international conferences have been cancelled. This thesis is structured into two parts entitled Injuries analysis of road accidents (one chapter) and Space and time analyses of road accidents (three chapters). I give below a short presentation of each part and chapters and I finish with some personal feelings about this thesis.

INTRODUCTION

Part I: Injuries analysis of road accidents

Data used in the first part of the thesis are extracted from the French census of road crashes BAAC files (Bulletin d'Analyse des Accidents Corporels) available on the opensource French government website www.data.gouv. These data-sets have been enriched with supplementary information concerning the consumption of alcohol and drugs obtained under confidentiality agreements with the Gendarmerie Nationale de Besançon. More specifically, our final datasets contain injury road accident characteristics filled in by the security forces present on the accident scene (such as collision type, hurt obstacle, ...) reported on 4 950 accidents that occurred between 2005 and 2018 in the French region of Franche-Comté. The first part of the thesis aims at giving a multivariate statistical analysis of road crash data with special attention to road crash gravity.

The first step of this multivariate analysis was to perform Multiple Correspondence Analysis (MCA) in order to assess associations between the road crash injury and several important accident related factors. Several multiple correspondence analysis have been performed by considering separately the temporal type variables such as the time of the week or the day; the spatial type variables such as the canton and finally, the spatio-temporal type variables. These analyses highlighted the fact that associations may exist between the severity of the accident (slight, serious or fatal ), the department of the region (Doubs, Jura, Haute-Saône or Territoire de Belfort) and the alcohol and/or drug consumption of the drivers. Besides, it was noted that it may exist possible associations between the accident severity and several temporal type variables such as the season of the year, the day of the week and the hour of the day.

Log-linear models are used next in order to detect which associations between road crash severity and related factors such as alcohol/drug consumption or spatial crash locations are significant. Based on the associations revealed in a descriptive and geometric way with the MCA, we consider a hierarchical and a non-hierarchical log-linear model. The two models allow us to conclude that the considered associations are significant and to quantify the risks by estimating the associated odds ratios. An important finding, for us as well as for the Gendarmerie Nationale de Besançon, is the quantification of the estimated risks related to the accident severity. For example, the risk that the accident is fatal is multiplied by six if the driver has consumed alcohol and drugs. The Jura department also stands out as the riskiest department. These results may encourage the Gendarmerie Nationale de Besançon to take preventive measures to reduce the alcohol and drug consumption among drivers.

Finally, ordinal logistic regression was used in order to test the influence of each factor on the accident severity. Eight factors, such as the alcohol and/or drug consumption or the time of the day, were found to be highly influential on crash severity. Odds ratios estimated from this model allowed to quantify the risks of the accident to be "serious" (i.e. the accident has at least one hospitalized person) or "fatal" (i.e. the accident has at least one dead person) and confirmed the results obtained with the log-linear modelling. They also revealed new results such as the fact there is a significant risk that an accident will occur within the time slot 4pm -7:59pm.

The results presented in the first part of the thesis are published in the article entitled Multivariate statistical analysis for exploring road crash related factors in the Franche-Comté region of France in Communications in Statistics: Case Studies, Data Analysis and Applications (Spychala et al., 2021). I presented them to several members of the Gendarmerie Nationale de Besançon in 2020, 2021 and I have planned to present them to several conferences in statistics during 2020 and 2021 which have been unfortunately cancelled due to COVID-19 crisis.

Part II: Space and time analyses of road accidents

While the first part of this thesis is focused on the statistical modelling of the injury accidents, so after the occurrence of the road accidents, the objective of the second part of this thesis is dedicated now to predict the occurrence of road accidents, so before an accident happens. More precisely, the main goal is now to spatially (eventually spatio-temporally) predict the occurrence of the accidents in order to identify the critical geographical zones and to build maps indicating the risky areas. Our study is motivated, in a second time, by determining the riskiest factors. In order to meet these goals, the geographic coordinates of the road accidents (recorded after the occurrence of the accident) are used in specific spatial statistic models.

The data considered in the second part of the thesis concerns road accidents that occurred in the Communauté d'Agglomeration du Grand Besançon (CAGB) between 2017 and 2019. Road crash data are also extracted from the French government website www.data.gouv. In order to conclude effectively on the critical areas of the CAGB and to identify the risk factors, additional information was brought to the statistical analysis through covariates. The covariates in question are now different from those used previously in the first part of the thesis as the objectives are different: we wish to predict the occurrence on an accident, while in the first part the accident had already happened. The covariates will be represented by environmental factors that can potentially influence the occurrence of road accidents such as the population density of an area, the number of shops in an area or the length of a given road in an area. Gathering all this information required considerable effort and encountered many obstacles. A major difficulty met on collecting such pertinent auxiliary information was the lack of measures on the traffic density at a fine scale such that the number of cars or taxi per day or week, information that generally turns out to be a relevant factor in road accident statistical analysis. The traffic measures are actually collected by meters installed at several locations from Besançon, every year, during one week of September. This poor information of the traffic density in Besançon greatly limits the choice of statistical models. We suggest in Chapter 4 a first statistical analysis based on such traffic data. To use highperformance machine-learning models would be desirable but requires very rich traffic data which is hard to collect without smart meters, devices that are not intended to be installed in the city of Besançon as far as we know.

The second part of the thesis is divided into three chapters. In addition to the presentation of the statistical analyses carried out in these chapters, particular attention is paid also to the implementation in R (R Core Team, 2021) of all these methods. This detailed INTRODUCTION description aims at providing in an educational way both technical and practical elements and it was inspired from reference books in statistics with applications in R such as [START_REF] Baddeley | Spatial Point Patterns: Methodology and Applications with R[END_REF].

Spatial point process analysis

Chapter 2 concerns the data preparation in order to be used next in the statistical methods developed in Chapter 3. As mentioned above, environmental factors will be incorporated into the analysis. Focus is on gathering rich socio-demographic data and road information concerning the CAGB by using open-data collected on numerous sites such as www.data.gouv, www.insee.fr, www.openstreetmap.fr. This data collection required merging several databases on a single support. Usually, spatial analysis is done on a computational grid and significant data wrangling work has been carried out by using interpolation methods in order to standardize different information sources on the chosen grid. This chapter gives also numerous guidelines for using specific R packages dedicated to manipulation of spatial data such as sf (Pebesma et al., 2022), spatstat [START_REF] Baddeley | spatstat: Spatial Point Pattern Analysis, Model-Fitting[END_REF] and lgcp [START_REF] Taylor | Inla or mcmc ? a tutorial and comparative evaluation for spatial prediction in log-gaussian cox processes[END_REF].

The statistical modelling considered in this second part of the thesis treats the road crashes as the realization of an underlying stochastic process called point process. Road crash data are considered then as a spatial point pattern. The essential element in the study of point processes is the expected number of events per unit area or the intensity of the point process. The context of road accidents directly implies the consideration of the intensity of the process as a random process. We suggest in Chapter 3 to model the road crash data by a Cox log-Gaussian process [START_REF] Moller | Log gaussian cox processes[END_REF], namely a Cox process with the log-intensity modelled by a latent Gaussian process and linearly related on several covariates previously prepared in Chapter 2. To estimate the intensity of the process, and therefore the average number of road accidents per unit area, we used Bayesian inference methods implemented by using MCMC computation tools. A second concern focused on obtaining a powerful intensity process model in terms of explanation and prediction while having a reasonable computation time. To reduce the computational burden, we select first the most important covariates by considering a variable selection ensemble method inspired from the random forest algorithm and an importance variable criterion based on variable permutation as suggested in [START_REF] Breiman | Random forests[END_REF]. However, the variable selection method is not applied directly on LGCP models, as they are very time-consuming, but on Poisson regression models since we considered that the Poisson regression is the model that is the closest to the LGCP model while being very fast. Several sets of covariates are thus selected and fitted in LGCP type models. The best LGCP model (chosen according to a weighted mean square criterion) is used to create risk areas maps for the CAGB and to identify the risk factors. The riskiest area of the CAGB, for example, corresponds to the area with center given by the intersection of roads D673 and N 57 known to be a high traffic density area.

The results presented in Chapter 3 are the subject of an article in preparation. I have also presented them in several national and international conferences in statistics.

Spatio-temporal semiparametric analysis

While chapters 2 and 3 were concerned by the spatial component of the road accidents, Chapter 4 focuses on temporal coordinates as well. The main objective is now to build maps showing the risky areas relative to space and time. The road accidents considered here occurred in the city of Besançon between 2017 and 2019 and it was extracted as usual from BAAC files.

The statistical modelling considered in Chapter 4 is inspired by epidemiological studies, more particularly by case-control studies. However, to carry out a spatio-temporal casecontrol study in our situation, we only have the cases (road accidents). A major difficulty in setting up this study is the absence of the control group. To overcome this issue, we proposed to generate the control-cases by simulating realizations of a point process on the road network (Baddeley et al., 2021a) having as intensity the traffic density. As detailed in the general description of the part II of the thesis, the traffic density information is measured only at several locations from Besançon during one week of September. We propose then to extrapolate the traffic density to any location of the city of Besançon by using the method of kriging used in geostatistics [START_REF] Cressie | Statistics for Spatio-Temporal Data[END_REF]. Finally, a semiparametric modelling is proposed in order to estimate the probability that a geolocated point is an accident relative to time and to identify the risk factors. This work is very recent and is the result of a collaboration with Benjamin Taylor (the main author of the package lgcp [START_REF] Taylor | Inla or mcmc ? a tutorial and comparative evaluation for spatial prediction in log-gaussian cox processes[END_REF]) from the University of Lancaster. I visited the University of Lancaster for a month last May and started a research collaboration with Benjamin Taylor.

Personal considerations

Finally, I wish to give at the end of the introduction chapter some personal thoughts. In my opinion, a statistical analysis can be defined as a Brainstorming or MindMapping which means that, starting from a study goal, the ideas and the steps are assembled around this specific objective by sharing with specialists of the domain, theoreticians and/or practitioners. The methods used in order to give answers to the issues may vary according to the study goal and especially to the available data. What is magical with the statistics is that there exist several strategies and methods available in order to achieve our goals (if possible). The reader may find in this thesis the solutions that I proposed in order to fulfill the goals that we fixed at the beginning of the thesis, however several different statistical methods were potentially also suitable to meet the same expectations. The subject of "Road accidents" actually weaves a large statistical web. This thesis represented a huge opportunity for me. At the end of the Master degree, I intended to learn more on the field of statistics and applied statistics and this is why I wished to continue with a PhD. During the last three years, I have gained even more valuable statistical knowledge, especially in spatial statistics which was an unknown field for me. I have also improved my skills in terms of computational implementations as spatial tools represent a very large sphere to explore. Besides, the thesis also enabled me to become more INTRODUCTION open even if, unfortunately, the years 2020 and 2021 have been difficult due to the COVID-19. I had the chance to participate to many conferences and above all to go to Lancaster in England several weeks. This was a great experience for me to live in Lancaster and to meet people from the University of Lancaster.

The major part of what seemed very important for me during this thesis work such as the specific literature review, the statistical methods and the computational tools necessary to realize the analyses, has been structured and presented in the following of this report. I hope that the reader will appreciate what took me three years to produce. Publications Spychala, C., Armand, J., Dombry, C. and Goga, C. (2021). "Multivariate Statistical Analysis for Exploring Road Crash Related Factors in the Franche-Comté region of France", Communications in Statistics -Case Studies and Data Analysis, 7, 442 -474.

INTRODUCTION

I Injuries analysis of road accidents

Chapter 1

Multivariate statistical analysis for exploring road crash related factors in the Franche-Comté region of France1

Multiple Correspondence Analysis, log-linear models and ordinal logistic regression

Understanding and modelling road crash data is crucial in fulfilling safety goals by helping national authorities to take necessary measures to reduce crash frequency and severity. This work aims at giving a multivariate statistical analysis of road crash data from the French region of Franche-Comté with special attention to road crash gravity. The first step for this multivariate analysis was to perform Multiple Correspondence Analysis in order to assess associations between the road crash injury and several important accident related factors and circumstances. Log-linear models are used next in order to detect associations between road crash severity and related factors such as alcohol/drug consumption or spatial crash locations. The effects of each factors have been also evaluated on the road crash gravity by using ordinal logistic regression. Data used in this study are extracted from BAAC files, the French census of road crashes.

Introduction

Over the last decade, the number of road crashes has continuously been decreasing in France. Indeed, 61 224 accidents have been recorded in 2017 instead of 58 352 in 2018, a decrease of 4,7% [START_REF] Onisr | La sécurité routière en France -Bilan de l'accidentalité de l'année[END_REF]. However, road accidents still happen and important efforts and means are developed to prevent them. Among these, modern statistical methods are efficient prevention tools used to describe and model accident data. This paper is concerned about road accidents that occurred in the Franche-Comté region of France (see Fig. 1.1). This region from the east of France is split up into four departments called Doubs, Jura, Haute-Saône and Territoire de Belfort. Regarding to the mortality rate from 2017 to 2018, this rate has globally decreased for this region. However, the situation is quite different within each department. Indeed, the death rate has increased by 3% from 2017 in the Doubs department while it has decreased in the Haute-Saône, Jura and Territoire de Belfort departments by 45%, 65% and respectively by 50% [START_REF] Onisr | La sécurité routière en France -Bilan de l'accidentalité de l'année[END_REF]. Understanding and modelling accident data is crucial in fulfilling safety goals by helping national authorities to undertake necessary measures to reduce crash frequency and severity.

This paper focuses on accidents in Franche-Comté involving casualties. An accident refers to a road crash with casualty needing hospital care and can involve several cars and several people. One of the main goals of the National Gendarmerie of Besançon (Doubs, France) is to reduce the number of accidents in Franche-Comté. More precisely, the National Gendarmerie of Besançon plans to be able in the near future to anticipate road crashes by using time and spatial modelling of accident data. This study aims at giving a multivariate statistical analysis of the road crashes in Franche-Comté. A first multivariate descriptive study of French accident data was conducted by [START_REF] Bièvre | Acteurs de contingence et insécurité routière: les limites de la statistique descriptive[END_REF] in an unpublished technical report. We intend in this work to give a deeper analysis of Franche-Comté accident data.

The main goal of this research work is to explain the variable giving the severity or the gravity of the accidents by using several covariates such as spatial location, time period, weather conditions, road type, alcohol/drug consumption... Our multivariate statistical analysis starts with a Multiple Correspondence Analysis (MCA). The MCA as suggested by Benzécri [START_REF] Benzécri | L'Analyse des Données: L'Analyse des Correspondences[END_REF][START_REF] Benzécri | Histoire et Préhistoire de l'Analyse des Données[END_REF] is the generalization of the Correspondence Analysis (CA) for analysing jointly more than two categorical variables. This method is widely used in categorical data analyses because it allows detecting similarities between individuals and assessing associations between categories. Geometric representations of data clouds in smaller dimension spaces allow identifying clusters of similar individuals and of associated categories or variables. Many applications of MCA and related methods in various fields such as social, demographic, economic are given in [START_REF] Greenacre | Multiple Correspondence Analysis and Related Methods[END_REF]. The goal here is to determine the accident factors mostly related to road crash severity. In the literature concerning the accident analysis and prevention, several studies used MCA in various contexts but different from our framework. For example, [START_REF] Das | Factor association with multiple correspondence analysis in vehicle-pedestrian crashes[END_REF] used eight years of pedestrian crash data and MCA to identify key associations between risk factors and [START_REF] Das | Association knowledge for fatal run-off-road crashes by multiple correspondence analysis[END_REF] used MCA to identify crash-prone factors producing fatal run-off-road crashes; [START_REF] Das | Investigation on the wrong way driving crash patterns using multiple correspondence analysis[END_REF] investigated the wrong way driving crash patterns by using MCA while [START_REF] Fort | Working conditions and risk exposure of employees whose occupations require driving on public roads -factorial analysis and classification[END_REF] tried to explain working conditions and risk exposure of employees whose occupations require driving on public roads.

The MCA analysis conducted on the Franche-Comté accident data set allows us to identify several variables associated with the road crash severity. A more in-depth analysis of these variables is next considered by log-linear modelling [START_REF] Agresti | Categorical Data Analysis[END_REF]. The log-linear model belongs to the class of generalized linear model [START_REF] Mccullagh | Generalized Linear Models[END_REF]). In the case of categorical data, the cell counts of the contingency table are modelled by a Poisson distribution and a log link function is used for the mean. More precisely, the log-linear model specifies how the expected counts depend on the levels of the categorical variables and it allows to quantify the associations and interactions between those variables. Unlike MCA, log-linear models allow getting insight into complex dependence patterns such as conditional or marginal dependence which may exist between several categorical variables. In our framework, we will use log-linear models in order to detect conditional or marginal associations between road crash severity and other variables such as alcohol/drug consumption and spatial location. In a similar way, Abdel-Aty et al. (1998) used log-linear models to explain associations between the driver age and several important factors and circumstances related to the accident. Also, [START_REF] Yannis | Driver age and vehicle engine size effects on fault and severity in young motorcyclists accidents[END_REF] performed a log-linear analysis in order to test the significance of first-and second-order effects among various combinations of driver age and engine size categories in relation to two-wheeler accident severity and at-fault risk rates. Then, [START_REF] Abdel-Aty | Exploring the relationship between alcohol and the driver characteristics in motor vehicle accidents[END_REF] used log-linear models to investigate whether there are associations between the different driver characteristics and alcohol involvement and also in order to identify the high-risk group within each driver factor.

Finally, we propose ordinal logistic regression [START_REF] Agresti | Categorical Data Analysis[END_REF] to model the gravity level probabilities as a function of explicative covariates such as alcohol/drug consumption, time period and spatial locations. This method widely used in accident data analysis is a popular supervised learning method for analysing dependencies between a binary or multiclass response categorical variable and several explanatory variables. It allows in particular to separate and identify the effects of each explanatory variable on the response variable. [START_REF] Rezapour | Application of multinomial and ordinal logistic regression to model injury severity of truck crashes, using violation and crash data[END_REF] used ordinal logistic regression to investigate the contributory factors that increased the odds of severe single-truck and multiple-vehicle crashes such as characteristics related to driver or vehicle for instance. Then, [START_REF] Mekonnen | Risk factors of road traffic accidents and its severity in north shewa zone, amhara region, ethiopia[END_REF] has also performed ordinal logistic regression in order to identify the risk factors among driver age, speed record or alcohol consumption for example for severity levels of road traffic accident.

The paper is structured as follows. We first describe in Section 1.2 our data set as well as the analysis methods: MCA is described briefly in Section 1.2.2, log-linear modelling in Section 1.2.2 and ordinal logistic regression in Section 1.2.2. Section 1.3 contains the main results of our study and, lastly, Section 1.4 concludes and proposes several recommendations and perspectives.

Material and methods

Franche-Comté accident data

Data used in this study concern the Franche-Comté road crashes between 2005 to 2018 which are extracted from the French national analysis bulletin of road traffic injury accidents called BAAC2 (Bulletin d'Analyse des Accidents Corporels). The BAAC data are filled in by the security forces present on the accident scene and next, data are treated, analysed A daily intensive border activity between Switzerland and France is also present in these counties.

The analysis emphasizes the accident severity, denoted by type acc, classified into three ordered levels: "slight safe", "serious" and "fatal". An accident is considered as "slight safe" (11,47% of accidents) if all passengers were safe or had minor injuries; the label "serious" was attributed to accidents involving at least one casualty needing hospital care for more than 24 hours (69,82% of accidents) and lastly, an accident is considered as "fatal" (18,71% of accidents) if at least one casualty involved died.

The alcohol/drug consumption by car drivers is one of the main accident causes and has a great impact on their severity. The categorical variable substance describing the alcohol/drug consumption by the drivers involved in a road crash has the following levels:

• "alcohol drug" when at least one of the involved drivers has consumed both alcohol and drugs (2.69%);

• "drug" when at least one of the involved drivers has consumed drugs (2.73%);

• "alcohol" when at least one of the involved drivers has consumed alcohol but not drugs (16.22%);

• "none" is associated with accidents involving only sober drivers (78.36%).

If the accident involves only one driver, the variable substance concerns the unique driver.

As mentioned above, the goal of this study is the statistical analysis of accidents and an accident may involve several drivers and casualties. Variables such as age or sex refer to individuals and are not straightforward to recode for an accident involving several persons. For this reason, age or sex do not appear in our multivariate analysis.

In order to give a more thorough statistical analysis, we considered further 7 categorical variables giving supplementary information about the weather, the type of the road and of the collision:

• weather with two categories: normal and other kind (such as rainy, cloudy or snowy weather);

• area with two categories: unurban and urban;

• intersection with two categories: intersection and out of intersection;

• obstacle corresponding to a mobile obstacle with four categories: vehicle, pedestrian, other kind (such as animals) and none;

• shape road with two categories: curve and straight;

• collision with three categories: usual (such as frontal or rear-end collisions), other kind and none;

• type road with five categories: communal, departmental, national, highway and other kind (such as parking).

The above variables will be denoted in the paper as general features.

In order to conduct the temporal analysis of the Franche-Comté road crashes, we used the following categorical variables related to the time period when the accident occurred, denoted in the rest of the paper as temporal features:

• season with four categories: spring, summer, autumn and winter;

• week with two categories: weekday and week end;

• daytime with two categories: day and night;

• time with five categories: 7am 10am, 11am 3pm, 4pm 7pm, 8pm 11pm and midnight 6am. Note that the category 7am 10am means from 7:00 am to 10:59 am. It is also the case for the other categories of time.

In our accident data, each accident is located by the commune (town or village) and the department (Doubs, Jura, Haute-Saône, Territoire de Belfort) where the accident took place. The variable commune was used to build the variable canton (district) by regrouping the 1176 communes into 50 cantons. In fact, the region of Franche-Comté is splitted up into 62 cantons, however, some cantons have been grouped together as for instance "Belfort-1", "Belfort-2" and "Belfort-3" into "Belfort". This reclassification allows to smooth the variability of cantons categories. Hence, Jura department is divided into 15 cantons, Haute-Saône and Doubs both into 14 cantons and Territoire de Belfort into 7 cantons. The categorical variables department and canton have been used for the spatial analysis, whereas the variable commune was dropped due to too many categories. We give in Fig.

(1.1) the division of Franche-Comté into cantons with their road crash frequencies; Jura department is the department with the highest road crash frequency. These two variables will be denoted in the rest of the paper as spatial features.

Tab 1.1 gives the cross-tabulation of the accident severity (type acc) with the different categorical variables.

Tab 1.1: Contingency tables crossing the accident severity type acc with the other categorical variables. The variable canton has too many levels and only "Arbois" and "Villersexel" are described. The numbers in parentheses are, for each categorical variable, the relative frequencies of its different levels and, within each level, the distribution of the accident severity.

Statistical analysis

Multiple Correspondence Analysis

The Multiple Correspondence Analysis (MCA) is an efficient unsupervised method for exploring multivariate categorical data. The aim of MCA is to study the similarities between the individuals, to assess the relationships between the variables and to examine the associations between the categories. For a thorough description of MCA as well as of related methods, the reader is referred to the book of [START_REF] Greenacre | Multiple Correspondence Analysis and Related Methods[END_REF]. This method allows, if appropriate, to corroborate a strong link between categorical variables. In some cases, MCA enables to cluster categories and to reduce the data dimension allowing multivariate data to be analyzed more easily. Indeed, a graphical representation of individuals and variables is built in an orthogonal system similarly as in Correspondence Analysis (CA). This statistical tool is powerful for understanding, visualizing and simplifying the data.

MCA can be derived in several ways. One way is to apply CA on the indicator matrix X = [X 1 X 2 . . . X p ] derived from the original data Individuals×Categorical variables of p categorical variables recorded on n individuals. Each indicator matrix X j is obtained by column concatenation of K j dummy variables where K j is the number of categories of the jth categorial variable, j = 1, . . . , p. Hence, X is a respondents-by-categories matrix having n rows, corresponding to individuals, and K = p j=1 K j columns, corresponding to variable categories. An element of this table, denoted by x ik , is equal to 1 if the individual i has the category k and 0 otherwise, i = 1, . . . , n and k = 1, . . . , K. The indicator matrix X has row sums equal to the constant p and column sums equal to n k , the marginal frequency of the kth category, namely the number of individuals having the category k.

This kind of data implies the study of three kinds of objects: the individuals, the variables but also their categories. The scheme of MCA is to compare individuals and evaluate variables characteristics by providing row typologies, column typologies and the relationships between these typologies [START_REF] Escofier | Analyses factorielles simples et multiples[END_REF].

From a technical point of view, MCA uses as CA the χ 2 distance in order to assess similarity or dissimilarity between different columns or lines contained in X. The indicator matrix X is transformed in order to obtain row profiles by dividing each element of a row by the row frequency as well as column profiles by dividing each element of a column by its frequency. In the case of MCA, row and column profiles are very simple. The ith row profile is given by (x ik /p) K k=1 : the elements of a row profile have only zero and 1/p values, the non-zero value being recorded if the individual i possesses the category k. So, row profiles will be different only for ith and i th individuals having mismatching category levels. The kth column profile is given by (x ik /n k ) n i=1 : the elements of the column profile are zero and 1/n k values.

The χ 2 -distance between two individuals i and i is a weighted sum of squared distances between the ith and i th row profiles with weights given by the inverse of the average row profile given by (n k /np) p k=1 :

d 2 i,i = K k=1 np n k x ik p - x i k p 2 = n p K k=1 (x ik -x i k ) 2 n k , 1 ≤ i, i ≤ n. (1.1)
Hence, the terms from the above sum will be all zero for coincident zero values and coincident 1/p values meaning that these squared differences will not contribute to the distance measure. Only differences between noncoincident categories will contribute to the distance d 2 i,i and this contribution is proportional to (1/p) 2 with weight equal to the inverse of the marginal frequency n k . The χ 2 distance between row profiles can be interpreted as a weighted mismatching dissimilarity coefficient: small distance d i,i means that individuals i and i have many categories in commun, so they are very similar and on the contrary, large distance d i,i means that i and i have few categories in commun, so they are very different. Moreover, a rare category (small n k ) has a large contribution to the final distance and moves its owner or owners far away from the others individuals.

While the interpretation of the χ 2 distance between individuals is similar to the one given in the CA, the χ 2 distance interpretation for variable analysis is quite different and more difficult to justify [START_REF] Greenacre | From simple to multiple correspondence analysis[END_REF]. Information contained in a variable can be studied through its categories, thus, MCA focuses mostly on variable categories. As for row-profiles, the distance between categories k and k is defined as the weighted sum of squared distances between the kth and k th column profiles with weights given by the inverse of the average column profile which has in this case all elements equal to 1/n:

d 2 k,k = n n i=1 x ik n k - x ik n k 2 = 1 p k + 1 p k - 2p kk p k p k , 1 ≤ k, k ≤ K, (1.2)
where p k = n k /n is the relative frequency of the category k and p kk the relative frequency of occurence of categories k and k . If k and k are different categories of the same variable, then p kk = 0. As it is defined, the distance between column profiles is a decreasing function with respect to the relative frequencies p k and joint relative frequencies p kk . Two categories are close one to each other with respect to this χ 2 distance if they have many individuals in common. Again, rare categories are far away from the others. In brief, it is important to take the frequency of each category into account. However, as remarked by [START_REF] Greenacre | The carroll-green-schaffer scaling in correspondence analysis: a theoretical and empirical appraisal[END_REF] and [START_REF] Greenacre | From simple to multiple correspondence analysis[END_REF], the terms 1/p k present in the χ 2 distance are hard to interpret.

Once that distances between objects (individuals and variables) have been defined, the next step in a MCA is to represent individuals and variables in new orthogonal systems and to make the geometric data analysis on smaller dimension sets [START_REF] Le Roux | Geometric Data Analysis: From Correspondence Analysis to Structured Data[END_REF]. As in principal component or correspondence analysis, new orthogonal systems are built such that they maximise the projected inertia of the individual cloud or variables on these new orthogonal axis, the inertia being defined as usual as the weighted sum of squared distance of individuals or variables to their barycenter. Each axis represents a certain percentage from the total inertia. However, these percentages in MCA are lower than in CA and more dimensions are needed to interpret properly the analysis. Transition relations link the cloud of individuals with the cloud of categories and a biplot representation is usually used as a joint map of individuals and variable categories. The contribution of each individual to each axis as well as the quality of its representation on each axis are obtained in a similar way to CA. For more details about the graphical representation and all matters connected therewith, see for example [START_REF] Greenacre | From simple to multiple correspondence analysis[END_REF], Escofier and Pagès (2008, chapter 4), Husson et al. (2016, chapter 3).

Log-linear model

Multivariate categorical data as multidimensional contingency tables (with an order greater than two-way) display relationships between categorical variables. This kind of data can me model by a log-linear model, that is a generalized linear model for Poisson regression. The Poisson distribution is the simplest distribution for count data. The model describes association and interaction among categorical variables and its purpose is to establish dependence patterns between variables. There is no distinction between explanatory or response variables since only the cell counts are considered. The reader may find a comprehensive description in Agresti (2013, chapter 9).

For the sake of simplicity, we present the method for three categorical variables X 1 , X 2 and X 3 respectively with K 1 , K 2 and K 3 categories. The most general log-linear model for the three-way table

K 1 × K 2 × K 3 is written as log µ k 1 k 2 k 3 = λ + λ X 1 k 1 + λ X 2 k 2 + λ X 3 k 3 + λ X 1 X 2 k 1 k 2 + λ X 1 X 3 k 1 k 3 + λ X 2 X 3 k 2 k 3 + λ X 1 X 2 X 3 k 1 k 2 k 3 , (1.3)
where µ k 1 k 2 k 3 is the expected frequency of the cell with

X 1 = k 1 , X 2 = k 2 and X 3 = k 3 .
The model-parameters are interpreted as follows: λ is the overall effect; λ

X j k j is the effect of the level X j = k j , j = 1, 2, 3; λ X j X j k j k j
is the interaction effect of levels X j = k j and

X j = k j , 1 ≤ j, j ≤ 3; finally λ X 1 X 2 X 3 k 1 k 2 k 3
is the interaction effect between the levels X 1 = k 1 , X 2 = k 2 and X 3 = k 3 . The model (1.3) is called the saturated model, it includes all possible main effects and interactions between the variables. Some constraints between the parameters ensure model identifiability and the number of free parameters in the saturated model is equal to the number of cells K 1 K 2 K 3 , which is why the saturated model fits the data perfectly. It reproduces exactly the observed cell frequencies and does not provide much relevant information.

The aim is to find the simplest model that fits the data adequately, that is, a more parsimonious model with less parameters. An unsaturated model is obtained by imposing the nullity of some coefficients in (1.3) and may be more appropriate due to simpler interpretations. Validation is performed thanks to goodness-of-fit assessment comparing the expected cell frequencies to the observed frequencies. The goodness-of-fit can be tested with the likelihood-ratio statistic:

G 2 = 2 K 1 k 1 =1 K 2 k 2 =1 K 3 k 3 =1 n k 1 k 2 k 3 log n k 1 k 2 k 3 μk 1 k 2 k 3 ,
where n k 1 k 2 k 3 and μk 1 k 2 k 3 are respectively the cell frequencies and the fitted values from model (1.3) taking into account the nullity constraint [START_REF] Agresti | Categorical Data Analysis[END_REF]. The G 2 statistic is used to determine the rejection or acceptance of a model. The larger the value of G 2 , the more evidence there is against that the related model does fit the data adequately, hence it should not be kept.

Tab 1.2: Different structures of log-linear models corresponding to different dependence structures. The third column "Symbol" corresponds to model notations, that is, the higherorder model term represented of each variable used in the model.

Log-linear model

Interpretation Symbol λ + λ X1 k1 + λ X2 k2 + λ X3 k3 mutual independence (X 1 , X 2 , X 3 ) λ + λ X1 k1 + λ X2 k2 + λ X3 k3 + λ X2X3 k2k3 independence of X 1 and (X 2 , X 3 ) (X 1 , X 2 X 3 ) λ + λ X1 k1 + λ X2 k2 + λ X3 k3 + λ X1X3 k1k3 + λ X2X3 k2k3 independence of X 1 and X 2 given X 3 (X 1 X 3 , X 2 X 3 ) λ + λ X1 k1 + λ X2 k2 + λ X3 k3 + λ X1X2 k1k2 + λ X1X3 k1k3 + λ X2X3 k2k3 homogeneous association (X 1 X 2 , X 2 X 3 ,X 1 X 3 )
Different types of unsaturated log-linear models correspond to different type of dependence between the variables X 1 , X 2 and X 3 . We will consider here only hierarchical models, meaning that if variables are involved in high order interactions, all the lower-order interaction term must also appear. For example, if the model contains λ 1.2 summarizes the different types of resulting models which are ordered with increasing complexity. The simplest model, noted (X 1 , X 2 , X 3 ), assumes the nullity of all the interaction effects and corresponds to the mutual independence of X 1 , X 2 and X 3 . The model with no interaction of order 3 and no interaction of second order between X 1 , X 2 and X 1 , X 3 is noted (X 1 , X 2 X 3 ) and corresponds to the independence of X 1 and (X 2 , X 3 ). The model with no interaction of order 3 and no interaction of order 2 between X 1 and X 2 is noted (X 1 X 3 , X 2 X 3 ) and corresponds to the conditional independence of X 1 and X 2 given X 3 . Finally, the model (X 1 X 2 , X 2 X 3 , X 1 X 3 ) has all interactions of order 2 but no interaction of order 3 and corresponds to homogeneous association that we will explain below. One goal of the analysis of the log-linear model is to find out which is the simplest model suitably fitting the data.

X 1 X 2 k 1 k 2 , then it also must contain λ X 1 k 1 and λ X 2 k 2 . Table
We now discuss marginal and conditional association of variables. A two-way contingency table can be obtained by marginalizing out the third variable, obtaining the so-called marginal table. Associations in this table are summarized by the marginal odd ratios. The marginal odds ratio of a 2 × 2 table (of X 1 and X 2 ) is defined by

θ X 1 X 2 = µ 11+ µ 22+ µ 12+ µ 21+ .
where µ ij+ = k 3 µ ijk 3 are the expected marginal frequencies with i, j = 1, 2 and k 3 a fixed category of X 3 .

The distribution of the two variables X 1 and X 2 can be displayed conditionally on different levels of X 3 using cross sections of the three-way contingency table. The associations in these cross-sections (also called partial tables) are called conditional associations and summarized by conditional odds ratios: for instance the ratio of the odds of a 2

× 2 × K 3 table is defined by θ X 1 X 2 (k 3 ) = µ 11k 3 µ 22k 3 µ 12k 3 µ 21k 3 .
On the other hand, the absence of interaction of order 3 in the model (X 1 X 2 , X 2 X 3 , X 1 X 3 ) implies that the conditional odds ratios do not depend on the category of the third conditioning variable [START_REF] Agresti | Categorical Data Analysis[END_REF]. This property explains the term homogeneous association.

In practice, often data sets contain a large number of categorical variables which may have a large number of levels. Hence, using log-linear models as described before would require a large number of higher order interactions. The estimation and interpretation of parameters may be difficult in such situations. To cope with this difficulty, one can restrict the interaction parameters to have some predefined form, for example a product form as suggested by [START_REF] Andersen | Discrete Statistical Models with Social Science Applications[END_REF], [START_REF] Goodman | Some useful extensions of the usual correspondence analysis approach and the usual log-linear models approach in the analysis of contingency tables[END_REF]. The resulting model, known as the multidimensional row-column or the RC association model is log-multiplicative rather than log-linear since it contains multiplicative terms for the interactions. The number of parameters from log-multiplicative models to be interpreted are considerably reduced in this way. Coefficients used in these multiplicative terms are closely related to elements from the singular value decomposition associated to the correspondence analysis of the contingency table as described in [START_REF] Van Der Heijden | A combined approach to contingency table analysis using correspondence analysis and log-linear analysis[END_REF]. The simple or multiple correspondence analysis may be also used to detect groups of variables or categories of variables which are mostly related. Then, one can fit a log-linear model using only these groups of selected variables/categories of variables. The resulting log-linear model is no longer hierarchical but the number of interactions is considerably reduced.

Ordinal regression model

The logistic regression is a popular supervised learning method for analysing dependencies between a response categorical variable Y (binary or multiclass) and explanatory variables denoted by X = (X 1 , . . . , X p ). More precisely, the logistic regression is used in order to separate the effects of each variable, that is, identify the effects of an explanatory variable X j , j = 1, . . . , p, on the response variable Y . The logistic regression for a binary or multiclass response variable will be presented briefly below, for more details see for example (McCullagh and Nelder, 1989, chapter 5), (Agresti, 1990, chapter 9) or (Hothorn and Everitt, 2014, chapter 7).

Let Y ∈ {0, 1} be a binary response variable. The logistic regression model is written as

P(Y = 1 | X = x) = F (β 0 + β T x),
where x ∈ R p , β 0 ∈ R, β ∈ R p and F (t) = e t /(1 + e t ), t ∈ R, is the inverse logistic link function. The coefficients β 0 , β 1 , . . . , β p are estimated by maximum likelihood method. Equivalently, the log odds of the event {Y = 1} given X = x is linear in x :

log odds(Y = 1 | X = x) = log P(Y = 1 | X = x) 1 -P(Y = 1 | X = x) = β T x.

RESULTS

Finally, a variable X j reveals to have an effect on the response variable if the result of the nullity coefficient test for β j is significant, that means, β j not equal to 0 (several nullity tests exist such as Wald test for instance).

Now, in this study, the focus lies on a categorical variable with more than two categories. Let Y be a multiclass response variable. The logistic regression for a multiclass response variable is an extension of the logistic regression for a binary one. When the categories {m 1 , . . . , m q } of the response variable Y are hierarchically ordered as m 1 ≺ . . . ≺ m q , a way to model Y is to suppose that there exists a latent unobserved continuous variable denoted

Y * ∈ R, with logistic distribution F , such that Y = m k if and only if c k-1 < Y * ≤ c k ,
where -∞ = c 0 < c 1 < . . . < c q-1 < c q = +∞ and k = 1, 2, . . . , q. Then, the ordinal regression model is written as

P(Y m k | X = x) = F (c k -β T x), (1.4)
where k = 1, 2, . . . , q -1. Note that the general intercept β 0 is replaced by the set of ordered intercept paramaters c k mentioned before. The unknown coefficients c 1 , . . . , c q-1 , β 1 , . . . , β p are estimated by maximimum likelihood.

Model (1.4) is also called the proportional-odds model due to the following property: the log odds ratio of {Y

m k } at X = x 1 and X = x 2 is given by log odds(Y m k | X = x 1 ) odds(Y m k | X = x 2 ) = -β T (x 1 -x 2 ),
and does not depend on the category m k .

Results

This section aims at giving a multivariate analysis of Franche-Comté road crash data by using the above described methods. Our analysis begins by performing several MCA analyses on road crash variables to provide insights multivariate road crash related variables by using geometric data visualization. This method is a powerful tool to distinct non-trivial category associations if it is the case. More exactly, MCA analyzes were performed by considering temporal and spatial features separately and next, a global MCA analysis based on temporal, spatial features and variables which revealed to be most related one to another from separate MCA analysis. General features such as crash gravity, alcohol/drug consumption, road type and so on were included in the three performed MCA analyzes. These MCA analyzes revealed several association and interaction patterns among the set of categorical variables related to road crash gravity and hierarchical and non-hierarchical log-linear models were fitted in second time to describe more thoroughly these associations. Finally, the ordinal regression model allows to quantify the effects of each explanatory variable on the ordered response variable road crash gravity.

This study used open-source R software packages FactoMineR [START_REF] Lê | FactoMineR: A package for multivariate analysis[END_REF] and factoextra [START_REF] Kassambara | factoextra: Extract and Visualize the Results of Multivariate Data Analyses[END_REF] to perform MCA, glm function to perform loglinear models, then packages MASS [START_REF] Venables | Modern Applied Statistics with S[END_REF] and ordinal [START_REF] Christensen | ordinal: Regression models for ordinal data[END_REF] to perform ordinal logistic regression. Graphics were plotted with ggplot2 package [START_REF] Wickham | ggplot2: Create Elegant Data Visualisations Using the Grammar of Graphics[END_REF].

MCA of road crash temporal variables

We conducted a MCA temporal analysis by considering general and temporal features as described in Section (1.2.1). Spatial features are not included in MCA analysis. Fig (1.2) gives the percentages of variance explained by each of the first ten axes built by the MCA analysis. The first three-factorial axes explain 22,09% of the total variance and only these axes were kept for further analysis. Two-dimensional geometrical representations are given in Fig ( 1.3)-(1.5) and interpreted below. Each time, only the 25 best represented categories have been plotted.

The two-dimensional map in Fig (1.3) gives the representation of categories on the plane made by axis 1 and axis 2 and it accounts for 16,07% of the total inertia. The more categories a variable has, the more it contributes to the inertia. The variables season and weather are not represented on the first factorial plane since they are very poorly represented on this plane. Next, categories with the greatest contribution to the axis 1 are "night" (13,26%), "none" from obstacle (10,57%) and "midnight 6am" (9,26%) and respectively, "pedestrian" (28,45%), "urban" (19,04%) and "other kind" from collision (11,46%) for axis 2.

In this first factorial plane, axis 1 shows the contrast between weekday accidents (accidents occurring during the week) and weekend ones (accidents occurring during the weekend). Weekday accidents are more frequent during the day and mostly around lunch time, in urban areas, on communal roads and are not associated to alcohol or drug consumption. These accidents are more likely to happen on straight roads, at intersections and caused by collisions between several vehicles. Weekend accidents, instead, are more frequent during the night and mostly between 8 pm and 6 am, outside urban areas and involve more frequently drug consumers. These accidents occur mainly on curve roads and no external factors seem to impact (out of intersections, no bumped mobile obstacles or no collisions). To sum up, this first factorial axis is related to fatal accidents.

Axis 2 provides a similar information as axis 1: it opposes accidents occurred during weekday time, in urban area, at intersection and on straight road to accidents occurred during weekend time, outside urban area, out of intersection and on curve road. However, axis 2 stresses the fact that fatal road crash are more likely to occur between midnight and 6 am especially when alcohol and drugs have been consumed. Geometrical representations derived in MCA plot closely associated categories and unassociated ones further apart. The first factorial plane reveals several strong associations among categories: categories "straight", "intersection", "weekday", "substance none", "11am 3pm", "collision usual" are strongly associated to categories "obstacle vehicle"; categories "curve", "out of intersection, "week end", "unurban" are strongly associ-ated to "fatal"; "night", "8pm 11pm", "midnight 6am", "obstacle none", "alcohol" and "alcohol drug" in the same way.

On the other hand, this factorial plane also shows that some categories are far from the others, this results from their lower frequencies. Indeed, as it is given in Tab 1.1, "obstacle pedestrian" and "type road other kind" represents respectively only 8,28% and 2,53% of road accidents. (1.4) gives the two-dimensional map of axis 1 and axis 3 and it explains 15, 32% of the total inertia. The variable area has been omitted from this geometrical representation due to its poor representation quality. Categories that contribute the most to axis 3 are categories "night" (11,82%), "none" (11,08%) of the variable collision and category "winter" (10,96%) of the variable season.

Fig

In this factorial plane, axis 3 suggests that summer accidents tend to differentiate from winter ones. Summer accidents are more likely to occur during the day, around lunch time and on week-end time. They are globally associated to no alcohol or drug consumption, happening on curve roads, out of intersections and other kind of collision. Winter accidents instead occur more frequently during the night, the week time and on national roads. They are also mostly associated with substances consumed, happening on straight roads, at intersections and collisions with vehicles. The associations with straight roads, intersections and collisions with vehicles seem to be caused by weather ("other kind") which is generally snowy in winter. In addition, the axis 3 specifies that winter accidents are more likely to be fatal.

Two groups of strongly associated categories stand out in the second factorial plane: the group formed by "obstacle vehicle", "collision usual", "intersection", "straight", "weekday", "substance none", "day", "11am 3pm" and the other group formed by "summer"; "night", "8pm 11pm", "midnight 6am", "alcohol drug". These groups resonates to those mentioned previously. (1.5) gives the two-dimensional map of axis 2 and axis 3 and it explains 12,79% of the total inertia. From the thirteen variables used, the variables substance, week and intersection are very poorly represented on this map and are omitted from this geometrical representation. This plot emphasizes the differences between serious and fatal accidents which tend to be strongly associated with lunch time and respectively night time. We distinguish two groups of close categories: "winter", "night", "fatal", "8pm 11pm", "obstacle vehicle", "collision usual" and "weather other kind"; "type road departmental", "serious", "weather normal", "spring", "curve", "day", "summer", "11am 3pm" and "obstacle none".

Fig

MCA of road crash spatial variables

We performed a spatial analysis by considering the general features as well as the spatial ones as described in the Section (1.2.1). Temporal variables (season, week, daytime and time) are not considered in this analysis. Due to the several categories of the variable canton, the spatial analysis of Franche-Comté has been splitted into two analyses corresponding to Doubs and Jura departments. We will interpret only relationships from categories situated close one to another in the plot.

Doubs department

For the spatial analysis of Doubs department, the first four factorial axes explain 21,22% of the total inertia. Note that only the first 25 categories with the most important representation qualities were plotted.

Plot made by axis 1 and axis 2 given in Fig ( 1.7) explains 12,74% of the total inertia. Not all the variables are plotted, the variable weather is less well represented than the other categories and it does not figure on the plot. Categories which contribute the most for axis 1 are "none" (20,77%) and "vehicle" (14,06%) from obstacle, then "usual" from collision (12,88%); and for axis 2"pedestrian" (22,53%), "urban" (18,92%) and "other kind" from collision (9,73%).

As mentioned before, associations can be highlighted by the proximity of categories on the factorial plot. Two groups of close categories with spatial connotations stand out: "type road other kind", "type road communal", "Bethoncourt", "urban" and "Valentigney"; "Besançon", "collision usual" and "obstacle vehicle". The first group emphasizes that Bethoncourt and Valentigney accidents are more frequent in urban areas. The second one strongly insists that the canton of Besançon is more conducive to collisions with vehicles.

Additional plots made by combinations of axis 1, 2, 3 and 4 explain between 8,48% and 11,01% of the total inertia, it should be noted that compared to each other the associations do not differ. These plots indicates, in addition to what was said before, that Besançon accidents tend to be fatal when the weather is bad and more characterized by bumped pedestrians; Bethoncourt accidents are mostly associated with substance consumption and very strongly associated to "drug"; Baume-les-Dames accidents are more likely to be fatal; Besançon, Saint-Vit and Ornans accidents are mainly similar and more frequent on communal and national roads; most of Maîche accidents are not caused by collisions.

Jura department

For the spatial analysis of Jura department, the first four factorial axes explain 21,88% of the total inertia. Note that only the first 25 categories with the most important representation qualities were plotted.

Plot made by axis 1 and axis 2 explains 13,08% of the total inertia and is given in Fig (1.9). Not all the variables are plotted, the variable weather is less well represented than the other categories and it does not figure on the plot. Categories which contribute the most for axis 1 are "none" (18,34%) and "vehicle" (13,79%) from obstacle, then "usual" from collision (11,94%); and for axis 2 "pedestrian" (24,89%), "urban" (18,69%) and "other kind" from type road (11,23%).

We can distinguish three groups of close categories, with components of the canton variable that stand out in this factorial plane: "Saint-Lupicin", "fatal", "drug", "alcohol drug", "alcohol" and "obstacle none"; "Authume", "Saint-Laurent-en-Grandvaux", "unurban", "type road departmental" and "out of intersection"; "Champagnole", "urban" and "type road communal". The first group highlights that accidents in the canton of Saint-Lupicin are more likely to be fatal and associated to alcohol and drug consumption. The second one tells that accidents happening in Authume and Saint-Laurent-en-Grandvaux are more frequent in non urban areas, on departmental roads. Then, the third group of close categories shows that accidents in the canton of Champagnole are occuring more commonly in urban areas and on communal roads. Finally, the structure of this factorial plane tells that accidents happening in Authume, Saint-Laurent-en-Grandvaux and Saint-Lupicin are more likely to be fatal.

Additional plots made by combinations of axis 1, 2, 3 and 4 explain between 8,81% and 11,24% of the total inertia, it should be noted that compared to each other the associations do not differ. The cantons of Champagnole, Morez and Saint-Laurent-en-Grandvaux have been associated to each other in many factorial planes, it seems that accidents are more likely to happen in these cantons when the weather is qualified as "other kind" (cloudy, rainy or snowy). This is opposed to accidents happening in Authume and Bletterans where accidents are more frequent when the weather is "normal". Many cantons have been related to alcohol or drug consumption: accidents occurring in the Dole canton are more commonly associated to drug, Moirans-en-Montagne and Saint-Claude cantons are instead matched to alcohol. Finally, the canton where accidents happen in higher proportion on highway is Dole, it is also the canton where accidents are more likely to be fatal, and finally, the canton where pedestrians are bumped in much higher amounts is Champagnole.

MCA of road crash temporal and spatial variables

Here was conducted a global MCA by considering both temporal variables (time, season, daytime and week ) and spatial variables (department) as well as the most important general features such as type acc and substance. The first three-factorial axes explain 25,85% of the total variance and only these axes were kept for further analysis. Two-dimensional geometrical representations of all 24 categories are given in Fig ( 1.10)-(1.12) and interpreted below.

The first two-dimensional map in Fig (1.10) gives the representation of categories on the plane made by axis 1 and axis 2 and it accounts for 19,13% of the total inertia. Categories with the greatest contribution to the axis 1 are "night" (25,75%), "midnight 6am" (13,83%) and "8pm 11pm" (11,88%) and respectively, "winter" (21,99%), "slight safe" (21,10%) and "week end" (9,33%) for axis 2.

Axis 1 shows the contrast between serious accidents occurring during the day (between 7:00 a.m. and 7:59 p.m.) from fatal accidents happening during the night (between 8:00 p.m. and 6:00 a.m.). In the first situation, the accidents happen under good daylight conditions, during the spring and the summer time and mostly during the week-time (from Monday to Friday). In the second situation, accidents occur during the week-end and they are associated to alcohol/drug consumptions.

Axis 2 dissociates clearly slight accidents from serious and fatal ones. Accidents occurring in Territoire de Belfort are mostly slight accidents while accidents from Jura are in general serious or fatal. As for the first factorial axis, axis 2 shows the contrast week accidents from week-end accidents which are fatal most of the time. We can notice that accidents occurring in the Doubs department are similar to those from the department of Haute Saône and relatively close to the origine represented by the average accident profile.

The first factorial plane reveals five groups of associated categories: "slight safe", "Terr Belfort" and "winter"; "weekday", "7am 10am" and "none"; "fatal", "week end" and "drug"; "serious", "spring", "summer" and "Jura"; enfin "night", "8pm 11pm", "alcohol drug", "midnight 6am" and "alcohol".

Notice also that from this plot, the group formed by categories "Territoire Belfort", "winter" and "slight safe" is relatively far away from the origin of the plot. This is due to the fact that categories "Territoire Belfort" and "slight safe" are of low relative frequencies, 6, 20% and respectively 11, 47%, see also Tab 1.1.

Plot made by axis 1 and axis 3 given in Fig ( 1.11) explains 18, 87% of the total inertia. Categories with the greatest contribution to the axis 3 are "Terr Belfort" (14, 96%), "slight safe" (12, 84%) and "spring" (10, 87%).

Axis 3 seems to contrast accidents occurring in spring/summer from those occurring in autumn/winter. In the first situation, accidents happen mostly during the day, on week-end and they may have minor consequences or, on the contrary, they may be very serious. In the second situation, the accidents occur during the night, on week-time and they may be serious. Again, the department of Jura is in opposite situation with the department Territoire de Belfort. We can also notice that the department Doubs seems to be the department where most of accidents are associated to drugs. Several groups of categories can be distinguished: "drug", "Doubs" and "summer"; "Haute Saone" and "serious"; "none", "4pm 7pm" and "weekday"; "Jura", "autumn" and "winter".

Finally, the two-dimensional map of axis 2 and 3 given in Fig ( 1.12) explains 13, 70% of the total inertia. This plot highlights several associations that were analyzed in previous ones. For example, fairly similar modalities are "8pm 11pm" and "Doubs"; "spring", "11am 3pm", "drug", "week end", "summer" and "fatal".

Hierarchical log-linear modelling

The MCA performed in sections 1.3.1 and 1.3.2 reveals that there are associations between the gravity of the accidents (type acc) and the drug/alcohol consumption (substance). Moreover, we could see during the spatial analysis that these associations are observed within each department. In order to describe more thoroughly the association patterns between these categorical variables and the variable department, several hierarchical log-linear models have been fitted on the related three-way contingency table (corresponding to the column "Observed values" of the table Tab 1.3). Tab 1.4 gives the likelihood-ratio statistic G 2 of each hierarchical model and the 5%-level associated significance test (p-value). A model fits the data well if the null hypothesis of the goodness-of-fit test is accepted. The p-values in Tab 1. 4 show that all the models fit the data poorly except (TS, TD, SD) which is close to the observed data (corresponding to the column "Fitted values" of the table Tab 1.3). This unsaturated hierarchical final model has been kept as the objective was to find the simplest model that fits the data adequately. It is written as

log µ kk k = λ + λ T k + λ S k + λ D k + λ T S kk + λ T D kk + λ SD k k ,
where k is "slight safe", "serious" or "fatal" for the categorical variable type acc (T) ; k is "none", "alcohol", "drug" or "alcohol drug" for the variable substance (S) ; and k is "Doubs", "Haute Saone", "Jura" or "Terr Belfort" for the variable department (D). This is the model with no three-factor interaction. The conditional association terms appear for each pair of variables, this means that no pair is conditionally independent. The odds ratios related to this model have been calculated and are given in Tab 1.5. Note that the baseline categories of type acc, substance and department were respectively "slight safe", "none" and "Doubs". For instance, the odds ratio relating the level "serious" of type acc and "alcohol drug" of substance at the level "Doubs" of department is calculated as 25, 64 × 221, 37 1149, 58 × 3, 96 = 1, 25.

Remind that the no three-factor interaction model means that the association between two variables is identical at each level of the third variable. Hence, in the same way, calculating this odds ratio with the fitted values regarding to the levels "Haute Saone", "Jura" or "Terr Belfort" of department would have given the same result.

In general marginal odds ratios may differ from conditional ones in a no three-factor

1.3. RESULTS
interaction model, however in this case marginal and conditional odds ratio are very close. This means that controlling or ignoring the third variable does not change significantly the association between the two variables. Only conditional odds ratio will be interpreted below as the interpretations of marginal ones are the same.

Regarding substances consumption, the odds for an accident to be serious or fatal increases when alcohol, drug or both are consumed. Indeed, the odds ratios for an accident to be serious are estimated to be respectively 1,64, 1,94 and 1,25 higher than slight when alcohol, drug and both are consumed compared with no consumption. Similarly, the odds ratios for an accident to be fatal are estimated to be respectively 2,76, 4,15 and 5,93 higher than slight when alcohol, drug and both are consumed. The highest risk for an accident to be fatal corresponds to drug and alcohol consumption, almost two times larger than alcohol consumption. Regarding the department where the accident happens, the odds to be serious or fatal decreases only for the department Territoire de Belfort. The odds ratio for an accident to be serious is estimated to be 0,48 times lower than slight when it occurs in this department compared with Doubs. Similarly, the odds for an accident to be fatal is estimated to be 0,39 times lower than slight when it occurs in Territoire de Belfort compared with Doubs. The highest risk for an accident to be fatal is when it occurs in Jura department compared with Doubs, almost four times larger than in Territoire de Belfort.

Tab 1.3: Three-way contingency table with type acc, substance and department as categorical variables. Left side correspond to the observed values, right one is equal to the predicted frequencies from the log-linear model (TS, TD, SD).

Observed values

Fitted values ( The goal here was to fit a log-linear model with more than three categorical variables. In order to do that, the global MCA analysis performed in the previous section has been used to choose several variables associated to the road crash severity and to fit a log-linear model with a limited number of parameters but well chosen. A similar analysis has been performed by [START_REF] Papagiotakos | Interpretation of epidemiological data using multiple correspondence analysis and log-linear models[END_REF]. The global MCA analysis revealed several groups of associated variables/categories such as "slight safe", "Terr Belfort" and "winter"; "night", "8pm 11pm", "alcohol drug", "midnight 6am" and "alcohol", or even more "fatal", "week end" and "drug". These three groups suggest that it might exist interactions between the variables type acc, department and season ; daytime, time and substance ; and finally, type acc, week and substance.

Based on these considerations, the following log-linear model has been fitted:

log µ k 1 k 2 k 3 k 4 k 5 k 6 k 7 = λ + λ T D k 1 k 3 + λ SD k 2 k 3 + λ DaT iS k 7 k 4 k 2 + λ T W S k 1 k 6 k 2 + λ T DSe k 1 k 3 k 5 + λ W T iS k 6 k 4 k 2 + λ T iSD k 4 k 2 k 3 , (1.5)
where k 1 is "slight safe", "serious" or "fatal" for the categorical variable type acc (T); k 2 is "none", "alcohol", "drug" or "alcohol drug" for the variable substance (S); k 3 is "Doubs", "Haute Saone", "Jura" or "Terr Belfort" for the variable department (D); k 4 is "7am 10am", "11am 3pm", "4pm 7pm", "8pm 11pm" or "midnight 6am" for the categorical variable time (Ti); k 5 is "spring", "summer", "autumn" or "winter" for the variable season (Se); k 6 is "weekday" or "week end" for the variable week (W); and k 7 is "day" or "night" for the variable daytime (Da).

Several different log-linear models have been fitted and compared one to each other, this final model was the one with the smallest likelihood-ratio statistic G 2 . This log-linear model contains specific second and third order interactions between the seven chosen variables based on the global MCA. As mentioned before, these interactions have been decided upon the groups of associated variables revealed in the global MCA. Considering all the second and third interaction terms in the log-linear model would cost in term of interpretation and feasibility.

Tab 1.6: Seven-way contingency table with type acc (T), department (D), substance (S), time (Ti), season (Se), week (W) and daytime (Da) as categorical variables. Left side correspond to the observed values, right one is equal to the predicted frequencies from the log-linear model 1.5.

Observed values

Fitted (3840). This table gives frequencies for categories "Doubs", "none", "7am 10am", "spring" and "day" of respectively department, substance, time, season and daytime variables; and "Doubs", "none", "11am 3pm", "week end" and "day" for respectively department, substance, time, week and daytime variables. The first partial table (top) details according to week and type acc variables and the second partial table (bottom) details according to season and type acc variables.

The odds ratios related to the fitted log-linear model from (1.5) have been calculated in the same way as in the previous section and are given in Tab 1.7. The baseline categories used of type acc, week and season were respectively "slight safe", "weekday" and "spring".

Here, conditional odds ratios may differ according to which levels of the variables we have conditioned. However there are too many possible combinations of levels with our seven categorical variables used, hence only conditional odds ratios regarding to the fixed levels, as in Tab 1.7, were calculated. Notice a slight difference between the conditional odds ratios and the marginal ones. However, the interpretations are the same, except for the level "winter" of the variable season for which the odds ratios have a different conclusion depending on whether they are conditional or marginal.

Conditional and marginal odds ratios inform that the risk of an accident being serious or fatal increases if it occurs during the weekend. Indeed, the conditional and marginal odds ratios for an accident to be serious are estimated to be equal to 1,38 on week-ends and respectively 1,12 and 1,34 for an accident being fatal, on week-ends as well. Both kinds of odds ratios tell us that the risk for a crash to be serious or fatal than slightly increases if it occurs in summer or autumn in comparaison with spring. Conditional and marginal odds ratios for an accident to be serious are estimated to be respectively 1,42 and 1,27 if it occurs in summer, 1,54 and 1,37 if it is in autumn. They are estimated to be respectively equal to 1,41 and 1,03 for a fatal crash in summer, 1,77 and 1,23 in autumn. For those occurring during winter with respect to spring, interpretations differ regarding to conditional or marginal odds ratios. Indeed, the risk for an accident to be serious does not seem to depend on the fact that it occurs in winter with respect to spring, the conditional odds ratio being equal to 1,01. The marginal odds ratio is equal to 0,90 meaning that this risk decreases slightly if it occurs during winter. As for the fatal consequences of an accident occurring in winter, the risk would be slightly increased compared to spring according to the conditional odds ratio equal to 1,14; the marginal odds ratio equal to 0,91 informs us that this risk would be slightly reduced.

Ordinal regression modelling

An ordinal regression has been fitted on the response variable type acc (ordered as slight safe, serious and then fatal). The analysis was performed with all the explanatory variables except canton (due to too many categories).

Note that the categorical variable type acc is considered as a response variable. It is relevant because it gives the severity of accidents and the aim of this study lies on understanding how the gendarmerie can avoid serious injuries.

The initial dataset has been split randomly into two sets: a training set (seventy-five 1.3. RESULTS Tab 1.7: Odds ratio estimated from log-linear model 1.5. The table is divided into two parts, each part is also split up into two parts: conditional odds ratios in top have been calculated in left side controlling the levels of department, substance, time, season and daytime then right side controlling the levels department, substance, time, week and daytime variables, and marginal odds ratios in bottom have been calculated in left side ignoring department, substance, time, season and daytime then in right side ignoring department, substance, time, week and daytime variables. Each odds ratio has been calculated as each level of type acc, week and season variable and was opposed respectively to "slight safe", "weekday" and "spring". Next, a variable selection has been performed by using AIC criterion (with backward selection). The final model is composed by the categorical variables time, substance, department, collision and area. This model gives a misclassification error of 29,00% on the test set, a score very close to the previous one. The odds ratio of these variables are given in Fig (1.13). Only odds ratios with confidence intervals not containing the value 1 (represented by the vertical dotted line) are interpreted.

Regarding the odds ratio, the highest risk for an accident to be serious or fatal is if substances have been consumed by one of the drivers involved. Indeed, the most two important odds ratios are alcohol drug and drug which are equal to exp(1, 16) = 3, 19 and exp(0, 85) = 2, 34 respectively. The risk for an accident to be serious or fatal increases if the accident happens in non urban areas (odds ratio 2,10) or in the Jura department (odds ratio 1,42 with Doubs as reference). Accident involving uncommon collision also have a slightly increased risk (odds ratio 1,28). On the opposite, two categories have a protective effect and are associated with lower risk of serious or fatal accident. This is the case for Territoire de Belfort department (odds ratio 0,56 with Doubs as reference) and for the occurrence time between 4pm and 7pm (odds ratio 0,77).

Each department odds ratio has been represented on the map in Fig 1 .14. Remind that the odds of Haute-Saône department were not significant and hence meaningless. The odds Tab 1.8: Ordinal regression model results with type acc as ordered response variable. The item * means that the p-value of the nullity coefficient test is less than 0,05. The category in parentheses correspond to the baseline category of the above categorical variable. ratio of Doubs department is equal to 0 as it was the baseline category for the department variable. As a symbol, Jura and Territoire de Belfort departments have been represented in red and blue respectively due to their odds ratio: the riskiest and the less risky.

Summary of injury road accident analysis and discussions

A study of accidents with the purpose of mitigating the crash severity is critical for the well-being of a society and the safety concern posed by road crashes. The aim of this work was to understand factors which are the most influential in road accidents from the French region Franche-Comté. To respond to these issues, three statistical methods were used: Multiple Correspondence Analysis (MCA), log-linear model and ordinal logistic regression.

MCA, the only unsupervised or descriptive statistical method used in this study, allowed to assess relationships between the categorical variables and examine the associations between the different categories. Geometric representations of data in smaller dimension spaces were produced and proximities between several road crash related categories have been observed. This analysis allowed to establish a global vision of the data and to draw up temporal and spatial profiles of accidents occurring in the Franche-Comté region. Regarding the MCA temporal analysis, several associations have been highlighted. We remarked that accidents occurring during the week are different from those occurring during the weekend. Indeed, weekend accidents are more likely to happen during the night, be fatal and associated to alcohol/drug consumption. There was also a contrast between summer and winter accidents. The MCA spatial analysis revealed that several cantons of the Franche-Comté region are strongly related to alcohol/drug consumption (Bethoncourt, Saint-Lupicin or Dole) or to fatal accidents (Besançon, Baume-les-Dames, Authume, Saint-Laurent-en-Grandvaux, Saint-Lupicin and Dole).Bethoncourt, Besançon and Baume-les-Dames are situated in the Doubs department and others in the Jura department. Finally, the global MCA temporal and spatial analysis allows to analyse the departments in association to alcohol/drug con-

SUMMARY RESULTS AND DISCUSSIONS

sumptions and crash severity in temporal ways. Many contrasts have been highlighted and groups of close categories have been analysed. It seems that Jura department is the department where most of accidents are serious or fatal, instead of Territoire de Belfort department which is associated to minor consequences.

The log-linear model was used next in order to evaluate dependencies between the road crash gravity, the alcohol/drug consumption and Franche-Comté departments. This tool models the multidimensional contingency table formed by these three categorical variables and describes associations and interactions among them. It allowed establishing patterns. The selected model concludes on no interaction between the categorical variables type acc, substance and department. It corresponds to the model of homogeneous association, which means that each pair of variable were conditionally dependent. Odds ratios estimated from this model allowed to quantify the risks about alcohol/drug consumption and the department where the accident happened. We remarked that the highest risks for a serious or fatal accident to happen are if drug, alcohol or both are consumed. Conversely, the lowest risk for an accident to be serious or fatal is if it happens in the Territoire de Belfort department. The Jura department was, instead of the previous one, a location which increases this risk. Then, a second log-linear model was fitted, a non-hierarchical one. This model used results from the global MCA. The fairly similar groups of categories were translated into variable interactions which thus induced the fitted log-linear model. This model revealed many associations between variables. Odds ratios estimated from this model allowed to quantify the risk of an accident occurring during the week or the week-end, or occurring in spring, summer, autumn or winter. According to the conditional odds ratios calculated with respect to spring level, the highest risk for an accident to be serious or fatal is if it occurs in autumn.

The ordinal regression allowed the study to assess each effect of road crash related factors on the road crash gravity. Eight circumstances revealed to be influential on the accident gravity: the consumption of alcohol, drug or both; the period of the day between 4pm and 7pm; the roads situated outside urban areas; the roads situated in Jura or Territoire de Belfort departments; collisions qualified as "other kind" (not usual as frontal or rear-end for example). Odds ratios estimated from this model allowed to quantify the risks due to each of these circumstances. Similarly to the log-linear analysis, the risk of an accident being fatal is highest if alcohol and drugs are consumed and lowest if the accident happens in the Territoire de Belfort department.

The results obtained with these three methods allow us to conclude that the most important factor to take into account for road crashes in Franche-Comté is the alcohol/drug consumption. As expected, this factor strongly influences the nature of accidents. Hence, based on results obtained with this statistical study, more efforts should be gathered by the National Gendarmerie of Besançon to prevent the alcohol/drug consumption especially in the cantons which were associated to this factor. For example, more alcohol/drug tests and driver awareness measures can be performed.

In order to be more precise for the spatial analysis, the future study would be focused on how GPS coordinate can be used to prevent accidents.

The previous part of this thesis is composed of the Chapter 1 that globally focused on the analysis of road crash injuries. Now, the purpose of this second part is to geographically anticipate the accident occurrences. Chapter 2 corresponds to the data preparation in order to be used in Chapter 3 for the statistical methods. The chapters 2 and 3 consider only the spatial component and Chapter 4 this time tries to undertake the temporal component of the data.

While the first part of the thesis is concerned with unsupervised and supervised classical statistical methods, the second part is now concerned with spatial statistics. As it was a field totally unknown to me, I decided to give in Chapter 2, 3 and 4 the implementations of the used statistical methods on the software R in an educational way.

The reader may pay attention now to the new notations: X denotes a spatial point pattern; Y a Gaussian process; Z a vector of covariates values.

Chapter 2

Spatial road crashes and related factors data handling

Spatial point pattern and areal interpolation methods

This work introduces the notion of spatial point patterns. First examples of possible manipulations on the software R of such objects are given. The spatial point pattern used and handled here corresponds to the road accident data that occurred between 2017 and 2019 in the CAGB (urban community of Besançon). Then, the research of relevant related factors to road accidents has been investigated and the information brought has been set properly on a global support. The support chosen is a regular 64 × 64 grid of cells 650 × 650 meters. The methods undertaken here to merge the several characteristics, given each at a different scale, into one support are interpolation methods. The purpose of the following work is to technically prepare all these spatial elements (road crash point pattern and related factors) for a statistical modelling in the next chapters and to give the possible existing R software tools that allow to do this pre-processing.

Introduction

The previous chapter focused on giving a multivariate statistical analysis of road crash data from the French region of Franche-Comté with special attention to road crash gravity. Multiple Correspondence Analysis, Log-linear models and ordinal logistic regression were performed in order to assess associations between the road crash injury and several important accident-related factors. The purposes of this analysis make it possible to raise awareness and insist more on the consequences of these accidents according to the behaviour of the drivers involved (such as alcohol/drug consumption for example). In addition to this behavioural preventive character, the objective now is the spatial analysis and prediction, that is, geographically anticipate the occurrence of these accidents. Some spatial components were used in the previous analysis such as the canton or the department where the accident occurred. The final goal now is to perform a spatial analysis at a finer scale. In order to fulfill this objective, the main interest is the exact locations of these accidents and this is what the analysis will focus on. This chapter deals with georeferenced road crash data recorded in several locations in the Doubs department of the French region of Franche-Comté. More particularly, we will present in the following sections the manipulations and implementations of specific statistical and graphical tools available in the software R (R Core Team, 2021) to handle this kind of spatial data for the fitting of a statistical model in the next chapter.

The following librairies will be used :

> library ( FRK ) > library ( ggplot 2 ) > library ( leaflet ) > library ( lgcp ) > library ( maptools ) > library ( rgdal ) > library ( rgeos ) > library ( sf ) > library ( sp ) > library ( spatstat ) > library ( tidyverse )

R packages FRK (Zammit-Mangion and Sainsbury-Dale, 2022), maptools [START_REF] Bivand | maptools: Tools for Handling Spatial Objects[END_REF], rgdal (Bivand et al., 2021a), rgeos [START_REF] Bivand | rgeos: Interface to Geometry Engine -Open Source[END_REF], sf (Pebesma et al., 2022), sp [START_REF] Pebesma | sp: Classes and Methods for Spatial Data[END_REF] and spatstat [START_REF] Baddeley | spatstat: Spatial Point Pattern Analysis, Model-Fitting[END_REF] deal with spatial data and are used in order to handle this kind of data. The packages ggplot2 [START_REF] Wickham | ggplot2: Create Elegant Data Visualisations Using the Grammar of Graphics[END_REF], and leaflet [START_REF] Cheng | leaflet: Create Interactive Web Maps with the JavaScript[END_REF] are used for plot. Finally lgcp [START_REF] Taylor | Inla or mcmc ? a tutorial and comparative evaluation for spatial prediction in log-gaussian cox processes[END_REF] is the package used to fit our statistical model and tidyverse [START_REF] Wickham | tidyverse: Easily Install and Load the 'Tidyverse[END_REF] for data wrangling basic operations.

The current chapter is structured as follows. Section 2.2 describes how to create a point pattern object, specific class in the software which handle geographical locations points, for our road crash data. Then Section 2.3 deals with environment resources that will be associated to the point pattern built in last section. More particularly, Section 2.3.1 is concerned in creating a grid support to welcome these resources and the interpolation of this information onto the latter grid is in Section 2.3.2.

Road accident spatial point pattern

Data used in this study concern road injury crashes, that are, accidents that occurred on a public road involving at least one vehicle and resulting in at least one victim requiring cares. These data are extracted from the French national analysis bulletin of road traffic injury accidents called BAAC file (Bulletin d'Analyse des Accidents Corporels) available as open data on the French platform www.data.gouv.fr. The BAAC data are filled in by the security forces present on the accident scene and next, data are treated, analyzed and put online by the national interdepartmental observatory of road safety (Observatoire National Interministériel de la Sécurité Routière). Datasets from BAAC file include accident location information, as filled in on scene, as well as information regarding the characteristics of the accident and its location, the involved vehicles and their victims.

This study deals with road crashes that occurred between 2017 and 2019 in the CAGB (Communauté d'Agglomération du Grand Besançon), headquarters of the region Franche-Comté and urban community of Besançon (central municipality) composed of 68 cities.

> c _ 2 0 1 9 <-read _ delim ( " DATA / caracteristiques -2 0 1 9 . csv " , + delim = " ; " ,

+ escape _ double = FALSE , + trim _ ws = TRUE ) > c _ 2 0 1 8 <-read _ csv ( " DATA / caracteristiques -2 0 1 8 . csv " ) > c _ 2 0 1 7 <-read _ csv ( " DATA / caracteristiques -2 0 1 7 . csv " )
Files extracted from the French open platform data.gouv are .csv extension files. Datasets c 2017, c 2018 and c 2019 are structured in order to extract only accidents that occurred in the CAGB and then merged into one dataset called cagb (command-lines not shown). This dataframe has 397 observations and two columns named x and y which represent respectively the longitude and the latitude of the accident location.

When dealing with spatial data, the first step is to pay attention to a very important aspect : the coordinate reference system (CRS) used. This system is a standard way to describe geographical data and is defined by a projection, a datum and a set of parameters. The projection corresponds to how the three dimensional angular system (defined by the longitude and the latitude) is transformed into a two dimensional planer system. Then, the datum is a model of the shape of the earth which estimates the angles of the angular system. Most commonly used CRSs have been assigned a unique identifier called EPSG code. The CRS used in the BAAC file is defined by the datum W GS84, also called World Geodesic System 1984, which is the global reference system. This CRS has EPSG:4326. Data from cagb are then visualized in Fig 2 .1 using leaflet package as follows:

> leaflet ( data = cagb ) % >% addTiles () % >% + setView ( lng = 6 . 0 1 , lat = 4 7 . 2 4 , zoom = 1 1 ) % >% + addCircleMarkers (~x , ~y ,

+ weight = 1 , + fillOpacity = 1 , + radius = 1 , + color = " black " )
Several datasets will be loaded and used in the following, hence, it is important to transform them to a common CRS so they align with one another. For more convenience, the CRS chosen to be used is RGF 93, also called Lambert 93, with EPSG:2154. This CRS has the advantage to deal with actual shapes, dimensions and distances.

Data in the form of a set of points X = {x 1 , . . . , x n } of R 2 , irregularly distributed over a study area, is called a spatial point pattern and refers to the locations as events. The reader may find comprehensive descriptions of spatial point pattern and applications in R respectively in [START_REF] Diggle | Statistical Analysis of Spatial and Spatio-Temporal Point Patterns[END_REF] and [START_REF] Baddeley | Spatial Point Patterns: Methodology and Applications with R[END_REF]. Road accident data extracted from the French open platform data.gouv are georeferenced points, hence, a spatial point pattern. In order to designate cagb as a point pattern in R, it needs to be converted into an object of type ppp. This class of the package spatstat represents a two-dimensional point pattern dataset. It specifies the locations of the points and the window (study area) in which the pattern was observed.

The first step then is to create an object of class owin which defines the observation window, that is, the study area of our spatial point pattern. The type of owin used here is "polygonal": a region whose boundary is a polygon or several polygons. The polygons of the Doubs department cities are loaded from the website france-geojson.gregoiredavid.fr in .geojson extension files. This website brings to the France Geojson project which contains the routes of the French geographical and administrative entities (regions, departments, cantons, districts and municipalities), data contain the postal code and the name of the entity. The object cities created below is a SpatialPolygonsDataFrame object, a class from the package sp for holding polygon geometries with attributes.

> u <-" https :// france -geojson . gregoiredavid . fr / repo / departements / 2 5 -doubs / communes -2 5 -doubs . geojson " > downloader :: download ( url = u , destfile = " communes . GeoJSON " ) > cities <-readOGR ( dsn = " communes . GeoJSON " ) > cities@proj 4 string > cities <-spTransform ( cities , CRSobj = CRS ( " + init = epsg : 2 1 5 4 " ) )

CRS arguments : + proj = longlat + datum = WGS 8 4 + no _ defs

The CRS of cities is W GS84, obtained with its attribute proj4string. As mentioned before, it is more beneficial to work in Lambert 93. Hence the function spTransform from the package sp is used in order to transform to the new CRS. The cities polygons are plotted in Fig 2 .2 using command-lines from package ggplot2 below. For more convenience in using this package, the function SpatialPolygonsDataFrame to df from the package FRK is used in order to convert the SpatialPolygonsDataFrame cities to a dataframe. Indeed, this function creates columns X1, X2 and id which allow to plot polygons and values associated (as name in our case) in a simply way. The reader may find various plotting methods later. The object proj plot is used in order to specify to ggplot2 that the CRS wished for plotting is Lambert 93. It will be used for the rest of the chapter.

> proj _ plot <-'+ proj = lcc + lat _ 1 = 4 9 + lat _ 2 = 4 4 + lat _ 0 = 4 6 . 5 + lon _ 0 = 3 + x _ 0 = 7 0 0 0 0 0 + y _ 0 = 6 6 0 0 0 0 0 + ellps = GRS 8 0 + towgs 8 4 = 0 ,0 ,0 ,0 ,0 ,0 ,0 + units = m + no _ defs ' > cities _ df <-S p a t i a l P o l y g o n s D a t a F r a m e _ to _ df ( cities ) > ggplot ( cities _ df , aes ( x = X 1 , y = X 2 , group = id ) ) + + geom _ polygon ( colour = ' black ' , + fill = ifelse ( cities _ df $ name == " Besan ç on " , + " # 1 A 8 BAF " , " white " ) ) + + coord _ sf ( xlim = c ( 8 9 0 0 0 0 , 9 7 0 0 0 0 ) , + ylim = c ( 6 6 6 0 0 0 0 , 6 7 0 5 0 0 0 ) , + crs = st _ crs ( 2 1 5 4 ) , datum = proj _ plot ) + + theme _ bw () + + theme ( panel . grid . major = element _ line ( colour = + " black " , linetype = " dashed " , size = 0 . 1 ) , + panel . grid . minor = element _ line ( colour = + " black " , linetype = " dashed " , size = 0 . 1 ) ) + + xlab ( " Longitude " ) + + ylab ( " Latitude " )

Our observation window owin cagb is plotted in Fig 2 .3 as follows:

> cities <-gUnionCascaded ( cities ) > owin _ cagb <-as . owin ( cities ) > owin _ cagb _ sf <-st _ as _ sf ( owin _ cagb ) > owin _ cagb _ sf <-st _ transform ( owin _ cagb _ sf , crs = 2 1 5 4 ) > ggplot ( owin _ cagb _ sf ) + + geom _ sf ( color = ' black ' , fill = ' white ') + +
coord _ sf ( xlim = c ( 8 9 0 0 0 0 , 9 7 0 0 0 0 ) , + ylim = c ( 6 6 6 0 0 0 0 , 6 7 0 5 0 0 0 ) , + crs = st _ crs ( 2 1 5 4 ) , datum = proj _ plot ) + + theme _ bw () + + theme ( panel . grid . major = element _ line ( colour = + " black " , linetype = " dashed " , size = 0 . 1 ) , + panel . grid . minor = element _ line ( colour = + " black " , linetype = " dashed " , size = 0 . 1 ) ) + + xlab ( " Longitude " ) + + ylab ( " Latitude " ) The cities polygons have been merged into one polygon using the function gUnionCascaded from the package rgeos and set as an object owin with package maptools. For more convenience using package ggplot2, an object owin cagb sf of class sf is created with st as sf from the package sf. This package is a support for simple features, a standardized way to encode spatial data made of geometries (points, lines, polygons, ...).

The CRS is ensure with the sf function st transform by specifying EPSG:2154, just as similar as spTransform seen before.

As our owin object has been made, then an object of class ppp can be created with command-lines below. First, an object cagb sf is created with st as sf. The coords argument takes the names of the numeric columns holding spatial coordinates and the CRS W GS84 is specified with the crs argument as it was the initial projection established when loading data from data.gouv. Finally, the CRS of cagb sf is converted to Lambert 93 with st transform as seen before.

> cagb _ sf <-st _ as _ sf ( cagb , coords = c ( " x " , " y " ) , crs = 4 3 2 6 ) > cagb _ sf <-st _ transform ( cagb _ sf , crs = 2 1 5 4 )

A ppp object called cagb ppp is then created by using cagb sf and owin cagb with the function as.ppp from the package spatstat as follows: 5 1 3 8 4 8 1 4 9 [ 1 ] 1 5 0 9 0 1 The points must lie inside the specified window but it might happen that some points lie outside, this may be due to input error. Hence these points called "rejects" can be excluded by directly reusing the function as.ppp. The point pattern cagb ppp has 396 events in the study window which has an area of 513 848 149 square meters and a perimeter of 150 901 meters. The point pattern cagb ppp can be visualized as follows and gives Fig 2.4: > plot ( cagb _ ppp , pch = 2 0 , cex = 0 . 2 5 , + xlim = c ( 8 9 0 0 0 0 , 9 7 0 0 0 0 ) , + ylim = c ( 6 6 6 0 0 0 0 , 6 7 0 5 0 0 0 ) , + xlab = " Longitude " , ylab = " Latitude " , + ann = TRUE , axes = TRUE , main = " " )

> cagb _ ppp <-as . ppp ( st _ coordinates ( cagb _ sf ) , owin _ cagb ) > cagb _ ppp <-as . ppp ( cagb _ ppp ) > area ( owin _ cagb ) > perimeter ( owin _ cagb ) [ 1 ]
The point pattern can be also visualized with ggplot2 by using the sf objects cagb sf and owin cagb sf as follows:

> ggplot () + + geom _ sf ( owin _ cagb _ sf , color = ' black ' , fill = ' white ') + + geom _ sf ( cagb _ sf , color = ' black ' , size = 0 . 5 ) + +
coord _ sf ( xlim = c ( 8 9 0 0 0 0 , 9 7 0 0 0 0 ) , + ylim = c ( 6 6 6 0 0 0 0 , 6 7 0 5 0 0 0 ) , + crs = st _ crs ( 2 1 5 4 ) , datum = proj _ plot ) + + theme _ bw () + + theme ( panel . grid . major = element _ line ( colour = + " black " , linetype = " dashed " , size = 0 . 1 ) , + panel . grid . minor = element _ line ( colour = + " black " , linetype = " dashed " , size = 0 . 1 ) ) + + xlab ( " Longitude " ) + + ylab ( " Latitude " ) Finally, the ppp object cagb ppp can be exported using the function saveRDS.

> saveRDS ( cagb _ ppp , " DATA / cagb _ ppp . rds " )

Handling auxiliary information and covariates

The current section focuses on the creating of a database of the environment characteristics of road crashes locations, such as sociodemographic data, global and road infrastructure data, so that the impact of these environment resources on road accidents can be assessed. The information will be used in the next chapter in order to fit spatial statistical models such as log-Gaussian Cox processes (LGCPs). In practice, fitting a LGCP requires to perform computations on a regular grid. To be as rigorous as possible, covariate data collected will be directly associate with this grid.

Computational support grid

The computational grid is created by using the getpolyol function from the lgcp package as follows:

> polyolay <-getpolyol ( data = cagb _ ppp , cellwidth = 6 5 0 , ext = 2 ) > grid _ cagb <-polyolay $ fftpoly > area ( grid _ cagb ) [ 1 ] 1 7 3 0 5 6 0 0 0 0 The arguments cellwidth and ext are chosen through preliminary statistical methods relating to the model itself, we will therefore not give any further details here. As the CRS of cagb ppp is Lambert 93, the grid used then the same CRS. Finally, the grid can be extracted from the attribute fftpoly. The object grid cagb is of class SpatialPolygons from package sp, similar to SpatialPolygonsDataFrame seen before.

This regular grid 64 × 64 covers an area of 1 730 560 000 square meters, this means, the 4 096 cells are of 650m ×650m. This grid can be visualized as follows:

> grid _ cagb _ sf <-st _ as _ sf ( grid _ cagb )
> grid _ cagb _ sf % >% + dplyr :: select ( geometry ) % >% + ggplot () + + geom _ sf ( color = ' black ' , fill = ' white ') + + coord _ sf ( xlim = c ( 8 8 0 0 0 0 , 9 7 5 0 0 0 ) , + ylim = c ( 6 6 6 0 0 0 0 , 6 7 1 0 0 0 0 ) , + crs = st _ crs ( 2 1 5 4 ) , datum = proj _ plot ) + + theme _ bw () + + theme ( panel . grid . major = element _ line ( colour = + " black " , linetype = " dashed " , size = 0 . 1 ) , + panel . grid . minor = element _ line ( colour = + " black " , linetype = " dashed " , size = 0 . 1 ) ) + + xlab ( " Longitude " ) + + ylab ( " Latitude " )

As seen before, for more convenience using ggplot2, an sf object grid cagb sf has been created. Command-lines above gives Fig 2.7.

Finally the object polyolay, which contains the grid, is exported using the function saveRDS as seen before as follows:

> saveRDS ( polyolay , " DATA / polyolay . rds " )

Areal interpolation

Environment resource data were extracted from various sources such as the French statistical institute INSEE (Institut National de la Statistique et des Etudes Economiques), Open-StreetMap (data by c OpenStreetMap contributors under the Open Database Licence) or the French open platform data.gouv seen before. Sociodemographic and global infrastructure data (such as school locations, shop locations or gas station locations for example) have been extracted from the website of INSEE www.insee.fr. Road infrastructure data (such as traffic light locations, give way or stop locations for example) have been extracted from www.openstreetmap.fr. Finally, the network structure of roads has been extracted from www.data.gouv.fr. Data collected were reported between 2015 and 2020, this information has been considered unchanged over the years in order to associate them to road crashes that occurred between 2017 and 2019.

The data formats are incompatible as they have been collected at different geographical scales or units. For instance, sociodemographic data are provided as polygons, road network as lines and infrastructure locations as points. However, these heterogeneous data need to be simultaneously used. Hence it is necessary to merge them into one spatial support : this problem is called the areal interpolation problem. The process of interpolation consists in transforming data from source zones to target zones (which in our case are the cells of grid cagb). Let t 1 , . . . , t T and s 1 , . . . , s S be the sets of target zones and source zones respectively. We denote by Z t i the value of the target variable Z (variable of interest needed to be interpolated) on the target zone t i and respectively by Z s j on the source zone s j , i = 1, . . . , T and j = 1, . . . , S. Then, for the intersection zone I t i ,s j between t i and s j , the value of Z is noted as Z t i ,s j . The variables to be interpolated that will be considered in the following are extensive variables [START_REF] Do | Guidelines on areal interpolation methods[END_REF]. Only one interpolation method will be used and presented briefly below, for more details on interpolation methods see for example [START_REF] Do | Guidelines on areal interpolation methods[END_REF].

Sociodemographic data

French sociodemographic file extracted from INSEE is a .shp file, that is, a shapefile. Shapefiles are file formats for systems containing all the information linked to object geometries (points, lines or polygons). Data are loaded below using the function st read, from the package sf, which helps to read simple features from .shp files. It is a heavy file to download and to load (around 3 minutes and 42 seconds for 1.04Go).

> T 1 <-Sys . time () > france <-st _ read ( " DATA / Filosofi 2 0 1 5 _ carreaux _ 2 0 0 m _ metropole . shp " , + quiet = TRUE ) > france <-st _ transform ( france , crs = 2 1 5 4 ) > T 2 <-Sys . time () > difftime ( T 2 , T 1 ) Time difference of 3 . 6 9 2 7 9 5 mins

The data are structured (command-lines not shown) into an object grid insee sf that extracts only geometries falling in the CAGB and wished covariates that give per geometry:

• Ind : the number of individuals 8 represents the source zones (and centroids associated) in red that overlay a subset of target zones (computational grid cells numbered 1358 to 1360 and 1294 to 1296) in black. Indeed, the overlap of grid insee sf on grid cagb sf has been computed using the function st filter, from the package sf, which joins according to geometries. Classical functions of this package require that both sf objects have exactly the same CRS, which can be done with st crs. Then the centroids of grid insee sf overlapping cells are obtained with st centroid from sf package.

INSEE data cells (source zones) need to be transferred into the form of the computational grid grid cagb sf cells (target zones). As mentioned before, sources are much smaller than targets, which theoretically make the interpolation better. Indeed, sources are more likely to be included in targets. The method that will be introduced below is the point-in-polygon (PIP) method [START_REF] Do | Guidelines on areal interpolation methods[END_REF]. As its name implies, sources are points and targets are polygons. As INSEE data cells are polygons, it has to be represented by points, hence the use of centroid as described before. Finally, the value to be interpolated on a target zone is the aggregation of all source points located in it, that is, the sum of the values of all these source points. The PIP method is realized as follows:

> grid _ insee _ point <-st _ centroid ( grid _ insee _ sf ) > inters <-st _ intersects ( grid _ cagb _ sf , grid _ insee _ point , sparse = F ) > inters _ yes <-apply ( inters , 1 , function ( x ) any ( x != F ) ) > targets <-c ( " Ind " , " Ind _ 1 8 _ 2 4 " , " Ind _ 6 5 _ 7 9 " , " Ind _ 8 0 p " ) > for ( z in targets

) { + grid _ cagb _ sf [ , z ] <-rep ( 0 , nrow ( grid _ cagb _ sf ) ) + for ( i in which ( inters _ yes ) ) { + grid _ cagb _ sf [i , z ] <-sum ( st _ drop _ geometry ( grid _ insee _ point ) [ inters [i ,] , z ]) + } + }
There are four target variables to be interpolated : Ind, Ind 18 24, Ind 65 79 and Ind 80p. Two sets t i , i = 1, . . . , 4 096 and s j , j = 1, . . . , 3 386 of target zones and source zones respectively. First, all centroid sources are computed. The function st intersects is used in order to identify if both arguments geometries share any space and intersection zones I t i ,d j are obtained and stocked in inters yes. Then for each target variables, the aggregation of all source points located in it is computed using the function sum. Remark that, as said before, sf objects encode geometries of spatial data. Datasets of this class always contain geometries in a column called geometry. This column does not have to be mentioned properly in R operations in order to be considered, it is a sort of "attached" column. The function st drop geometry consists, as its name implies, to drop out geometries from the sf dataset. Otherwise without using this function, the function sum applied above would have summed up geometries too, even if there is only one target variable selected in the command-line.

> sum ( grid _ insee _ sf $ Ind ) > sum ( grid _ cagb _ sf $ Ind ) [ 1 ] 1 7 8 2 3 2 [ 1 ] 1 7 8 2 3 2
In our case, the PIP method is sufficient. Indeed for instance, the total number of individuals on the whole grid grid insee sf is 178 232, same as grid cagb sf, which means that there is no information lost. Note that INSEE data cells relate to information collected in 2015, and according to an INSEE report published in 2018 concerning the population census in 2015, there are 197 754 inhabitants in the CAGB (INSEE, 2018). The difference between 197 754 and 178 232 is due to confidentiality problems. In conclusion, our sociodemographic data interpolated on grid cagb sf is quite close to the reality. Two variables have been created from available variables : prop18 and prop65 which give respectively the proportion of individuals between 18 and 24 years old and the proportion of individuals more than 65 years old.

Global and road infrastructures

Global infrastructure data have been extracted from INSEE and transformed into the following seven variables :

• health: locations of healthcare institutions (such as hospitals, doctor offices or drugstores for example)

• school : locations of schools (until the end of highschool)

• college: locations of schools (after highschool)

• shop: locations of shops (such as food shops, shops or restaurants for example)

• station: locations of stations (such as train stations or taxi services for example)

• gasoline: locations of gas stations

• leisure: locations of establishments for leisure (such as cinemas or tennis courts for example)

File extracted is a .csv extension file. Data were loaded, structured, split in order to keep only resources that fall in the CAGB and transformed into a sf object where geometries are points.

Road infrastructure data have been extracted from OpenStreetMap and transformed into the variables intersection and radars which give respectively the locations of intersections (traffic lights, stop and give way) and the locations of speed cameras. Files extracted are .gpkg which is a file format for geospatial data. Data loaded as .gpkg files are of class sf with points as geometries.

All these variables have to be interpolated on grid cagb sf. As sources are points, the method to be applied is the PIP method described before. Another way to implement this method consists in using functions of package sp as follows:

> radars _ sf <-st _ read ( " DATA / radardevitesse . gpkg " ) > radars _ sf <-radars _ sf % >% dplyr :: select ( geom ) > radars _ sf <-st _ transform ( radars _ sf , crs = 2 1 5 4 ) > radars _ sf <-st _ intersection ( owin _ cagb _ sf , radars _ sf ) > radars _ sf $ radars <-rep ( 0 , nrow ( radars _ sf ) )

> radars _ sp <-as ( radars _ sf , ' Spatial ') > radars _ sp <-spTransform ( radars _ sp , CRS ( " + init = epsg : 2 1 5 4 " ) ) > radars _ sp <-aggregate ( x = radars _ sp [ " radars " ] , + by = grid _ cagb ,

+ FUN = length ) > radars _ sf <-st _ as _ sf ( radars _ sp ) > radars _ sf [ is . na ( radars _ sf $ radars ) ,]$ radars <-0 > grid _ cagb _ sf <-st _ join ( grid _ cagb _ sf , radars _ sf , + join = st _ nearest _ feature )
First, the function st intersection is used in order to keep only speed cameras locations located in the observation window. Then, a SpatialPolygonsDataFrame radars sp is created using the function as(, 'Spatial'). The spatial aggregation is performed by applying the function aggregate from package sp to the spatial object radars sp. The argument by = grid cagb specifies that the aggregation has to be done according to it and FUN = length specifies that the aggregation consists in the sum of the values. Then, the object radars sp is converted once more into a sf object in order to be merged with grid cagb sf. To do so, the function st join is used with argument join = st nearest feature which, as its name implies, join according to nearest geometries. As radars sf and grid cagb sf have the same geometries, this command-line acts as a classical merge operation.

All target variables mentioned above have been interpolated to grid cagb sf similarly as the variable radars.

Road network

The structure of road network has been extracted from the French open platform data.gouv as a .shp file and loaded as a sf object with line type geometries.

> road _ sf <-st _ read ( " DATA / l _ voiries _ cagb _ lg _ r 2 7 . shp " ) > road _ sf <-st _ transform ( road , crs = 2 1 5 4 )

The objective here is to be able to calculate the length of municipal roads and the length of national roads (departmental, national and highways) per cells of the grid grid cagb sf.

To do so, one has to simply compute the length of the roads in the intersection zones, just as follows:

> road _ sf <-road _ sf [ , c ( " statut " ) ] % >% + filter ( statut % in % c ( " COMMUNALE " , + " COMMUNAUTAIRE " , + " VOIE PRIVEE " ) ) > road _ sf <-st _ transform ( road _ sf , crs = st _ crs ( grid _ cagb _ sf ) ) > inters <-st _ intersection ( grid _ cagb _ sf , road _ sf ) > inters $ len <-st _ length ( inters ) > grid _ cagb _ sf $ Id <-1 : nrow ( grid _ cagb _ sf ) > join <-st _ join ( grid _ cagb _ sf , inters ) > interpol <-group _ by ( join , Id ) % >% + summarize ( length = sum ( len ) ) > interpol $ length <-as . numeric ( interpol $ length ) > interpol [ is . na ( interpol $ length ) ,]$ length <-0 > interpol <-st _ drop _ geometry ( interpol ) > grid _ cagb _ sf <-merge ( data _ sf , out , by = " Id " ) > grid _ cagb _ sf <-grid _ cagb _ sf % >% + select ( -Id ) > grid _ cagb _ sf <-grid _ cagb _ sf % >% + rename ( municipal _ length = length )
The variable statut of road sf gives the type of the road : COMMUNALE, COMMUNAUTAIRE and VOIE PRIVEE corresponds to municipal roads ; ETAT and DEPARTEMENT corresponds to national roads. The length of each road segments is computed with st length from sf package. Then, the total road length is obtained by summing up according to cells, thanks to the variable Id created above. This variable helps later in the merge operation, in order to associate the length of the roads to grid cagb sf. This is another way to merge two sf objects, instead of st nearest feature seen before. Command-lines above created the variable municipal length for municipal roads, the same method can be applied for the length of national roads.

Final support of covariate values

All interpolation methods made before bring to a spatial object grid cagb sf which has, per cell, values of 13 variables which are prop18, prop65, health, school, college, shop, station, gasoline, leisure, intersection, radars, municipal length and national length. One last step is to make the intersection between grid cagb sf and owin cagb sf in order to keep only cells that fall in the CAGB : 5 1 3 8 4 8 1 4 9 The grid grid cagb sf covers now an area of 513 848 149 square meters and is composed of 1 362 cells. scale _ fill _ gradient ( low = " # F 5 FAFD " , high = " # AA 2 A 1 0 " , + breaks = c ( 0 ,5 0 ) , limits = c ( 0 ,5 0 ) ) + + coord _ sf ( xlim = c ( 9 0 5 0 0 0 , 9 5 0 0 0 0 ) , + ylim = ( 6 6 6 5 0 0 0 , 6 7 0 5 0 0 0 ) , + crs = st _ crs ( 2 1 5 4 ) , datum = proj _ plot ) + + theme _ bw () + + theme ( panel . grid . major = element _ line ( colour = " black " , + linetype = " dashed " , + size = 0 . 1 ) , + panel . grid . minor = element _ line ( colour = " black " , + linetype = " dashed " , + size = 0 . 1 ) ) + + xlab ( " Longitude " ) + + ylab ( " Latitude " ) + + labs ( fill = paste ( " Shops located " , " \ n " , " per cells " ) )

> st _ crs ( owin _ cagb _ sf ) <-st _ crs ( grid _ cagb _ sf ) > grid _ cagb _ sf <-st _ intersection ( grid _ cagb _ sf , owin _ cagb _ sf ) > area ( grid _ cagb _ sf ) [ 1 ]
Values of shop variable with a small range from 0 to 50 have been plotted, instead of real values that goes to 353, it is only for the sake of clarity. Hence, grey cells are cells where values are more than 50. The reader may find the plots of every remaining variables in Appendix A.

Finally, the covariate data are exported with the function st write from package sf as follows:

> st _ write ( obj = grid _ cagb _ sf , " DATA / grid _ cagb _ sf . shp " , delete _ layer = TRUE ) In order to prevent and/or forecast road accidents, the statistical modelling of spatial dependence and potential risk factors is a major asset. The focus in the following is on the georeferenced location of accidents. We crossed these events with covariates characterizing the study geographical area such as sociodemographic and infrastructure measures. After a variable selection (poisson model, poisson models aggregation and random forest), the occurrence of accidents was modelled by using a spatial log-Gaussian Cox process. The results of this analysis enable us to identify principal risk factors of road accidents and critical areas. The data used are road accidents that occurred between 2017 and 2019 in the CAGB (urban community of Besançon).

Introduction

Chapter 1 focused on giving a multivariate statistical analysis of road crash data from the French region of Franche-Comté with special attention to road crash gravity. This analysis has a behavioural preventive character. In order to fulfill the main goal of spatial analysis of road crashes, the subsequent analyses should be focused on the spatial preventive character. Chapter 2 focused on the spatial point pattern of road accidents of the CAGB (Communauté d'Agglomération du Grand Besançon) to be fitted and associated covariates. More particularly, it detailed the spatial tools used on the software R. The main goal now, with the available covariates, is to set boundaries for CAGB zones to be avoided and identify the accident risk factors. Our road crash data are considered as a point pattern and assumed to be a realization of an underlying stochastic process called point process. The crucial element when studying point processes is the expected number of events per unit area, known as the intensity of the point process. The context of road accidents directly implies the consideration of the intensity of the process as a random process. The point process proposed to model our road crash data in this chapter is the log-Gaussian Cox process [START_REF] Moller | Log gaussian cox processes[END_REF] (LGCP) for which the log-intensity is a Gaussian process.

The current chapter focuses on the fitting of LGCP and similarly as Chapter 2, the objective is to delve deeper into the understanding and practical implementation of the spatial LGCP using R.

The following librairies will be used :

> library ( fields ) > library ( ggplot 2 ) > library ( leaflet ) > library ( lgcp ) > library ( maptools ) > library ( miscFuncs ) > library ( raster ) > library ( sf ) > library ( sp ) > library ( spatstat ) > library ( tidyverse ) R packages fields [START_REF] Nychka | fields: Tools for Spatial Data[END_REF], leaflet [START_REF] Cheng | leaflet: Create Interactive Web Maps with the JavaScript[END_REF], maptools [START_REF] Bivand | maptools: Tools for Handling Spatial Objects[END_REF], raster [START_REF] Hijmans | raster: Geographic Data Analysis and Modeling[END_REF], sf (Pebesma et al., 2022), sp [START_REF] Pebesma | sp: Classes and Methods for Spatial Data[END_REF] and spatstat [START_REF] Baddeley | spatstat: Spatial Point Pattern Analysis, Model-Fitting[END_REF] are tools for spatial data. The packages lgcp [START_REF] Taylor | Inla or mcmc ? a tutorial and comparative evaluation for spatial prediction in log-gaussian cox processes[END_REF] and miscFuncs [START_REF] Taylor | miscFuncs: Miscellaneous Useful Functions Including LaTeX Tables, Kalman Filtering and Development Tools[END_REF] are packages used to fit the statistical model LGCP. Finally ggplot2 [START_REF] Wickham | ggplot2: Create Elegant Data Visualisations Using the Grammar of Graphics[END_REF] and tidyverse [START_REF] Wickham | tidyverse: Easily Install and Load the 'Tidyverse[END_REF] are used for plot and for data wrangling basic operations.

The current chapter is structured as follows. Section 3.2 introduces the notion of point processes and gives the main properties of homogeneous and inhomogeneous Poisson point processes. It also gives two possible nonparametric estimation methods of the intensity of a point process. Section 3.3 first gives the statistical definition of LGCPs and presents various possible inference methods for the intensity process: minimum contrast method, maximum likelihood and Bayesian inference. As the Bayesian inference is the common choice in practice and is adopted in this chapter, related methods such as computation aspects and predictions are detailed. Finally, this section gives also performance assessment tools and risk measures. We suggest in Section 3.4 a new variable selection method based on an aggregation of Poisson regressions and the permutation variable importance criterion. Finally, Section 3.5 corresponds to the fits of the LGCPs using the covariates thus selected previously. The best LGCP model is used to create maps indicating the riskiest areas of the CAGB and to identify the risk factors. A special attention is accorded to the implementation on the software R of the theoretical tools defined in the last sections. A short conclusion is given in Section 3.6 and supplementary materials (such as Bayesian computation tools implementations) are given in Section 3.7.

Point process basics

Section 2.2 in Chapter 2 introduced the notion of spatial point pattern. This refers to observed spatial locations of events in some set W ⊂ R 2 [START_REF] Baddeley | Spatial Point Patterns: Methodology and Applications with R[END_REF][START_REF] Cressie | Statistics for Spatio-Temporal Data[END_REF]. More particularly, consider a point pattern is a set of points X = {x 1 , . . . , x n } where x i ∈ W ⊂ R 2 has a known location for all i = 1, . . . , n. The number n of the points in the pattern is not fixed in advance and may be any nonnegative number including zero. For a bounded region B ⊂ W , X ∩ B denotes the subset of X consisting of points falling in the region B and n(X ∩ B) denotes the number of points of X that fall in B. The analysis of a spatial point pattern lies on many characteristics. Indeed, we can ask ourself: Are the points uniformly located over a region or instead clustered ? Does the density of points depend on an explanatory variable ? and so on... Hence, the analysis does not lie on the points themselves but about the way the points were generated (Baddeley et al., 2015, Chapter 5). Indeed, a spatial point pattern X is seen as a realization of an underlying process X denoted as point process.

Point processes are widely used in several fields. For instance epicentres of earthquakes, gorilla nesting sites, positions of trees in a forest or locations of cases of cancer are point patterns that can be modelled by point process models. Many other examples have been developed in the literature: [START_REF] Mohler | Marked point process hotspot maps for homicide and gun crime prediction in chicago[END_REF] used data consisting of violent crimes occurring in Chicago in order to predict homicide; [START_REF] Olsbo | Development and evaluation of spatial point process models for epidermal nerve fibers[END_REF] wanted to more precisely describe the spatial structure of epidermal nerve fibers (the outmost part of the skin); [START_REF] Murotani | Distribution analysis and modeling of air voids in concrete as spatial point processes[END_REF] analysed air voids which can be present in the concrete and may affects its properties; then in the aim of estimating biodiversity of forests, [START_REF] Tovo | The distance decay of similarity in tropical rainforests. a spatial point processes analytical formulation[END_REF] focused on the tendency of plants to form clusters of individuals for the Barro Colorado Island and Pasoh rainforests. Several different points of view, statistically speaking, were considered in these articles.

Let X be a point process, namely a stochastic mechanism whose outcomes is a point pattern X = {x 1 , . . . , x n } of any size n, where n is a nonnegative integer. As remarked by [START_REF] Cressie | Statistics for Spatio-Temporal Data[END_REF], one fundamental property of a spatial point process is the expected number of events in a given region B, namely E(n(X ∩ B)). This can be evaluated by means of the intensity function λ(u) that is a measure of the potential for an event to appear at any location u ∈ B ⊂ W. Let denote by B u a small region located at u of volume |B u |. Mathematically speaking, the intensity function λ(•) is defined by:

λ(u) = lim |Bu|→0 E(n(X ∩ B u )) |B u | , u ∈ W (3.1)
provided that this limit exists. Then,

E(n(X ∩ B)) = B λ(u)du, B ⊂ W.
One of the main goals in statistical modelling and analysis of spatial point pattern is the study of the intensity function λ(•) as it is a powerful tool to characterize the spatial behaviour of a point process. We start by considering first the simplest way to model a spatial point pattern, the homogenous Poisson process, for which the intensity function is constant everywhere and proceed next with the inhomogeneous Poisson of varying intensity function.

More generally, the Cox process are modifications of the inhomogeneous Poisson process to incorporate random influences in the intensity function, namely the intensity function may depend now on unobservable external factors as well as observable covariates. Finally, we will consider the log-Gaussian Cox process (LGCP) which is a Cox process with log-intensity modelled by a Gaussian process. Our final goal is to model the spatial point pattern of CAGB road accident data by LGCP with log-intensity depending also on observable covariates reflecting socio-demographic as well as road characteristics of the CAGB region.

Homogeneous Poisson process

An idealized standard process is the homogeneous Poisson point process, also called complete spatial randomness (CSR), characterized by two properties:

HPP1 homogeneity : E[n(X ∩ B)] = λ|B|, λ > 0,
which means that the expected number of events falling in a region B ⊂ W is proportional to its area;

HPP2 independence : n(X ∩ B 1 ), n(X ∩ B 2 ), . . . , n(X ∩ B m ) are m independent random variables, whenever B 1 , B 2 , . . . , B m are disjoint regions of W .

Property HPP1 is equivalent to the fact that the intensity function λ(•) defined in Eq (3.1) is constant and equal to λ > 0. The parameter λ represents the average number of random points per unit area, which in our case of road crashes can be seen as an occurrence rate, and is known as the intensity of the point process. The two properties HPP1 and HPP2 together imply that the number n(X∩B) of points falling in a region B has a Poisson distribution with mean λ|B|, λ > 0. Furthermore, the homogeneous Poisson point process is stationary and isotropic which respectively mean that the distribution of X is invariant under translation and rotation. Homogeneous Poisson point processes are extensively presented in Diggle (2013, Chapter 4) or Baddeley et al. (2015, Chapter 5).

A way to simulate homogeneous Poisson point process realizations is as follows:

> plot ( rpoispp ( 3 0 , nsim = 3 ) , main = " " , pch = 2 0 , cex = 1 )

Inhomogeneous Poisson process

The Poisson process of completely random patterns presented in the previous section is mostly used as the standard reference in comparison with other patterns. Indeed, the intensity λ > 0 of this process is constant. However, the most important model for many practical purposes is the inhomogeneous Poisson point process. This class of models is a modification of homogeneous Poisson point processes in which the constant intensity is replaced now by a spatially varying intensity function λ(u) depending on the spatial location u, u ∈ W ⊂ R 2 . The inhomogeneous Poisson point process X with intensity function λ(•) is defined by the following two properties:

IPP1 intensity : for all bounded region B ⊂ W , E[n(X ∩ B)] = B λ(u)du, supposed to be finite; IPP2 independence: n(X ∩ B 1 ), n(X ∩ B 2 ), . . . , n(X ∩ B m ) are m independent random vari- ables, whenever B 1 , B 2 , . . . , B m are disjoint regions of W .
Property IPP1 implies that the point process X has intensity function λ(•), has defined in Eq (3.1). The two properties together imply the Poisson distribution: for all bounded region B ⊂ W , n(X ∩ B) has a Poisson distribution with mean B λ(u)du. For more details on inhomogeneous Poisson point process, see for example Diggle (2013, Chapter 6), Baddeley et al. (2015, Chapter 9) and the references therein. There is no restrictions on the function λ(u) to be used, as long as the function is non-negative and locally integrable. For example we can simulate an inhomogeneous Poisson process with intensity function λ 1 (u) = 200(x + y) 2 , u = (x, y) ∈ R 2 , as follows:

> lambda _ 1 <-function (x , y ) { 2 0 0 * ( x + y ) ^2 } > lambda _ 1 _ im <-as . im ( lambda , W = square ( 1 ) ) > plot ( lambda _ 1 _ im , main = " " ) > plot ( rpoispp ( lambda _ 1 , win = square ( 1 ) ) , main = " " , + pch = 2 0 , cex = 1 , add = TRUE )

Command-lines above give Fig 3 .2, that is, the plot of a realization of an inhomogeneous Poisson process overlaying the intensity function λ 1 . To do so, the first step is to create the intensity function. Then in order to obtain a realization of the point process with λ 1 as intensity function, the same function as in Section 3.2.1 rpoispp is used but this time with the function λ 1 , not a constant. In order to overlay the plots of the theoretical intensity and the simulated point pattern, the function is converted to a pixel image using the function as.im from the package spatstat. The object lambda 1 im of class im is plotted and the point pattern is simply associated to the later plot by specifying add = TRUE. Note that as before, the study window chosen is the unit square (square( 1)). The The intensity function of a point process is assumed to be the major part of the generation of the data and the most important is to know whether the intensity is homogeneous or not. Inhomogeneity of the intensity reflects the spatial distribution of points which may be more or less abundant in different regions of space. For most real life problems, it is more realistic to assume that the underlying point process is inhomogeneous, that means, driven by a non constant intensity function. In our case, > cagb _ ppp <-readRDS ( " DATA / cagb _ ppp . rds " ) > plot ( density ( cagb _ ppp ) , main = " " ) > plot ( cagb _ ppp , main = " " , pch = 2 0 , cex = 1 , add = TRUE ) The point pattern cagb ppp created in Section 2.2 is loaded with readRDS. A possible estimate of the intensity of our point process here is produced with the function density from spatstat which computes an intensity function from a point pattern in argument (more details will be explained later about this function in the next Section). As expected, the abundance of points in the middle of Fig 3 .3 is reflected in intensity values. Indeed, the warmer the colors of the intensity, the more points there are.

Estimation of the intensity function of a point process

The previous section shows how the investigation of the intensity of a point process is an important step in point pattern analysis. Indeed, the intensity function is the expected density of point per unit area and represents hence a reference descriptive characteristic for a point process. It is interpreted as the incidence rate of the events recorded in the point pattern. This rate of occurrence is the most important property of a point process to be analysed when the goal of analysis is the prevention of the events. The main task in order to fulfill our goal of geographical anticipation of road crashes of the CAGB is to map the spatial variation in intensity and investigate, if it is the case, whether the intensity depends on covariates. As said before, the intensity of the point process that generated our point pattern of road crashes will be considered as inhomogeneous. Some preliminary estimation investigations of the intensity will be presented briefly below.

If the intensity is suspected to be inhomogeneous, it can be estimated by nonparametric methods such as quadrat counting, mentioned in Section 2.2 of Chapter 2, or kernel estimation. More details and other existing estimation methods are given for example in Baddeley et al. (2015, Chapter 6) and Diggle (2013, Chapter 5).

Quadrat counting

Quadrat counting is a statistical technique to estimate the intensity function and that allows to check if regions of equal area, from the observation window, have almost the same number of points (as they would have if the point process were homogeneous). Indeed subregions (quadrats) B j , j = 1, . . . , m, of the observation window each have n j = n(X ∩B j ) number of points. All are estimates of E[n(X ∩ B j )] and are equal on average in the case where the intensity is homogeneous. A simple estimate of the intensity function, as average intensity in each quadrat, can be obtained by dividing each quadrat counts by the area of the associated quadrats. The quadrat method is very similar to the histogram method for density estimation.

The quadrat counts made in > q 3 _ counts <-quadratcount ( cagb _ ppp , nx = 3 , ny = 3 ) > q 9 _ counts <-quadratcount ( cagb _ ppp , nx = 9 , ny = 9 ) > par ( mfrow = c ( 1 , 2 ) ) > plot ( q 3 _ counts , main = " " ) > plot ( intensity ( q 3 _ counts , image = TRUE ) , main = " " ) > plot ( q 9 _ counts , main = " " ) > plot ( intensity ( q 9 _ counts , image = TRUE ) , main = " " ) One way to assess whether the intensity function is homogeneous or inhomogeneous is using the quadrat counting test of homogeneity. The null hypothesis of this test is that the intensity is homogeneous and the alternative one is that the process is not a homogeneous Poisson process. However, the power of the test depends on the size of quadrats and is only optimal when the quadrats are neither very large nor very small. This means that the decision of the test depends on the choice of quadrat size and it is then questionable. In order to show the weakness of this test, consider CAGB data and the estimation of the intensity function by quadrats of size 2 × 1 first and then, of size 9 × 9: The quadrat counting test of homogeneity is performed with quadrat.test from spatstat package. Numbers of quadrats in the x and y directions have to be specified in the command-line. A grid 2 × 1 of quadrats for our point pattern has been created, the associated test results in not rejecting the null hypothesis of a homogenous Poisson process for the CAGB road accidents data. This result is not expected since the point pattern clearly exhibits a strong spatial inhomogeneity with more point in the middle of the window. Here the result is unsatisfactory because the quadrat size considered for the test is too big. However, shifting number of quadrats as nx = 9 and ny = 9, for example, gives p-value < 2.2e-16 which means that the null hypothesis is rejected and hence, we conclude to an inhomogeneous intensity function. Hence, quadrat counting can be used for standing assumptions on the intensity but should not be adopted for a final diagnostic.

Kernel estimation

Another way to estimate the intensity function nonparametrically is the kernel estimation. We use here the exact terms of Baddeley et al. (2015, Section 6.5.1, Page 168) who illustrates this method metaphorically and allows to visualize it in an interesting way:

"Our favorite analogy is to imagine placing one square of chocolate on each data point. Using a hair dryer we apply heat to the chocolate so that it melts slightly. The result is an undulating surface of chocolate; the height of the surface represents the estimated intensity function of the point process. The total mass of chocolate is unchanged.

There are many kernel estimators but only the standard one will be briefly presented here. For any spatial location u in the observation window W ⊂ R 2 , the uncorrected kernel estimator of λ(u) is defined as

λ(u) = n i=1 κ σ (u -x i ) (3.2)
where u = (x, y) ∈ W and the kernel function κ σ (•) is the melted square of chocolate placed at data point location x i . The kernel κ σ may be a probability density function symmetric about the origin and the most used choice is the Gaussian distribution :

κ σ (u) = (2πσ 2 ) -1 exp{-||u|| 2 /2σ 2 }, u = (x, y) ∈ W .
The standard deviation σ > 0 of the Gaussian distribution is specified as the smoothing bandwidth of the kernel. This kernel estimator is named uncorrected as it does not take into account edge effects. Other kernel estimators with a correction are given in Baddeley et al. (2015, Chapter 6). For more details on the kernel method, the reader may refer to [START_REF] Silverman | Density Estimation for Statistics and Data Analysis[END_REF].

An estimation of the intensity function of cagb ppp with the uncorrected estimator can be obtained as follows:

> k _ density _ 5 0 <-density ( cagb _ ppp , sigma = 5 0 , edge = FALSE ) > plot ( k _ density _ 5 0 , clipwin = owin _ bes , + main = " " , xlim = c ( 9 2 5 0 0 0 ,9 3 2 9 4 4 ) , ylim = c ( 6 6 8 5 0 0 0 , 6 6 9 0 0 0 0 ) ) > contour ( k _ density _ 5 0 , clipwin = owin _ bes , + xlim = c ( 9 2 5 0 0 0 ,9 3 2 9 4 4 ) , ylim = c ( 6 6 8 5 0 0 0 , 6 6 9 0 0 0 0 ) , + add = TRUE , drawlabels = F ) > persp ( k _ density _ 5 0 , main = " " , zlab = " Intensity estimated " )

As seen in Section 3.2.2, the function density is used. This function actually computes kernel density estimates. The argument sigma specifies the smoothing bandwidth σ as mentioned above. The estimate can be plotted with plot. Then, contour lines can be added to the previous plot using contour. On the other hand, in order to visualize this estimate as a perspective view, the function persp is used. For the sake of clarity, a focus is made using a smaller owin object : owin bes by using the optional argument clipwin of the function contour. The object owin bes has been created in the same way as owin cagb seen in Section 2. As for quadrat counting, where the size of quadrats is chosen by the user, kernel estimation depends heavily on the smoothing bandwidth σ and less on the choice of kernel. However, several methods are available for selecting the bandwidth such as algorithms minimising some criterion for example. The likelihood cross-validation method [START_REF] Loader | Local Regression and Likelihood[END_REF] is computed with bw.ppl as follows:

> smoothing _ band <-bw . ppl ( cagb _ ppp ) > smoothing _ band > opt _ density <-density ( cagb _ ppp , sigma = smoothing _ band , edge = FALSE ) > plot ( opt _ density , main = " " ) > persp ( opt _ density , main = " " , zlab = " Intensity estimated " ) sigma 7 8 7 . intensity function of the point process that generated our CAGB road crashes point pattern computed for this value σ. All these plots, and those produced with the quadrat counting method, suggest that the intensity may be elevated in the middle of the observation window, which actually almost corresponds to the south of Besançon city.

Log-Gaussian Cox Processes (LGCP)

The previous section introduced the notion of point processes and in particular, the intensity function of a point process. In the case of the inhomogeneous Poisson point process, the intensity function is varying spatially. Section 3.2.3 introduced two nonparametric methods used in order to estimate this intensity function. Other nonparametric methods exist and, moreover, methods which this time inspect how the intensity of points depends on the values of a covariate. Now, in this section, the statistical modelling of the intensity function of the point process that generated our CAGB road crashes point pattern will be investigated. More particularly, a log-Gaussian Cox process (LGCP) will be proposed to model the road crashes point pattern, where the intensity depends on covariates and also on a spatial Gaussian field capturing the spatial random effect.

Related works

The LGCP can be used to model various situations but its practical implementation faces important computational challenges. A few methods have been proposed for running and fitting this statistical model. For example Bayisa et al. (2020) used LGCPs in order to improve the northern Sweden ambulance system in both space and time. It seems that most of the emergency calls are located in populated areas, but the main concerns are for inhabitants of large rural areas who may need fast access to prehospital care. The fitted model has three components: a spatial component which was estimated by a quartic kernel whose bandwidth has been selected using K-means clustering; a temporal component which was estimated by a Poisson regression model; and a (unobservable) spatio-temporal Gaus-sian process whose properties were estimated using minimum contrast estimation. Another field where LGCPs have proven useful is wildfire prevention. [START_REF] Opitz | Point-process based bayesian modeling of space-time structures of forest fire occurrences in mediterranean france[END_REF] used a spatio-temporal model with the aim of giving preventive measures and operational forecasts in the French Mediterranean basin. They faced a significant computational challenge due to the high dimension of the data. Indeed, a large amount of information from covariates such as for example vegetation type, weather or urbanization was used. Bayesian inference was made using the integrated nested Laplace approximation (INLA). Ramírez and Valencia (2021) trained LGCPs in the field of road crashes in order to understand and analyze the occurrence of accidents, from a spatial and temporal point of view, in Bogota the capital city of Colombia. They included several spatial and temporal covariates associated to accidents such as road characteristics, demographic conditions or even weather temporal factors. Bayesian estimation was made using Markov chain Monte Carlo (MCMC) method with the Metropolis-adjusted Langevin algorithm (MALA), a version of the commonly used Metropolis-Hastings algorithm. [START_REF] Diggle | Spatial and spatiotemporal log-gaussian cox processes: Extending the geostatistical paradigm[END_REF] worked on LGCP in order to illustrate and explain the use of the model. They developed different versions of the model with increasing complexity, each adapted to a specific example: an introductory spatial model whose events were hickory trees; a multivariate spatial model with four different types of events corresponding to four different genotypes of bovine tuberculosis; a spatial model with covariate information available for lung cancers observed on a geographical region of interest partitioned into a set of subregions; and finally a spatio-temporal model for gastro-intestinal disease. MCMC was also used for the Bayesian inference. Many other possible applications may be given, however few fast computational methods are available for the moment. We start by presenting briefly the statistical definition of a LGCP and the Bayesian approach used for parameter inference and continue next with the LGCP modelling of our road crash data and the associated computational algorithm.

LGCP statistical definition

As remarked in Section 3.2.2, the road crashes points seem to be clustered. This suggests to consider the intensity as inhomogeneous. More particularly, our data will be modelled by a Cox process. A Cox process is essentially a Poisson process for which the intensity function is random. It is a natural way to model a inhomogeneous point processes as it assumes that the unknown spatially varying intensity function Λ(u) is random.

Formally, a Cox process is defined by the following two assumptions [START_REF] Diggle | Spatial and spatiotemporal log-gaussian cox processes: Extending the geostatistical paradigm[END_REF]:

CP1 there exists a non-negative stochastic process Λ(•) = {Λ(u) : u ∈ W }, called driving intensity process;

CP2 Conditionally on the realization Λ(•) = λ(•), the point process X is an inhomogeneous Poisson process with intensity function λ(•).

More explicitly, conditionally on Λ(•) = λ(•), the count variable n(X ∩ B j ) is Poisson distributed with mean B λ(u)(du) for all bounded B ⊂ W and n(X ∩ B 1 ), . . . , n(X ∩ B m ) are (conditionally) independent whenever B 1 , . . . , B m are disjoint. We can see Λ and X as two different levels of randomness, so that the Cox process is often called a doubly stochastic point process.

The random variation in the intensity function can be seen as a spatial random effect and is often attributable to an unobserved covariate. The spatial variation in the intensity function can make the point pattern look clustered, that is, with more abundant points in some areas. For instance in our case of road crashes, the curvature of a road can be a potential external factor. Indeed, a road more curved in some location can cause more accidents instead of another location where the road is completely straight. The situation can also be seen in a different way as: a road more curved will make the drivers slow instead of a road completely straight where drivers would accelerate and lead to more accidents as the speed is a risk factor. The observation remains the same, the curvature of the road affects the driving and hence, the number of accidents.

There are many possible ways to build a Cox process, the most natural approach to circumvent the nonnegativity assumption of the intensity function is to deal with the logarithm of the driving intensity, hence the concept of the log-Gaussian Cox process. A LGCP is a Cox process whose log-intensity is modelled by a Gaussian process [START_REF] Moller | Log gaussian cox processes[END_REF], say

Y = {Y (u) : u ∈ R 2 } (i.e. the joint distribution of any finite vector (Y (u 1 ), . . . , Y (u n )) is Gaussian). More precisely, log(λ(u)) = Y (u), u ∈ W. (3.3)
The Gaussian random field Y is usually assumed to be the restriction on W of a stationary and isotropic Gaussian random field defined on R 2 (i.e. invariant under translations and rotations), so that it is completely specified by its mean µ = E[Y (u)], its variance σ 2 = Var[Y (u)] and its covariance function

C(h) := Cov(Y (u), Y (u + h)), u, h ∈ R 2 .
As the covariance function depends only on the distance between points and not on their directions, it can be modeled by

C(h) = σ 2 r(||h||/φ), h ∈ R 2 ,
where φ > 0 is a scale parameter and ||•|| is a suitable norm on R 2 (for instance the Euclidean norm), u ∈ R 2 . [START_REF] Moller | Log gaussian cox processes[END_REF] suggest several parametric forms for the function r that ensure that the covariance function C(•) is well-defined (i.e. semi-definite positive function). A common choice for r, that we will also adopt for the next of this chapter, is the exponential function which leads to the following covariance function:

C(h) = σ 2 exp - ||h|| φ , h ∈ R 2 .
The covariance function of the Gaussian process Y can be specified using function

CovFunction from package lgcp as follows:

> cf <-CovFunction ( ex ponentialCov Fct )
For the remaining of our work, we will also set µ = -σ 2 /2 which is a convenient reparameterisation since it enables to have E[Λ(u)] = E[exp(Y (u))] = 1 [START_REF] Diggle | Spatial and spatiotemporal log-gaussian cox processes: Extending the geostatistical paradigm[END_REF][START_REF] Taylor | Bayesian inference and data augmentation schemes for spatial, spatiotemporal and multivariate log-gaussian cox processes in r[END_REF], meaning that we have no prior information on the mean random spatial effect. Note that due to properties of the log-Gaussian distribution, the intensity function λ(•) and by consequence the process X are totally specified by the parameters σ and φ of the Gaussian process Y, so efficient estimation of these parameters is crucial. The parameters of the Gaussian process Y are often transformed onto log-scale, η = {log(σ), log(φ)}, as it is more appropriated for the computation algorithm that will be used further [START_REF] Taylor | Bayesian inference and data augmentation schemes for spatial, spatiotemporal and multivariate log-gaussian cox processes in r[END_REF].

In applications, one is often interested in the effect of spatial covariates. One way to introduce them in the model is to add a linear term in the log-intensity that depends on the covariates This results in the model

log(λ(u)) = Z(u) β + Y (u), u ∈ W,
where Z(u) is a vector of covariate values observed at the position u and β is a vector of unknown parameters accounting for the effect of the different covariates. The notation stands for the vector or matrice transpose. The parameters of the model now are η = {log(σ), log(φ)}, the parameters of the Gaussian process Y , and β, the vector of covariate effects. For parameter estimation, three approaches can be considered: minimum contrast estimation, maximum likelihood and Bayesian estimation [START_REF] Diggle | Spatial and spatiotemporal log-gaussian cox processes: Extending the geostatistical paradigm[END_REF] which we describe in Sections 3.3.2-3.3.4 below.

Finally, in practice, to fit the model in a tractable way, the common approach is to make computation on a very fine regular grid. The study region of space is divided into a C × C grid of equally spaced cells and the log-intensity is assumed to be constant over each grid cell. Hence, the log-intensity within a given cell, for example the ith cell, is constant and specified by its value at its centroid c i , i = 1, . . . , C 2 . The number of events, fitted with a LGCP, is then treated as cell counts on this grid :

n(X ∩ c i ) ∼ Poisson(λ(c i )) with log(λ(c i )) = Z(c i ) β + Y (c i ), (3.4)
where n(X ∩ c i ) denotes the number of events in the ith cell of the grid with centroid c i , for i = 1, . . . , C 2 . Usually, the grid is fine enough so that the cell-counts are very small (ideally 0 or 1) but it should allow a good compromise between accuracy of approximation and computational complexity. The computational grid is also useful for the Bayesian inference parameters as described in Section 3.3.4.

Minimum contrast method

We consider first the LGCP model with the intensity process modelled by Eq (3.

3). The parameters to be estimated are σ and φ. The minimum contrast method is one way to estimate these unknown parameters.

The minimum contrast method, also known as least-squares approach, consists in choosing the parameters σ and φ which minimize the squared discrepancy between the empirical and the theoretical second-order moments. Let C(•) be the covariance function of the Gaussian process Y as presented in Section 3.3.1. [START_REF] Moller | Log gaussian cox processes[END_REF] chose estimate values σ2 and φ of respectively σ 2 and φ that minimize the discrepancy between a nonparametric estimate of the covariance function Ĉ(•) and the theoretical one C(•) as follows

u 0 Ĉ(u) α -C(u) α 2 du
where 0 ≤ < u 0 and α > 0, u ∈ R 2 . [START_REF] Moller | Log gaussian cox processes[END_REF] gave possible example choices for the parameters , u 0 and α. Usually, is the minimum distance between two points in the point pattern and u 0 and α are user-specified constants chosen so that the above integral is well defined. However, it seems difficult to give appropriate values for these parameters. Hence, minimum contrast estimation is generally considered as useful for providing preliminary estimates of the parameters [START_REF] Diggle | Spatial and spatiotemporal log-gaussian cox processes: Extending the geostatistical paradigm[END_REF][START_REF] Taylor | Bayesian inference and data augmentation schemes for spatial, spatiotemporal and multivariate log-gaussian cox processes in r[END_REF]. The minimum contrast method can be computed as follows: 2 1 5 0 . 9 7 2

The function minimum.contrast from lgcp package takes as argument the point pattern cagb ppp. Then the assumed theoretical form of the spatial correlation function is specified in the argument model. Various definitions of the minimum contrast method are given in [START_REF] Brix | Spatiotemporal prediction for log-gaussian cox processes[END_REF], [START_REF] Diggle | Spatial and spatiotemporal log-gaussian cox processes: Extending the geostatistical paradigm[END_REF] and [START_REF] Taylor | Bayesian inference and data augmentation schemes for spatial, spatiotemporal and multivariate log-gaussian cox processes in r[END_REF]. In the package lgcp, the parametric functions that can be used are the pair correlation function (PCF) g and Ripley's K function [START_REF] Ripley | Modelling spatial patterns[END_REF]. The method of spatial minimum contrast here is defined with method = "g" and is associated with transform = log which simply plays for contrast criterion. Finally, an estimation of the intensity of cagb ppp is specified using the function density as seen in Section 3.2.3. The parameter estimates are then φ = 617.440 and σ2 = 1.851.

These values will be useful as preliminary estimates in the computation algorithm further. In particular, they might be helpful for the choice of the grid size. Indeed, the scale parameter φ of the covariance function C(•) of Y actually determines the spatial correlation in the process. Hence the approximate spatial scale of 617 meters tells that a grid of close dimension cells might be necessary to capture the dependence structure in the Gaussian process Y . The choice of such an appropriate grid size can be seen as follows:

> chooseCellwidth ( cagb _ ppp , cwinit = 6 5 0 )

The function chooseCellwidth from the package lgcp, as its name implies, helps in choosing the cell width in order to set up the computational grid. The desired cell width is specified in the argument cwinit. In our case, a cellwidth of 650 meters is chosen as it might be appropriate for an efficient computational grid size. The above command-lines produce the plot of the observation window of the ppp object given and computational grid associated. > polyolay <-readRDS ( " DATA / polyolay . rds " )

Remind that the grid have been created with a cell width of 650 meters.

Maximum Likelihood Estimation

Maximum likelihood is one of the most used method for estimating unknown parameters. However, as we will briefly describe below, in the case of Cox and LGCP models, this approach can not be used.

Consider first a general Cox point process X. For a realization of the intensity process, Λ(u) = λ(u), we have an inhomogeneous Poisson point process of intensity λ(•) governed by some parameter θ. In this case, the likelihood for θ (computed with respect to the reference homogeneous Poisson process of intensity λ = 1) is given by (Baddeley et al., 2015, Chapter 9)

(θ ; X) = λ(x 1 )λ(x 2 ) . . . λ(x n ) exp W (1 -λ(u))du , (3.5)
where X = {x 1 , . . . , x n } is the observed point pattern within the observation window W.

The first term of the likelihood given in Eq. 3.5 is the probability of observing data in points x 1 , . . . , x n and exp W (-λ(u))du is the probability of not observing any other points in the window W. The constant factor exp W du = exp(|W |) is due to rescaling with respect to the Poisson process of λ = 1 and it is usually omitted from the likelihood expression.

Then, we get that the probability density of the Cox process X is given by (Baddeley et al., 2015, Chapter 12)

L(θ ; X) = E n i=1 λ(x i ) exp - W λ(u)du .
The high dimensionality of the integration makes this likelihood analytically intractable [START_REF] Moller | Log gaussian cox processes[END_REF][START_REF] Diggle | Spatial and spatiotemporal log-gaussian cox processes: Extending the geostatistical paradigm[END_REF][START_REF] Baddeley | Spatial Point Patterns: Methodology and Applications with R[END_REF] even in the case of computation on a fine regular grid. The commonly used alternative is then the Bayesian inference.

Bayesian inference

Our goal is to use the data X = {x 1 , . . . , x n } in order to make inferences about the latent process Y and the parameters θ = (η, β) which parametrize the covariance function of Y and the covariate effects (see Eq (3.4)). In the Bayesian paradigm, Y as well as θ are considered as random variables and the statistical problem may be summarized by a hierarchical model as described in Cressie and Wikle (2011, Chapter 2): Here the process Y is unobserved and often referred to as a latent process and only the point pattern X is observed. In the LGCP case, the hierarchical model writes (Cressie and To make inferential statements, the Bayesian paradigm assigns a prior distribution π(θ) to the model parameters θ = (β, η) and focuses on the posterior distribution π(θ, Y |X), the conditional distribution of θ and Y given the observations X, given by Bayes' Theorem:

π(θ, Y |X) ∝ π(X|θ, Y )π(θ, Y ) ∝ π(X|θ, Y )π(Y |θ)π(θ).
The latent field is unobserved and plays, during the estimation procedure, almost the same role as an unknown parameter. For this reason, and for the convenience of notation, we will note Θ = (θ, Y ) the unobserved part of the model to be estimated (both parameters and latent process). We then have the following model:

Computational aspects

From a computational point of view, the Bayesian inference for LGCP presents two main difficulties: the choice of the prior distribution and the computation of the posterior distribution. As θ = (β, η), we can chose a prior of the product π(θ) = π(β)π(η). The package lgcp allows to choose a multivariate Gaussian prior for β and a multivariate Gaussian prior for η = (log σ, log φ):

β ∼ N (µ β , Σ β ) and η ∼ N (µ η , Σ η ).
Following [START_REF] Diggle | Spatial and spatiotemporal log-gaussian cox processes: Extending the geostatistical paradigm[END_REF] or [START_REF] Taylor | Bayesian inference and data augmentation schemes for spatial, spatiotemporal and multivariate log-gaussian cox processes in r[END_REF], we have chosen β ∼ N (0, 10 6 ), log σ ∼ N (log(1), 0.15) and log φ ∼ N (log(2000), 0.15).

The prior for β corresponds to a very flat prior that conveys almost no information (zero mean and very high variance). Note that µ φ = 2000 has been chosen by preliminary fits on our data, this results from the trace plot given in Fig B .6 in Appendix B. These priors are defined in lgcp as follows:

> priors <-lgcpPrior ( + etaprior = PriorSpec ( LogGaussianPrior ( mean = log ( c ( 1 , 2 0 0 0 ) ) , + variance = diag ( 0 . 1 5 , 2 ) ) ) , + betaprior = PriorSpec ( GaussianPrior ( mean = rep ( 0 , 8 ) , + variance = diag ( 1 0 ^6 , 8 ) ) ) )

The above command-lines are an example of how priors can be defined with the function lgcpPrior for a model with seven covariates. Indeed, in betaprior the mean and the variance are of dimension eight (which correspond to intercept and the seven covariates).

The object priors will be used in a LGCP fit further.

Actually, with LGCP, it is not possible to have an analytically tractable expression for the posterior π(θ, Y |X). Hence, we use Markov chain Monte Carlo (MCMC) algorithm in order to simulate the unknown posterior distribution. Another way to approximate this unknown distribution is the integrated nested Laplace approximation (INLA). For more details on INLA and a comparative evaluation of the performance between MCMC and INLA see Taylor and Diggle (2013).

MCMC methods generate samples from a Markov chain whose stationary distribution is the target of interest, in our case π(θ, Y |X). The commonly used algorithm is the Metropolis-Hastings algorithm. The reader may find more details in [START_REF] Robert | Méthodes de Monte Carlo par chaînes de Markov[END_REF]; [START_REF] Robert | Monte Carlo Statistical Methods[END_REF]; [START_REF] Robert | The Bayesian Choice: From Decision-Theoretic Foundations to Computational Implementation[END_REF]; [START_REF] Brooks | Handbook of Markov Chain Monte Carlo[END_REF].

We note Θ = (θ, Y ) the unobserved part of the model (model parameters and latent process) and {(Θ (N ) } N ≥1 the Markov Chain generated by the Metropolis-Hasting algorithm in order to estimate the posterior distribution π(Θ|X). The Markov-Chain is generated following the global principle given in Algorithm 1 and relies on proposal and acceptance/rejection. The proposal distribution is defined by a transition kernel q(Θ * |Θ).

Typically, the Markov chain {Θ (N ) } N ≥1 produced by Algorithm 1 is irreducible, ergodic and converges to the target distribution π(Θ|X). For necessary conditions on q to ensure these properties, see [START_REF] Robert | Monte Carlo Statistical Methods[END_REF] for example. Beyond this basic properties, the choice of q is critical to achieve quick convergence and good mixing properties of the Markov chain.

The design of q used in our Metropolis-Hastings type MCMC method is a mix of random walk and Langevin proposal kernels (Taylor et al., 2013). This method is known as the Metropolis-adjusted Langevin algorithm (MALA) and has been recommended by several authors working on inferential methods for spatial and spatio-temporal LGCP, for more details see [START_REF] Moller | Log gaussian cox processes[END_REF] and the references therein. We will only give basic elements, the reader may find further comprehensive details about MALA in [START_REF] Moller | Log gaussian cox processes[END_REF], [START_REF] Brix | Spatiotemporal prediction for log-gaussian cox processes[END_REF], Taylor et al. (2013) or [START_REF] Taylor | Bayesian inference and data augmentation schemes for spatial, spatiotemporal and multivariate log-gaussian cox processes in r[END_REF]. As suggested by the latter authors, it is better to work with a transformation of the Gaussian process Y , namely Γ for Algorithm 1 Metropolis-Hastings (I) Initialization Θ (0) of the chain at time 0;

(II) Update from Θ (N ) to Θ (N +1) as follows:

(a) Generate a proposal Θ * with distribution q(Θ * |Θ (N ) ) (b) Compute the acceptance ratio

p = min 1, π(Θ * |X) q(Θ (N ) |Θ * ) π(Θ (N ) |X) q(Θ * |Θ (N )
) .

(c) Set Θ (N +1) = Θ * with probability p, Θ (N ) with probability 1 -p.

instance, implying a matrix that diagonalizes the covariance function. This transformation appears to reduce the computational complexity and improve the mixing of the Markov chain. With Θ * = {β * , η * , Y * } and Θ (N ) = {β (N ) , η (N ) , Y (N ) }, the proposal is defined as

q(Θ * |Θ (N ) ) = N Θ * ; Θ (N ) + h 2 2 Σ∇ log{π(Θ (N ) |X)}, h 2 Σ
where N (a; b, c) denotes a multivariate Gaussian density with mean b and variance c evaluated at a and h > 0 is a scaling parameter. The parameter h is adjusted on some preliminary runs of the algorithm in order to achieve an average acceptance rate of 0.574 for the MCMC algorithm [START_REF] Moller | Log gaussian cox processes[END_REF][START_REF] Diggle | Spatial and spatiotemporal log-gaussian cox processes: Extending the geostatistical paradigm[END_REF]. Finally, the component Σ is composed of Σ Γ , Σ β and Σ η where all are approximations of the negative inverse of the Fisher information associated matrices [START_REF] Diggle | Spatial and spatiotemporal log-gaussian cox processes: Extending the geostatistical paradigm[END_REF]Taylor et al., 2013[START_REF] Taylor | Bayesian inference and data augmentation schemes for spatial, spatiotemporal and multivariate log-gaussian cox processes in r[END_REF]. The construction of Σ Γ , Σ β and Σ η are based on initial guesses at Γ, β and η, hence approximate values φ and σ2 obtained by minimum contrast method used before will be useful. The initial values for the run of the MCMC algorithm can be declared as follows:

> INITS <-lgcpInits ( etainit = log ( c ( sqrt ( 1 . 8 5 ) , 6 1 7 ) ) , betainit = NULL )
The function lgcpInits from package lgcp helps the MCMC algorithm to calibrate the proposal density using the provisional estimates given if specified. The argument etainit, as its name implies, is used in order to declare initial values for η which must be always presented in the required form {log(σ), log(φ)}. Then, the argument betainit is for parameter β. We followed [START_REF] Taylor | Bayesian inference and data augmentation schemes for spatial, spatiotemporal and multivariate log-gaussian cox processes in r[END_REF] by specifying nothing. If no initial value is declared then β will be estimated from an overdispersed Poisson fit to the cell counts, ignoring spatial correlation. Finally, note that Y (or Γ) is not specified as the user can not do it, actually, a sensible value is chosen by the MCMC function.

Bayesian Prediction

In a Bayesian predictive framework, the distribution of a "new" observation X * (in our case a new point pattern) is given by the posterior predictive distribution defined by π(X * |X) = π(X * |Θ)π(Θ|X)dΘ, (3.6) where X = {x 1 , . . . , x n } denotes the data, π(X * |Θ) is the data distribution and π(Θ|X) the posterior distribution. Note that if Θ were known, the predictive distribution for X * would simply be π(X * |Θ). As Θ is unknown, the predictive distribution for X * is a mixture of the data distributions π(X * |Θ) with respect to the posterior distribution π(Θ|X).

As the LGCP is computed on a grid, the goal here is to predict the number of events per cell of the computational grid. Considered an observed point pattern X = {x 1 , . . . , x n } within an observation window W , then the prediction of the number of events per cell i is given by the optimal predictor n * i , the posterior predictive expectation of n(X * ∩ c i ) given the point-process data X :

n * i = E[n(X * ∩ c i )|X], (3.7)
where E[•|X] is computed with respect to the posterior predictive distribution given in Eq (3.6) and X * denotes an independent replicate of the data with the same values Θ that produced the observed point pattern X (Cressie and Wikle, 2011, Chapter 2); a realization of X * is X * . Considering double conditioning with respect to Θ and X, we get

n * i = E[n(X * ∩ c i )|X] = E E n(X * ∩ c i )|X, Θ X = E π(Θ|X) λ(c i |Θ) , (3.8)
as X * is independent of point-process data X and n(X

* ∩ c i )|Θ ∼ Poisson(λ(c i |Θ)) with λ(c i |Θ) = exp Z(c i ) β + Y (c i ) . (3.9)
In Eq (3.8), the notation E π(Θ|X) means expectation with respect to the measure π(Θ|X).

From a practical point of view, the prediction n * i is computed using Monte-Carlo simulation methods to approximate the expectation by the average of simulated-based quantities and the MCMC algorithm to generates samples from a Markov chain whose stationary distribution is the target distribution π(θ|X) [START_REF] Gamerman | Markov Chain Monte Carlo -Stochastic Simulation for Bayesian Inference[END_REF]. In the Monte Carlo Markov Chain (MCMC) method, the expectation in Eq (3.8) may then be approximated by

n * i 1 N N l=1 λ(c i |Θ (l) ), i = 1, . . . , C 2 , (3.10)
where Θ (l) denotes the lth sample replicate of the Markov chain defined in Algorithm 1.

Indeed, the Markov chain (Θ (N ) ) N ≥1 being ergodic, the Ergodic theorem implies

1 N N l=1 λ(c i |Θ l) )
a.s.

-→ E π(Θ|X) [λ(c i |Θ)], as N → +∞. (3.11) For the sake of clarity, we give all software implementations in Section 3.5 which is devoted to LGCP modelling of the CAGB data.

Model performance assessment and risk measures

The goal in assessments for model fitting, which actually corresponds to posterior predictive diagnostics, is to determine whether the observed data are representative of the type of data expected under the assumed model. Our main goal is to predict as accurate as possible the number of accident per cell, so we suggest below several methods in order to evaluate the performances of competitor models.

Weighted Mean Squared Error and R-squared value

The first metric is based on the classical mean square error (MSE):

MSE = 1 C 2 C 2 i=1 (n * i -n i ) 2 ,
where n i = n(X ∩ c i ) denotes the number of events for the ith cell of centroid c i of the C × C computational grid and n * i the predicted number of events for the ith cell. With the MSE-metric, equal weights 1/C 2 of sum equal to one are given to all squared differences between the observed and the predicted values. In our situation, it may be advisable to weight differently the squared discrepancies between the observed and the predicted values. We suggest then the second metric which is a weighted MSE (wMSE) defined as follows wMSE =

C 2 i=1 w i (n * i -n i ) 2 , (3.12)
where (3.14) and Var(n(X * ∩c i )|X) is computed with respect to the posterior predictive distribution given in Eq (3.6). Considering again double conditioning with respect to Θ and X, we get

ω i = ωi C 2 j=1 ωj , (3.13) with ωi = 1 Var(n(X * ∩ c i )|X) , i = 1, . . . , C 2 ,
Var n(X * ∩ c i ) X = E Var n(X * ∩ c i ) X, Θ X + Var E n(X * ∩ c i ) X, Θ X = E π(Θ|X) λ(c i |Θ) + Var π(Θ|X) λ(c i |Θ) , (3.15)
as X * is independent of the point-process data X and n(X

* ∩ c i )|Θ ∼ Poisson(λ(c i |Θ)).
Recall that λ(c i |Θ) is defined in Eq (3.9).

From a practical point of view, the variance given in Eq (3.15) may be evaluated by MCMC approximation. In the previous section, devoted to Bayesian prediction, the expectation term from the right-side of Eq (3.15) is approximated by

1 N N l=1 λ(c i |Θ (l) ) -→ N →+∞ E π(Θ|X) λ(c i |Θ) .
The variance term in the right-side of Eq 3.15 can be approximated in a similar way by

1 N N l=1 λ(c i |Θ (l) ) - 1 N N k=1 λ(c i |Θ (k) ) 2 -→ N →+∞ Var π(Θ|X) λ(c i |Θ .
So, in practice, we use the approximation

Var(n(X * ∩ c i )|X) 1 N N l=1 λ(c i |Θ (l) ) + 1 N N l=1 λ(c i |Θ (l) ) - 1 N N k=1 λ(c i |Θ (k) ) 2 . (3.16)
In order to compare the performances of different models, we have also considered the Rsquared value defined by

R 2 = 1 - C 2 i=1 (n * i -n i ) 2 C 2 i=1 (n -n i ) 2 , (3.17)
where n = 1

C 2 C 2
i=1 n i is the mean number of events per cell of the computational grid.

Confusion matrices

An appropriate LGCP model would predict correctly the event occurrences when they were initially observed. In order to asses this model performance, we need to compute the probability that the expected number of events per cell is equal to 0:

P n(X * ∩ c i ) = 0 X = E I {n(X * ∩c i )=0} |X (3.18) = E E I {n(X * ∩c i )=0} |X, Θ X (3.19) = E P n(X * ∩ c i ) = 0 X, Θ X = E π(Θ|X) exp(-λ(c i |Θ)) 1 N N l=1 exp(-λ(c i |Θ (l) )) . (3.20)
These predicted probabilities can help us to classify the observations into two classes: if the predicted probability is "high" (namely higher than a threshold to be defined), then we classify the corresponding observation as belonging to the class 0 = "no events occurred", otherwise it belongs to the class 1 = "at least one event occurred". These predicted classes can then be compared to the observed values which have been also classified in these two 0/1 classes by applying the same rule. Confusion matrices are crossed tables of the observed and predicted classes as follows:

Predicted class 0 1 Observed class 0 True negative (TN) False positive (FP) 1 False negative (FN) True positive (TP)

Several metrics are based on the quantities contained in the confusion matrix (TN, FN, FP and TP) and are commonly used in machine learning in order to assess the model performance. The reader may find more details on the confusion matrix implementations and these metrics in Section 3.5.2.

Exceedance probabilities and relative risk

In order to visualize the spatial variation of the random intensity function

Λ(c i ) = exp(Z(c i ) β + Y (c i )), i = 1, . . . , C 2 , (3.21)
we use, as in Taylor et al. (2013), the exceedance probabilities defined by

P Λ(c i ) > t X = E P Λ(c i ) > t X, Θ X = E π(Θ|X) I {λ(c i |Θ)>t} , (3.22)
where I denotes the indicator function. Once again, the MCMC approximation is used and yields

P Λ(c i ) > t X 1 N N l=1 I {λ(c i |Θ (l) )>t} .
The random intensity function takes into account both the spatial random effect through the latent random field Y and the covariate effects through the parameter β. One is often interested in studying the two effects separately and focus first on the spatial random effect.

In the sequel, the Markov Chain (Θ (N ) ) N ≥1 is noted

Θ (N ) = (β (N ) , η (N ) , Y (N ) ), N ≥ 1.
If one wants to study specifically the spatial random effects, one can focus on the spatial relative risk

P exp(Y (c i )) > t X = E P exp(Y (c i )) > t X, Θ X = E π(Θ|X) I {exp(Y (c i ))>t} 1 N N l=1 I {exp(Y (l) (c i ))>t} . (3.23)
This quantity is interpreted as the residual spatial effect after integration of the spatial variability due to the spatial covariates.

Parameter a posteriori distribution and associate effects

Finally, it is interesting to visualize the a posteriori distribution of the parameters θ = (β, η).

The parameter β corresponds to the covariates effect. More precisely, the jth component β j corresponds to the effect of the jth covariate Z j and the exponential exp(β j ) is interepreted as a relative risk. Hence, β j < 0 means that higher values of Z j imply reduced risk of road crashes, while β j > 0 corresponds to increased risk. The value β j = 0 is interpreted as an absence of effect of the covariate Z j . In the MCMC method, the a posteriori distribution of β j is assessed through the empirical distribution {β (N ) j } N ≥1 along the Markov chain. Typically, the histogram of the MCMC sample {β (l) j : 1 ≤ l ≤ N } allows to visualize the a posteriori distribution of β j . One can compare the a posteriori distribution to the a priori distribution and infer how much the observations are informative for the statistical inference. In particular, recall that the a priori distribution for β j has been chosen as a very flat prior. A credible interval with level 95% for β j is obtained by taking the empirical quantiles of order 2.5% and 97.5% of the MCMC sample. Of particular interest is to determine whether 0 lies inside or outside the credible interval for β j , so as to determine the statistical significance of the effect of the covariate Z j .

Similarly, the posterior distribution for η = (log σ, log φ) is visualized via an histogram of the MCMC sample {η (l) : 1 ≤ l ≤ N }. This yields a Bayesian estimation of the parameters of the latent process Y . For more convenience, covariate data are named cagb covar sf instead of grid cagb sf as it is named in Chapter 2. Note that the covariates are on different scales. In order to make each covariate equally important, a min-max normalization is applied as follows:

> minmax _ norm <-function ( x ) return (( x -min ( x ) ) / ( max ( x ) -min ( x ) ) )

> The total number of cells included in the observation window is 1 362. Each cell will represent an observation. The covariates are {Z 1 , Z 2 , . . . , Z 13 } = {prop18, prop65, health, school, college, shop, station, gasoline, leisure, intersection, radars, municipal length, national length}. Then, the response variable to be explained will be the cell event counts of the computational grid, that is, the number of accidents per cell. A column accidents will be created and merged to the covariates in order to have a global data-frame. Remind that in Section 2.2, the sf object cagb sf has been structured and corresponds to our road crash point pattern. The PIP interpolation method, as seen in Section 2.3.2, is used in order to aggregate road crash points cagb sf located in polygon cells of cagb covar sf as follows:

> st _ crs ( cagb _ sf ) <-st _ crs ( cagb _ covar _ sf ) > cagb _ sf $ accidents <-rep ( 0 , nrow ( cagb _ sf ) ) > cagb _ covar _ sp <-as ( cagb _ covar _ sf , ' Spatial ') > cagb _ sp <-as ( cagb _ sf , ' Spatial ') > cagb _ sp <-aggregate ( x = cagb _ sp [ " accidents " ] , + by = cagb _ covar _ sp , + FUN = length ) > cagb _ sf <-st _ as _ sf ( cagb _ sp ) > cagb _ sf [ is . na ( cagb _ sf $ accidents ) , ]$ accidents <-0 > st _ crs ( cagb _ sf ) <-st _ crs ( cagb _ covar _ sf ) > selection _ sf <-st _ join ( cagb _ covar _ sf , cagb _ sf , + join = st _ covers ) > selection <-st _ drop _ geometry ( selection _ sf )
Similar command-lines as in Section 2.3.2 have been used. In order to use the function aggregate, SpatialPolygonsDataFrame objects cagb sp and cagb covar sp have been created with as(, 'Spatial') as seen in the previous chapter. Then, the sf object selection sf is created with st join from package sf but this time with argument join = st covers, another way to join geometries that gives the same results as methods employed in Section 2.3.2. Finally, the function st drop geometry is used in order to remove geometries from selection sf and to create the data.frame object selection.

Poisson aggregation

We suggest in the following a variable selection method based on Poisson aggregation and variable importance criterion. Indeed, the Poisson distribution is the simplest distribution for count data. The average number of road crash occurrences per cell of the computational grid will be modelled in function of the available covariates. Actually, Poisson regression is quite similar to the LGCP as presented in Section 3.3 except that the Poisson regression completely ignores the spatial correlation. Mathematically speaking, let N i be the random variable denoting the number of accidents per i-th cell and n i the observed value of N i . Then, N i follows a Poisson distribution of mean λ i which we model by the following Poisson regression model based on covariate data Z 1 , . . . , Z 13 described in the previous section:

log(λ i ) = f (z i ), i = 1, . . . , C 2 f (z) = b 0 + z b for z i = (Z ij ) 13
j=1 and b = (b j ) 13 j=1 , b j ∈ R, j = 1, . . . , 13. The predicted number of accidents per cell, Ni , is given by: Ni

= f (z i ) = exp( b0 + z i b)
where bj , j = 1, . . . , 13 are computed from sample data iteratively by using the re-weighted least squares criterion (Agresti, 2002, Chapter 4). In practice, count data exhibit sometimes larger variability than the mean, this phenomenon is known as overdispersion and is represented by a dispersion parameter Φ. Literally, this is defined as Var(N i ) = ΦE[N i ] with Φ > 1. A way to overcome this situation is to use the quasi-Poisson model that introduces the dispersion parameter Φ into the model as suggested in Agresti (2002, Chapter 4).

In order to choose the most important variables, we suggest to proceed with a Poisson model aggregation instead of fitting a classical single Poisson regression model. More exactly, the Poisson model aggregation is an ensemble method that combines several Poisson regression models in order to get a better fit than a single Poisson regression model would do; it works in a similar way as the well-known random forest algorithms [START_REF] Breiman | Random forests[END_REF] except that we consider a Poisson regression model now instead of a regression tree.

Globally speaking, the statistical learning method proposed is as follows. In this approach, we generate M different bootstrapped training data sets by randomly selecting with replacement n units among the initial n ones. Let B m be these bootstrapped data sets, m = 1, . . . , M. We select also randomly and without replacement a set of p 0 covariates among the initial 13 covariates; let A m ⊂ {1, . . . , 13} be the set of the labels of the chosen covariates. Let denote by z * i = (Z ij ) j∈Am the p 0 -dimensional vector of measures of the selected covariates on the i-th unit, for i ∈ B m . We fit next a Poisson regression model on the data set (n i , z * i ), i ∈ B m and determine b0 , b = ( bj ) j∈Am . The predicted number of road crashes N Bm at some point z is given by:

N Bm (z) = f Bm (z), = exp( b0 + z b). (3.24)
Finally, the m predicted values for N i at z are averaged to obtain the final predicted value for N i at z :

N (z) = 1 M M m=1 N Bm (z). (3.25)
Here our main purpose is the variable selection and we need a variable importance criterion. As suggested in [START_REF] Breiman | Random forests[END_REF], we used the variable permutation criterion as variable importance measure (VIM). This process consists in, once the model is trained on the data set (n i , z * i ), i ∈ B m to determine f Bm (•), shuffling the jth covariate values, j = 1, . . . , 13 for the units not selected in the bootstrapped sample B m . Then, predictions errors are evaluated on the initial sample and on the permuted sample. The permutation variable importance is defined to be the increase in the model error when this single covariate has been randomly permuted. This procedure breaks the relationship between the covariate and the response variable, thus the increase in the model error is indicative of how much the model depends on the variable.

More formally, the VIM is computed as follows. Dealing with a bootstrapped sample means that there are remaining observations not used: these observations form the out-ofbag (OOB) sample, named OOB Bm . We fit a Poisson model on the data set (n i , z * i ), i ∈ B m to determine f Bm (•); we compute the predictions N Bm (z i ) = f Bm (z i ) for i ∈ OOB Bm and evaluate the prediction error err OOB Bm defined as the average of the squared discrepancies between the predicted and the observed values:

err OOB Bm = 1 |OOB Bm | i∈OOB Bm ( N Bm (z i ) -n i ) 2 ,
where z i = (Z ij ) 13 j=1 for i ∈ OOB Bm . We permute randomly the values of the jth covariate, j ∈ {1, . . . , 13}, on the OOB Bm data set and we compute the error in a similar way:

err OOB Bm,j = 1 |OOB Bm | i∈OOB Bm ( N Bm (z j i ) -n i ) 2 ,
where

z j i = (Z (j) i ) 13 =1
for which the values of the covariate Z j have been permuted on the OOB Bm set.

The VIM of the jth variable named V IM Bm,j corresponds simply to the difference be-tween these two errors. The VIM is evaluated for each covariate on each training set B m , m = 1, . . . , M . Finally, after running the M iterations of the process, all VIMs are averaged in order to have one VIM value for each covariate named V IM j as follows

V IM j = 1 M M m=1
V IM Bm,j .

(3.26)

The higher the VIM value is, the more important the corresponding variable is. The corresponding variable selection algorithm is described in Algorithm 2. In order to evaluate the accuracy of this variable selection method, the whole dataset selection is splitted into a training set s train = selection train and a test set s test = selection test. 1. Select randomly without replacement p 0 ≤ 13 covariates among the original covariates {Z 1 , . . . , Z 13 }; let A m be the set of the selected variables;

2. Fit a Poisson regression on the sample data (n i , z * i ), i ∈ B m where n i is the observed number of accidents on the mth sample and z * i is the vector of recorded values of the p 0 selected covariates for i ∈ B m ; determine f Bm (•); 3. Evaluate the out-of-bag error err OOB Bm on the OOB Bm observations

err OOB Bm = 1 |OOB Bm | i∈OOB Bm ( N Bm (z i ) -n i ) 2
where for i ∈ OOB Bm , z i is the vector of recorded values of the 13 covariates and N (z i ) = f Bm (z i ) are the prediction values.

4. For j = 1, . . . , 13 do:

(a) Shuffle randomly the values of the j-th variable on the OOB sample, let

z j i = (Z (j) i ) 13
=1 be the new vector of observations, for i ∈ OOB Bm . (b) Evaluate the out-of-bag error err OOB Bm,j :

err OOB Bm,j = 1 |OOB Bm | i∈OOB Bm ( N Bm (z j i ) -n i ) 2 ,
(c) Evaluate the variable selection criterion V IM Bm,j

V IM where Ns is the mean value on the sample s.

The Poisson models aggregation is not already computed in any R package to the best of our knowledge. Hence, a function rf poisson has been created in order to compute the whole process described in Algorithm 2. This function takes as arguments the training and the test sets, the response variable name, the covariate names, the number of covariates to be randomly selected and the number of models to be fitted. These arguments are respectively specified with train, test, N, varZ, mtry and M attributes. Note that in the following, for the sake of clarity, we tried to split the function according to each step of Algorithm 2, as the function is heavy to read. First, storing matrices are declared : Secondly, the m th Poisson model with N as the response variable and Zstar as covariates is computed as follows:

+ # Model fitting + fhat _ Bm <-glm ( FORM , data = Bm , family = " quasipoisson " )
The function glm with argument family = "quasipoisson" is used in order to fit the model, named fhat Bm. Note that this choice enables to focus on the overdispersion in Poisson models.

Then, the m th OOB error is evaluated as follows:

+ # OOB error with no permutation + oob _ Bm <-train [ -b , ] + err _ oob _ Bm <-predict ( fhat _ Bm , + newdata = oob _ Bm , + type = " response " ) + err _ oob _ Bm <-mean (( err _ oob _ Bm -oob _ Bm [ , N ]) ^2 )
The OOB observations OOB Bm are the remaining observations not used in the sample B m , hence we simple remove the observations taken for Bm in train. Then, the error err OOB Bm is computed using the predictions and the observations, named err oob Bm.

Next, the variable importance criterion has to be setted. Hence, a for loop is also used in order to iteratively permute the j th covariate in the OOB observations as follows: The j th covariate values of observations oob Bm are permuted with the function resample from the package gdata. Then, the j th covariate non permuted is removed and replaced by the new permuted values in oob Bm. The sample containing the vector of recorded values for which the j th covariate values have been permuted is called oob Bm j. Then, similarly as previous command-lines, the m th OOB permuted error err OOB Bm,j , named err oob Bm j, is obtained. Finally, the VIM is evaluated by summing up the difference between err oob Bm j and err oob Bm to the previous differences computed at m -ith iterations, i = 1, . . . , m -1.

The final step for the m th iteration is to compute the predictions of the response variable N on the train and test sets, train and test, as follows:

+ # Forecasting + Nhat _ train _ Bm [ , m ] <-predict ( fhat _ Bm , + newdata = train , + type = " response " ) + Nhat _ test _ Bm [ , m ] <-predict ( fhat _ Bm , + newdata = test , + type = " response " ) + } # M fitted models
The for loop process for the aggregation is now done, M Poisson regressions have been fitted and associated predictions for train and test sets have been computed at each step. The final stage then is to average all the predictions and the VIM values in order to evaluate MSE and R-squared values. This is done as follows: The function rf poisson is fully computed, it remains to return the results as follows:

+ # Function results + rf <-list ( R 2 _ train , R 2 _ test , MSE _ train , MSE _ test , VIM ) + return ( rf ) + + }

Implementations of Poisson aggregation and variable selection on CAGB data

Train/Test subsample sets

The first step is to split up the dataset selection into two subsets selection train and selection test. Remind that there are 396 accidents located in the 1 362 cells that overlay the CAGB window. This means that the split up of selection might create two subsets unequally shared according to the number of road crashes per cell. Moreover, this phenomenon known as imbalanced class could degrade the performance of the learning method further. Hence, it is a major asset to rectify this possible case. The method proposed is as follows. A temporary column accidents class is created and is defined as the class 1 if one or more accident are located in the cell, class 0 otherwise. Then, the subsets selection train and selection test are formed by following a kind of balance class. This process is computed as follows:

> selection <-selection % >% + mutate ( accidents _ class = case _ when ( accidents != 0 ~1 ) ) > selection [ is . na ( selection $ accidents _ class ) , ]$ accidents _ class <-0 > selection $ accidents _ class <-as . factor ( selection $ accidents _ class ) > prop . table ( table ( selection $ accidents _ class ) ) 0 1 0 . 8 8 8 3 9 9 4 0 . 1 1 1 6 0 0 6

The column accidents class is created with the function mutate from the package dplyr. As expected, we are in a case of imbalanced class. Indeed, the class 0 is represented around 88.84% and class 1 as 11.16%. Classical methods for balanced class usually form the subsets by following the same balance of the initial dataset. However in the case of imbalanced class, the purpose of main solution methods is to bring back to a case of balanced class if possible [START_REF] Menardi | Training and assessing classification rules with imbalanced data[END_REF]. Several methods are available for solving this problem. The method used here is Synthetic Minority Oversampling Technique (SMOTE) which oversamples the minority class. The reader may find more details about overcoming imbalance class methods, especially the SMOTE method, in [START_REF] Chawla | Smote : Synthetic minority over-sampling technique[END_REF]. The proposed solution to our imbalance class problem is computed as follows:

table ( table ( selection _ train $ accidents _ class ) )

> selection _ train $ accidents <-round ( selection _ train $ accidents ) 0 1 0 . 6 0 . 4

First, the function createDataPartition from the package caret is used in an attempt to balance the class distributions within the splits as the initial dataset selection. Then, the SMOTE method is employed with the function SMOTE of package DMwR. This generates a new dataset, following the specified parameters (we will not go into details here), that addresses the class imbalance problem. Note that this method is setted only for selection train as models would be trained on it. The subset selection test will be only used for model assessments. Finally, accidents class is removed:

> selection _ train <-

Poisson aggregagtion on CAGB data

As the subsets selection train and selection test are now created properly, the aggregation can be fitted. First, storing objects and arguments of the function rf poisson are initialized as follows:

> N <-" accidents " > varZ <-c ( " radars " , " health " , " school " , " college " , + " leisure " , " gasoline " , " station " , " municipal _ length " , + " national _ length " , " prop 1 8 " , " prop 6 5 " , + " intersection " , " shop " ) > mtry <-c ( 4 , 6 , 8 , 1 0 , 1 3 ) > M <-1 0 0 0 > res <-list ()

The parameter mtry, which corresponds to the number of covariates randomly selected to be fitted, is tuned with five possible values: 4, 6, 8, 10 and 13. Note that 13 corresponds to the total number of available covariates. The parameter M, which corresponds to the number of iterations, is setted to 1 000. Finally, a list object res is declared in order to contain the results of the function rf poisson.

Then, the run of the aggregation is as follows:

> T 1 <-Sys . time () > i <-1 > for ( p 0 in mtry ) { + res [[ i ]] <-rf _ poisson ( selection _ train , + selection _ test , + varA , + varZ , + mtry = p 0 , + M ) ) + i <-i + 1 + } > T 2 <-Sys . time () > difftime ( T 2 , T 1 )
Time difference of 3 . 0 8 4 6 3 4 mins A for loop is used in order to iteratively run the aggregation with the p0 th element of the vector mtry as number of covariates to be fitted in Poisson models. The computation time of these 5 000 models is 3 minutes and 4.8 seconds.

Results and interpretations

The results of this aggregation are compared with several fits (the corresponding R command-lines are not given). Indeed, linear regressions, Poisson regressions, penalized models (Lasso), Boosting and Random Forest models have been also fitted. We will only present the results of a saturated Poisson regression, a Poisson regression with covariates selected with Akaike Information Criterion (AIC) and a Random Forest model. Note that the Random Forest has been fitted using also the permutation criterion and the hyperparameters, such as for example the number of covariates to be randomly selected at each iteration, have been tuned by cross validation. The results are shown in Tab 3.1. Tab 3.1 gives the performance assessment of a saturated Poisson regression (which means that all the covariates have been included), a Poisson regression with the seven covariates selected with AIC criterion, the Poisson aggregations with different numbers of covariates to be randomly selected and fitted into the models (four, six, eight, ten and thirteen) and finally, a Random Forest model. The reader may find in Appendix B the Tab B.1 which is very similar to Tab 3.1, however the statistical methods used have been fitted on different samples of the dataset selection. The best model, according to MSE and R-squared values on selection train, is the Random Forest with a MSE and a R-squared respectively equal to 0.28 and 0.92. However, on selection test, this model is ranked almost the last with a MSE and a R-squared respectively equal to 0.51 and 0.62. This specific case seems similar as overfitting cases. However, the Random Forest model has been fitted with cross validation in order to find the best tuning parameters (we will not go into details here) that could improve values of MSE and R-squared on selection test and the best model choice is this one (with for example eight covariates to be randomly selected at each iteration).

The saturated Poisson regression and the saturated aggregation (both with all available covariates) are only presented in order to be compared with the parsimonious models. It seems that the two best models, in terms of the explanatory-predictive tradeoff, are Poisson regressions aggregation with eight and ten covariates. Indeed, the MSE values on selection train are respectively 1.09 and 1.07 whereas the saturated aggregation MSE value is 1.18. R-squared values are respectively 0.71 and 0.72 instead of 0.69 for the saturated model. However on selection test they are quite equivalents. Indeed, MSE values of aggregations with 8 and 10 covariates are respectively 0.42 and 0.41 where the saturated aggregation MSE is equal to 0.42. Then, R-squared values are respectively 0.69 and 0.70 where the saturated one is 0.69.

Globally, the R-squared values of all these fits do not exceed 0.72 and 0.70 on respectively selection train and selection test. The methods employed did not give possibilities to improve the predictions. This means that eventually there is: the need of more informative covariates; another statistical model framework; no solutions to better anticipate the number of road crashes per cells. Some tentative answers will be given further with the LGCP fit.

Variable importance visualization

Back to the importance of the covariates, it could be interesting to produce variable importance plot similar to the classical plots usually given in practice. To do so, the VIM values returned by the function rf poisson will be used. We proposed here to plot the ratio of the VIM values compared to the maximum one. Here is how to compute such a plot: _ 4 <-cbind ( rownames ( vim _ 4 ) , vim _ 4 ) > colnames ( vim _ 4 ) <-c ( ' covariate ' , ' vim ') > vim _ 4 <-vim _ 4 % >% + mutate ( imp = vim * 1 0 0 / max ( vim ) ) > ggplot ( data = vim _ 4 , aes ( x = reorder ( covariate , + imp ) , y = imp ) ) + + geom _ bar ( stat = " identity " , fill = " steelblue " ) + + coord _ flip () + + labs ( x = " Covariate " , y = " Importance " )

> vim _ 4 <-as . data . frame ( res [[ 1 ]][[ 5 ]]) > vim
The VIM values of the Poisson models aggregation where four covariates were randomly selected at each iteration have been chosen as an example for the command-lines, named vim 4. First, the VIM values are handled in order to create a dataframe with the name of the covariates, the VIM associated to them and the importance value as columns, named respectively covariate, vim and imp. The importance value, as mentioned before, is simply the ratio of the VIM compared to the maximum one. Then functions of the package ggplot2 are used in order to produce a barplot that plots the decreasing importance of each covariate. As the reader can see, it is possible sometimes to have negative values for permutation importances. In these cases, the predictions on the shuffled data happened to be more accurate than the real data. This happens when the covariate seems to be really not informative but random chance caused the predictions on shuffled data to be more accurate (Genuer and Poggi, 2019, Chapter 4). Recall that the definition of LGCP is written as

Command-lines above produced

n(X ∩ c i ) ∼ Poisson(λ(c i )) log(λ(c i )) = Z(c i ) β + Y (c i ).
Six subsets of covariates have been chosen and hence, give the following LGCP model formulas :

LGCP1 : X ∼ municipal length + national length + intersection + radars + prop65 + prop18 + station

LGCP2 : X ∼ municipal length + shop + station + national length

LGCP3 : X ∼ municipal length + national length + intersection + station + prop65 + leisure

LGCP4 : X ∼ municipal length + national length + intersection + shop + prop65 + station + prop18 + gasoline

LOG-GAUSSIAN COX PROCESSES : FIT, DIVERSE ASSESSMENTS AND RESULT INTERPRETAT

LGCP5 : X ∼ municipal length + national length + prop65 + intersection + prop18 + shop + school + gasoline + radars + station

LGCP6 : X ∼ municipal length + intersection + school + shop + health + national length + station + prop18

The covariates of model LGCP1 correspond simply to the covariates selected with AIC on the Poisson regression. Then for each remaining model, the covariates have been chosen as being the most important covariates in the model relating respectively to the number introduced. Indeed for example, as four covariates were set to be randomly selected and fitted in the Poisson regressions of the aggregation then the most four important covariates have been chosen for LGCP2. The same process was adopted for LGCP3, LGCP4, LGCP5 and LGCP6.

3.5 Log-Gaussian Cox Processes : fit, diverse assessments and result interpretations

Fit

In the previous section, six subsets of covariates have been selected by variable selection methods. The next step then is to fit LGCP models with these choices. The model LGCP1 will be taken as example for the implementation in R. First, the model is defined as follows:

> FORM <-X ~municipal _ length + national _ length + intersection + radars + prop 6 5 + prop 1 8 + station

Then the next step is to interpolate the covariates of this model onto the computational grid polyolay. Remind that in Section 2.3, an object SpatialPolygons has been extracted from polyolay and has been used in order to interpolate all the available covariates on. The purpose of interpolating the covariate values directly on a grid that is the same as the computational grid polyolay was to perform the interpolation methods ourself. Indeed, we were able to know exactly what was happening with our data and compare later the covariate values support that will be used in the fit of the LGCP models. Hence, the process of interpolation that will be used in the following will only give the same values as cagb covar sf, produced in Section 2.3.3. The classical steps for interpolating the covariates of a model on the computational grid as recommended in [START_REF] Taylor | Bayesian inference and data augmentation schemes for spatial, spatiotemporal and multivariate log-gaussian cox processes in r[END_REF] using the package polyolay are the following:

> cagb _ covar _ sp <-as ( cagb _ covar _ sf , ' Spatial ') > cagb _ covar _ sp@data <-guessinterp ( cagb _ covar _ sp@data ) > cagb _ covar _ sp@data <-assigninterp ( df = cagb _ covar _ sp@data , + vars = colnames ( cagb _ covar _ sp@data ) , + value = " ArealWeightedSum " ) First, the function guessinterp from package lgcp assigns by default the interpolation method as the area-weighted mean for any numeric column. As its name implies, this function is used in order to guess provisional interpolation methods for the columns of the data frame. If the user wants to replace the assigned interpolation process, this can be done by using the function assigninterp and specifying the desired method in the value argument. There are three possible types of interpolation methods employed in the package lgcp, the reader may find more details in Taylor et al. (2015, Section A). The method used here is ArealWeightedSum. However, as our covariates have already been interpolated on the computational grid previously, any of the three interpolation methods would lead to the same result. Finally, the process of interpolation is as follows:

> Zmat <-getZmat ( formula = FORM , data = cagb _ ppp , + r egi on al co va ri at es = cagb _ covar _ sp + cellwidth = 6 5 0 , + ext = 2 , + overl = polyolay )

Using ' cellwidth ' and ' ext ' from overl aggregating regional covariate information ... loading polygon overlay ... interpolating ... Time Taken : 6 . 9 1 2 6 8 9

The function getZmat constructs a design matrix for routine used in lgcp. Note that the arguments cellwidth and ext have been mentioned in Section 2.3.1. The component cellwidth has been explained above in Section 3.3.2. Then, the argument ext specifies the amount by which the computational grid will be extended, we will not go into details here, the reader may find comprehensive motivations in [START_REF] Davies | On circulant embedding for gaussian random fields in r[END_REF].

The covariate data can be visualized by using the command-line plot(Zmat) which produces a sequence of plots, almost similar to the ones produced in Section 2.3.3 and in the Appendix A.

The final step from the LGCP routine is to run the MCMC algorithm. In order to do that, we need the spatial point pattern (contained in cagb ppp), the covariates interpolated onto the computational grid and contained in the object Zmat, the model formula specified with FORM, the covariance function (contained in the object cf), the initial values of β and η specified in INITS and the priors specified in priors. Note that in Section 3.3.4, the priors have been specified for a model of 7 covariates, just as LGCP1. The fit is computed as follows:

> nsimul <-1 5 0 0 0 0 0 > bnin <-2 5 0 0 0 0 > rt <-1 2 5 0 > BASEDR <-" RESULTS / res _ LGCP 1 / " > lgcp 1 <-l g c p P r e d i c t S p a t i a l P l u s P a r s ( The above command-lines run the MALA chain for 1 500 000 iterations, with an initial burn-in of 250 000 iterations, followed by 1 250 000 iterations of which every 1 250th sample is saved. This leads to a sample {(Θ (N ) } N ≥1 = {(β (N ) , η (N ) , Y (N ) )} N ≥1 with N = 1000. The argument adaptivescheme is specific to the MALA proposal, the reader is refered to Taylor et al. (2013) for an explanation of these options. The results of lgcp1 are saved in an object by specifying the argument output.control and with the function save used in the last command-line.

The models LGCP2, LGCP3, LGCP4, LGCP5 and LGCP6 have been fitted by using similar command-lines, respectively named lgcp2, lgcp3, lgcp4, lgcp5 and lgcp6. However, note that the objects FORM, Zmat and priors are specific to the models themselves.

Fits assessment

The models LGCP2, LGCP3, LGCP4, LGCP5 and LGCP6 have been fitted in the previous section. The purpose now is to compare these models in order to chose the best one. The criteria that will be used further in order to choose the best model are the wMSE and the R-squared values, then the confusion matrices as introduced in Section 3.3.5. The best model will then be used to map the riskiest zones of the CAGB and to identify the riskiest factors as introduced in Section 3.3.5.

Weighted mean squared errors and R-squared values

The goal now is to compute the weighted mean square error, wMSE, defined in Eq (3.13) for the six models. Recall that the wMSE is defined as follows wMSE =

C 2 i=1 ωi C 2 j=1 ωj (n * i -n i ) 2 , where ωi = 1 Var(n(X * ∩ c i )|X) , i = 1, . . . , C 2 (3.29)
and Var(n(X * ∩ c i )|X) will be approximated by Monte-Carlo and MCMC simulations as given in Eq (3.16). In order to do that, we need to compute first n * i , the expected number of events per cell of the grid, defined in Section 3.3.4.

An approximation of n *

i , for the model LGCP1 can be computed as follows:

> lgcp 1 _ pred <-lgcp ::: expectation . The function expectation from the package lgcp computes joint expectations under the model with all parameters. The function numCases, in argument of expectation, gives the expected number of events in each cell of the computational grid. The object lgcp1 pred is a 64 × 64 matrix. The observed and the predicted values can be compared graphically. In order to do that, the initial road crash values have to be interpolated on the computational grid in order to obtain a matrix 64 × 64 just as lgcp1 pred. Indeed, remind that selection sf corresponds only to the cells including in the window owin cagb sf. Hence, a sf object obs sf has been created with the SpatialPolygons object extracted from polyolay on which the road crash point pattern cagb sf has been interpolated similarly as previous methods used (command-lines not shown as the process was similar to many other processes in the previous and current chapter). Then, as lgcp1 pred is simply a matrix, the spatial marker that could have informed us of the different geometric structures of these cells is lost. Hence, one way to assign back exactly the same spatial structures as obs sf for example is to create a RasterLayer object. This is done as follows:

> obs _ sp <-as ( obs _ sf , ' Spatial ') > r <-raster ( ncol = 6 4 , nrow = 6 4 ) > crs ( r ) <-crs ( obs _ sp ) > extent ( obs _ sp ) > extent ( r ) <-extent ( obs _ sp ) > obs _ ras <-rasterize ( obs _ sp , r , field = " accidents " ) > lgcp 1 _ pred _ ras <-raster ( lgcp 1 _ pred )

123

> extent ( lgcp 1 _ pred _ ras ) <-extent ( obs _ ras ) > plot ( obs _ ras , main = " " ) > plot ( lgcp 1 _ pred _ ras , main = " " ) class : Extent xmin : 9 0 6 1 3 5 . 5 xmax : 9 4 7 7 3 5 . 5 ymin : 6 6 6 4 4 9 8 ymax : 6 7 0 6 0 9 8

First, a RasterLayer object obs ras is created from obs sf. Indeed, the sf object obs sf is our reference spatial structure from which we want to assign the same geometries to lgcp1 pred. To do so, first a SpatialPolygonsDataFrame object obs sp is created as it is necessary later. Then, a 64 × 64 RasterLayer object r is created using the function raster from the package raster. The spatial extent of this RasterLayer object is specified by using the extent of obs sp. An extent object is simply giving the spatial boundaries of the object in argument. For example, the lowest latitude value of obs sp is 6 664 498.

Then, the function rasterize from the package raster allows to transfer the values containing in the column accidents of the object obs sp to the raster cells r. Finally, the RasterLayer object lgcp1 pred ras is created with the function raster and its extent is specified using the extent of obs ras. The two RasterLayer objects can be then plotted using the function plot. Note that it was not necessary to set obs ras in order to create lgcp1 pred ras. Indeed to specify its extent, we could have used the following commandline : extent(polyolay$fftpoly), as it is the same. The creation of obs ras is used as manipulation examples of raster package functions but more particularly for the sake of comparison between the observed and fitted values. Now, that the expected number of events per cell of the grid n * i has been approximated, we can approximate the variance formula as given in Eq (3.16). For the sake of clarity, we make a copy of lgcp1 pred named EX. The function that computes the approximation of the variance given in Eq (3.16) is as follows : Note that this function is not so obvious. We will not go into details here. The most important command-line is the option return in which the Eq (3.16) is clearly written. Then, the function expectation used the function VARX to compute the variance from lgcp1. Note also that EX should have been incorporated as an argument in the function VARX but we did not proceed with this direction as it was difficult to implement it. Finally, the wMSE for the model LGCP1 is computed as follows:

> w 1 _ tilde <-1 / lgcp 1 _ VARX > w 1 <-w 1 _ tilde /( sum ( w 1 _ tilde , na . rm = TRUE ) ) > lgcp 1 _ wMSE <-sum ( w 1 *( as . matrix ( obs _ ras ) -+ as . matrix ( lgcp 1 _ pred _ ras ) ) ^2 ,

+ na . rm = TRUE ) > lgcp 1 _ wMSE [ 1 ] 0 . 0 1 2 4 1 5 1 2
The vector of weights ω is computed as defined in Eq (3.14). The second command-line allows to set NA values outside the window area. This implies that only the cells inside the window owin cagb are considered meaning that the wMSE is written as

wMSE = C W i=1 ωi C W j=1 ωj (n * i -n i ) 2 ,
where C W is the number of cells included in the study window W , equal to 1 362. The value of the wMSE computed from lgcp1 is 1.24e-02. Finally, the vector of weights ω i = ωi / C W j=1 ωj , i = 1, . . . , C W is computed as defined in Eq (3.13) and can be also visualized with the following command-lines:

> w 1 _ ras <-raster ( w 1 ) > extent ( w 1 _ ras ) <-extent ( owin _ cagb ) > plot ( w 1 _ ras , main = " " )

The Fig 3.13 shows that the most important weights are essentially close to the boundaries of the study window. However, note that the weights are in a close range.

The same process for computing lgcp1 wMSE has been adopted for the remaining models LGCP2, LGCP3, LGCP4, LGCP5 and LGCP6. During this process, note that RasterLayer objects lgcp2 pred ras, lgcp3 pred ras, lgcp4 pred ras, lgcp5 pred ras and lgcp6 pred ras have been created just as lgcp1 pred ras. The results are shown in Tab 3.2. The best model to be chosen would be lgcp2 as it has the lowest wMSE value, which is 1.12e-02. However, the models seem to be quite equivalents regarding to their wMSE values.

To assess the performance of each model, the second proposed metric is the R-squared value as defined in Eq (3.17) and recalled below:

R 2 = 1 - C 2 i=1 (n * i -n i ) 2 C 2 i=1 (n -n i ) 2
.

The R-squared values of each model are given in Tab 3.2. The R-squared for lgcp1 is computed as follows:

> lgcp 1 _ pred _ sp <-rasterToPolygons ( lgcp 1 _ pred _ ras ) > lgcp 1 _ pred _ sf <-st _ as _ sf ( lgcp 1 _ pred _ sp ) > st _ crs ( lgcp 1 _ pred _ sf ) <-st _ crs ( obs _ sf ) > lgcp 1 _ pred _ sf <-st _ intersection ( lgcp 1 _ pred _ sf , owin _ cagb ) > lgcp 1 _ pred _ sf <-st _ join ( lgcp 1 _ pred _ sf , obs _ sf , join = st _ covers ) > colnames ( lgcp 1 _ pred _ sf ) <-c ( " pred " , " obs " , " geometry " ) > lgcp 1 _ R 2 <-1 -Metrics :: rse ( lgcp 1 _ pred _ sf $ obs , lgcp 1 _ pred _ sf $ pred ) > lgcp 1 _ R 2
[ 1 ] 0 . 9 1 0 7 2 1 3

First, from the RasterLayer object lgcp1 pred ras, a SpatialPolygonsDataFrame named lgcp1 pred sp has been created in order to be next converted into a sf object lgcp1 pred sf. To do so, the explicit function rasterToPolygons from the package raster has been used. The goal of this conversion was to use the function st intersection from package sf in order to consider only the cells inside the window owin cagb, which definitely means that the R-squared value is written as

R 2 = 1 - C W i=1 (n * i -n i ) 2 C W i=1 (n -n i ) 2
, where C W is the number of cells included in the study window W , equal to 1 362. Then, the observed values containing in obs sf are merged to the fitted values of lgcp1 pred sf with the function st join. The column names are modified for the sake of clarity. Finally, the R-squared metric is computed with the function rse of the package Metrics. The Rsquared value of the final model chosen lgcp1 is 91.07e-02 which literally enables us to say that 91.07% of the predicted values are correlated to the observed values.

The same process used for computing lgcp1 R2 has been also adopted for the remaining models LGCP2, LGCP3, LGCP4, LGCP5 and LGCP6 and the results are given in Tab 3.2. The best model to chose, regarding to the R-squared values, would be LGCP6. However, note that the values are in a close range. Take a look back at the variable selection results given in Section 3.4.2. The maximum R-squared value on the test set was equal to 0.70. This is correct but in practice, the purpose is to have higher R-squared values. This suggested that, possibly, the covariate information was not good enough to explain and/or predict well the road crashes. Hence, this expressed the need to have maybe more informative covariates or maybe, the remaining of explanation percentage is relating to a noise. The Gaussian process in the proposed method LGCP, as it is a latent field, acts actually as a noise, that means, the hazard that can not be explained by the covariates. If we compare the aggregation of Poisson models and the LGCP, the LGCP seems to be more appropriate as the R-squared values are higher.

To conclude, the model that has been chosen and considered as the best one is LGCP3. Indeed LGCP3 has almost the lowest wMSE, really close to LGCP2, but has a higher R-squared value. The model LGCP3 has also shown the best results in the next section.

Confusion matrices

The goal now is to compute the probability that the expected number of accidents per cell is equal to 0 in order to assess if the potential best model lgcp3 predicts correctly the accident occurrences if they were initially observed, as described in Section 3.3.5. Unfortunately it was difficult to compute the predictive distribution given in Eq (3.20) with the functions of the package lgcp. An alternative that can give similar results and possible to be computed is to generate a random Poisson variable with mean the intensity estimate from lgcp3. This can be computed as follows: As seen before with the function VARX, the creation of such a function as pois proba0 is not so obvious. The most important command-line is x <-dpois(0, lambda) which returns the value of the Poisson probability density function. Especially, it will return the probability that the number of events is equal to 0. Note that the Poisson distribution has mean lambda, the intensity estimated from lgcp3. The object lgcp3 proba0 is a 64 × 64 matrix containing the probability that no accident happened in the cells of the computational grid (from a random variable simulated with lgcp2 parameter estimates). Note that other possible simulations could have been generated instead of the ones resulting from the function dpois. For example, it would have been interesting to simulate an inhomogeneous Poisson point process on the study window owin cagb with our intensity estimate coming from lgcp3 as parameter. Instead of probabilities, we would have had counts.

These predicted probabilities are used now to classify the observations and to determine the confusion matrix as defined in Section 3.3.5 and recalled below: The observed values and the probabilities in lgcp3 proba0 will be converted into two classes: 0 for "no accident happened" and 1 for "at least one accident happened". The transformation of observed values into this binary class is simply realized by converting the count values different from 0 to the class 1. However, for classifying the predicted probability values obtained with lgcp3 proba0 into two classes, a decision rule needs to be defined. An observation belongs to the class 0 if its predicted probability is higher than a threshold (to be set in practice), otherwise it belongs to the class 1. True negative and true positive values are respectively the count of predicted classes 0 and classes 1 when it was observed. Then, the false negative and false positive values are respectively the count of predicted classes 0 and classes 1 when it was not the case. In practice, the choice of an ideal threshold may be based on subjective criteria (for example, one can take the threshold equal to 0.5) or by optimization criteria based on quantities computed from the confusion matrix such as the Accuracy or the Sensitivity as defined below.

Several metrics can be derived from the confusion matrix, for example :

• Accuracy: (T P + T N )/(T P + F P + F N + T N ), which is the ratio between the number of correct predictions and the total number of predictions. This metric is useful when false negatives and false positives have similar costs.

• Sensitivity (also called recall ) : T P/(T P +F N ), which is the ratio between the number of true positives and total number of observed positives. This metric is useful when identifying the positives is crucial and hence, the occurrence of false negatives is not wished.

• Specificity: T N/(T N + F P ), which is the ratio between the number of true negatives and the total number of observed negatives. This metric is useful when the goal is to cover all true negatives and hence, the occurrence of false positives is not wished.

• Precision: T P/(T P + F P ), which is the ratio between the number of true positives and the total number of predicted positives. This metric is useful when the occurrence of false positives is not wished.

• F1-Score: 2(Sensitivity • Precision)/(Sensitivity + Precision), which is the harmonic mean of the precision and sensitivity. This metric is useful in a case of imbalanced class distribution, when the cost of false positives and false negatives differs.

A way to assess the performance for the classification problems at various threshold settings is the ROC curve (Receiver Operating Characteristics) from which the metric Area Under The Curve (AUC) is derived. The ROC curve plots the specificity values on the x-axis and the sensitivity values on the y-axis with respect to different threshold values. As to improve the sensitivity you have to decrease the specificity, or vice versa, an ideal model would be the one which allows to improve one of this metric without decreasing the other. The AUC value allows to rate this tradeoff between sensitivity and specificity [START_REF] James | An Introduction to Statistical Learning with Applications in R[END_REF]. Hence, it is also interesting to compute this metric.

We propose to compute the confusion matrix metrics for several threshold values and the AUC result for the model lgcp3. A way to implement it this is as follows:

> # Storing results > threshold <-seq ( 0 . 0 1 , 0 . 9 9 , by = 0 . 0 1 ) > sensi <-rep ( NA , length ( threshold ) ) > speci <-rep ( NA , length ( threshold ) ) > acc <-rep ( NA , length ( threshold ) ) > prec <-rep ( NA , length ( threshold ) ) > f 1 _ score <-rep ( NA , length ( threshold ) ) > k <-1 > for ( t in threshold ) { + # Data wrangling step + tmp <-raster ( lgcp 3 _ proba 0 ) + extent ( tmp ) <-extent ( obs _ ras ) + tmp <-rasterToPolygons ( tmp ) + tmp <-st _ as _ sf ( tmp ) + st _ crs ( tmp ) <-st _ crs ( obs _ sf ) + tmp <-st _ intersection ( tmp , owin _ cagb ) + tmp <-st _ join ( tmp , obs _ sf , join = st _ covers )

AUC values of every model (Tab 3.3). However, note that these values are in a close range. Now, the final values of sensitivity, specificity, accuracy, precision and F1-score depend on the research goal. As seen before, the metrics of the confusion matrix have different interpretations. In our case, the most important one is the sensitivity. Indeed, identify truly where accidents happened is crucial, we do not want to miss a cell where initially accidents happened. There would rather be some extra false positives, which means cells where accidents are supposed to happen but finally not, over saving some false negatives. The results of the metrics regarding to different levels of sensitivity are computed as follows:

> for ( s in c ( 0 . 8 0 , 0 . 8 5 , 0 . 9 0 ) ) { + ind <-which ( sensi >= s ) [ 1 ] + print ( paste ( " Threshold : " , threshold [ ind ]) ) + print ( paste ( " Sensitivity : " , sensi [ ind ]) ) + print ( paste ( " Specificity : " , speci [ ind ]) ) + print ( paste ( " Accuracy : " , acc [ ind ]) ) + print ( paste ( " Precision : " , prec [ ind ]) ) + print ( paste ( " F 1 -Score : " , f 1 _ score [ ind ]) ) + cat ( " \ n " ) + }

[ 1 ] " Threshold : 0 . 8 5 " [ 1 ] " Sensitivity : 0 . 8 0 9 2 1 0 5 2 6 3 1 5 7 8 9 " [ 1 ] " Specificity : 0 . 9 0 2 4 7 9 3 3 8 8 4 2 9 7 5 " [ 1 ] " Accuracy : 0 . 8 9 2 0 7 0 4 8 4 5 8 1 4 9 8 " [ 1 ] " Precision : 0 . 5 1 0 3 7 3 4 4 3 9 8 3 4 0 2 " [ 1 ] " F 1 -Score : 0 . 6 2 5 9 5 4 1 9 8 4 7 3 2 8 2 " [ 1 ] " Threshold : 0 . 8 7 " [ 1 ] " Sensitivity : 0 . 8 5 5 2 6 3 1 5 7 8 9 4 7 3 7 " [ 1 ] " Specificity : 0 . 8 7 5 2 0 6 6 1 1 5 7 0 2 4 8 7 " [ 1 ] " Accuracy : 0 . 8 7 2 9 8 0 9 1 0 4 2 5 8 4 4 " [ 1 ] " Precision : 0 . 4 6 2 6 3 3 4 5 1 9 5 7 2 9 5 " [ 1 ] " F 1 -Score : 0 . 6 0 0 4 6 1 8 9 3 7 6 4 4 3 4 "

[ 1 ] " Threshold : 0 . 9 " [ 1 ] " Sensitivity : 0 . 9 2 7 6 3 1 5 7 8 9 4 7 3 6 8 " [ 1 ] " Specificity : 0 . 8 2 1 4 8 7 6 0 3 3 0 5 7 8 5 " [ 1 ] " Accuracy : 0 . 8 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 " [ 1 ] " Precision : 0 . 3 9 4 9 5 7 9 8 3 1 9 3 2 7 7 " [ 1 ] " F 1 -Score : 0 . 5 5 4 0 2 7 5 0 4 9 1 1 5 9 1 " Three levels for sensitivity values are set: 80%, 85% and 90%. Then, a for loop iteratively identify the threshold value that allows to obtain a minimum sensitivity value equal to the sth element of c(0.80, 0.85, 0.90) using the function which, and then computes the metrics associated. The threshold value starting from which the probabilities values imply the class to be 0 in order to obtain a sensitivity value of 90% is 0.90. Then the sensitivity, specificity, The precision value is 39.50% which seems to be very low. However, remind that we are in a case of imbalanced class, as seen in the beginning of Section 3.4.2. Hence, this result was expected. Indeed, the sensitivity was the metric to improve which implies to promote false positives. Here, the precision value equal to about 40% means that, globally, when a true positive is predicted, one and a half false positives are predicted. But note that in this case, false positives are tolerable. On the other hand, note that the low F1-score value is expected also. Indeed, the F1-score is not so high if one of the measures precision or sensitivity is improved at the expense of the other.

The same process for computing lgcp3 proba0 and hence the metrics sensitivity, specificity, accuracy, precision, F1-score and AUC has been also adopted for the remaining models LGCP1, LGCP2, LGCP4, LGCP5 and LGCP6. This enable us to compare the metric values among all models. The results are given in Tab 3.3. Note that the sensitivity, specificity, accuracy, precision and F1-score values are associated to a threshold that allowed to obtain a minimum sensitivity value of 0.90, as seen previously with the model lgcp3. The best model with respect simultaneously to the sensitivity, specificity, accuracy, precision and F1-score values is LGCP3. However, note that the values are in a close range.

These results are questionable. Indeed, the thresholds for a probability to be converted to the class 0 in order to have, for example, a minimum sensitivity value of 90%, are very high. Is the choice of these threshold values tolerable? If the threshold is set at t = 0.70, which is an equidistant value between the standard threshold t = 0.50 and our threshold t = 0.90, the value of sensitivity, precision, specificity, accuracy and F1-score, for model lgcp3, would be respectively 65.13%, 72.79%, 96.94%, 93.39% and 68.75%.

Results interpretation

Remind that the goals of the whole analysis was to be able, by manipulating road crash data as spatial point pattern, to be confident on saying which geographical zone of the study area is critical and which environment factor is the most dangerous. The statistical model chosen, LGCP, helps us to fulfill these goals. Indeed, a map of predicted probabilities can be produced from the model results in order to easily identify the risky spatial areas. Then, parameter estimates of the covariates in a Poisson model framework also enable to conclude on the risky character of the environment factor, as mentioned in Section 3.3.5.

Riskiest zones of the CAGB

Firstly, we propose to map the probability that the number of events exceeds a given threshold t as defined in Eq (3.22) that we recall:

P Λ(c i ) > t X = E π(Θ|X) I {λ(c i |Θ)>t}
For example, it could be interesting to map the probability that at least one accident happens per cell of the computational grid. This is computed as follows: As seen before, the creation of such functions requiring joint expectations is not so obvious. The most important command-line of this function is the option return which is clearly explicit. The function expectation will use the function exceed to compute the probability that the number of road crashes exceed one. Note that the threshold t (in this case t = 1) should have been incorporated into the function exceed as an argument but was not as it was heavy to do with the package lgcp.

> exceed <-function (Y , beta , eta , Z , otherargs ) { + ca <-diff ( otherargs $ mcens [ 1 : 2 ]) * diff ( otherargs $ ncens [ 1 : 2 ]) + lambda <-ca * + otherargs $ poisson . offset [ 1 : otherargs $M , 1 : otherargs $ N ] + * exp ( matrix ( Z % * % t ( beta ) , otherargs $ M * otherargs $ ext , + otherargs $ N * otherargs $ ext ) [ 1 : otherargs $M , 1 : otherargs $ N ] + Y ) + d <-dim ( lambda ) + return ( matrix ( as . numeric ( lambda >= 1 ) , d [ 1 ] , d [ 2 ]) ) + } > lgcp 3 _
The object lgcp3 ex1 is a 64 × 64 matrix containing the probabilities, per cell, that at least one accident occurred. However, the spatial component that could inform about the geographical location of each observation in the matrix has been lost, as usually with the run of expectation. Hence, as seen many times before, the matrix lgcp3 ex1 will be converted to a RasterLayer object in order to get back the spatial component. The reference spatial object that will be used is, again, obs sf. The whole process is computed as follows:

> lgcp 3 _ ex 1 _ ras <-raster ( lgcp 3 _ ex 1 ) > extent ( lgcp 3 _ ex 1 _ ras ) <-extent ( obs _ sf ) > lgcp 3 _ ex 1 _ sp <-rasterToPolygons ( lgcp 3 _ ex 1 _ ras ) > lgcp 3 _ ex 1 _ sf <-st _ as _ sf ( lgcp 3 _ ex 1 _ sp ) > st _ crs ( lgcp 3 _ ex 1 _ sf ) <-st _ crs ( owin _ cagb ) > lgcp 3 _ ex 1 _ sf <-st _ intersection ( lgcp 3 _ ex 1 _ sf , owin _ cagb )
The matrix lgcp3 ex1 is used to create the RasterLayer object lgcp3 ex1 ras where the extent is coming from obs sf. Then, the RasterLayer object is converted to a sf object named lgcp3 ex1 sf, by transitioning to a SpatialPolygonsDataFrame as it is necessary. The goal of this conversion is to be able to easily use the functions of package sf. Finally, only the cells inside the study window owin cagb are kept with the use of st intersection.

The probabilities contained in lgcp3 ex1 sf are plotted as follows:

> lgcp 3 _ ex 1 _ sf % >% + ggplot () + + geom _ sf ( aes ( fill = layer ) ) + + scale _ fill _ gradient ( low = " # F 5 FAFD " , high = " # AA 2 A 1 0 " , + breaks = c ( 0 , 0 . 5 0 , 1 ) , limits = c ( 0 , 1 ) ) + + coord _ sf ( xlim = c ( 9 0 5 0 0 0 , 9 5 0 0 0 0 ) , + ylim = ( 6 6 6 5 0 0 0 , 6 7 0 5 0 0 0 ) , + crs = st _ crs ( 2 1 5 4 ) , datum = proj _ plot ) + + theme _ bw () + + theme ( panel . grid . major = element _ line ( colour = " black " , + linetype = " dashed " , + size = 0 . 1 ) , + panel . grid . minor = element _ line ( colour = " black " , + linetype = " dashed " , + size = 0 . 1 ) ) + + xlab ( " Longitude " ) + + ylab ( " Latitude " ) + + labs ( fill = paste ( " Probability that at least " , " \ n " , + " one accident occurred " ) )

As lgcp3 ex1 sf is coming from a RasterLayer object, the numeric column attached, containing the probabilities, is named layer. Then, remind that the object proj plot has been set in Section 2.2 in order to specify to the package ggplot2 that the coordinate reference system (CRS) wished for plotting is Lambert 93. Command-lines above generated > lgcp 3 _ ex 1 0 _ sf _ 8 4 <-st _ transform ( lgcp 3 _ ex 1 0 _ sf , crs = 4 3 2 6 ) > max ( lgcp 3 _ ex 1 0 _ sf _ 8 4 $ layer ) > lgcp 3 _ ex 1 0 _ sf _ 8 4 % >% + filter ( layer == max ( layer ) ) % >% + leaflet () % >% + addProviderTiles ( " Esri . WorldImagery " ) % >% + addPolygons ( color = " red " )

[ 1 ] 0 . 9 0 1

The sf object lgcp3 ex10 sf results from the same command-lines that produced lgcp3 ex1 sf, as mentioned previously, in order to compute Fig 3.16. Then, a sf object is created from lgcp3 ex10 sf by converting the CRS to W GS 84, named lgcp3 ex10 sf 84. This step is necessary for using functions from the package leaflet. Finally the riskiest cell, which means the cell with the highest probability that at least ten accidents happen, is plotted using the function leaflet. More particularly, the function addPolygons is used to, as its name implies, add graphics elements and layers to the map. The function addProviderTiles simply adds a tile layer from a known map provider.

The riskiest cell plotted in Fig 3.17 has a probability of 0.90 that more than ten accidents happen. This zone corresponds to an important junction that links a big national road (N 57) and a departmental one (D673), that are roads known to have a high traffic density in the study window. Finally, the latent field Y can be seen as a noise, which means the hazard relating to the road crashes which can not be explained only with the covariate information. Hence, it can be also of interest to plot the probability that the relative risk exceeds a given threshold t defined in Eq (3.23) that we recall:

P exp(Y (c i )) > t X = E π(Θ|X) I {exp(Y (c i ))>t}
The plots of probabilities that the relative risk exceeds t = 2 or t = 5 are computed as follows:

> ep <-exceedProbs ( c ( 2 , 5 ) ) > ex <-lgcp ::: expectation . lgcpPredict ( lgcp 3 , ep ) > par ( mfrow = c ( 2 , 1 ) ) > plotExceed ( ex [[ 1 ]] , ' ep ' , lgcp 2 , asp = 1 , ylab = " " , xlab = " " ) | = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = | 1 0 0 %
First, the function exceedProbs from the package lgcp computes the approximation of the exceedance probabilities for thresholds 2 and 5. Then, as already seen before, the function expectation is used. Finally, to plot these exceedance probabilities, the function plotExceed from the package lgcp is used. The command-lines above produced Fig

3.18.

Riskiest environment factors

In order to identify which factor increases the most the probability that an accident occurs, we look at the estimator of the β parameter as it can be expressed also as a relative The function parsummary from the package lgcp produces a summary table for the model parameters β and η.

The results for β are given in Tab 3.4. As the covariates have been normalized, as mentioned in Section 3.4, each one can be fairly compared. Hence, it is easy to say that the riskiest factor is national length, with median 87.80. Then, in second, third and fourth position there are municipal length, intersection and station with respectively median 26.65, 2.99 and 2.12. The factors prop65 and leisure were not found to be significant (95% CRIs contained both the value 1). In other words, a cell zone where major roads are nationals is risky as it increases the probability that an accident happens, higher than if the major roads were municipals. Then a cell zone where the intersections are in a high number increases also the probability of accident occurrence. Finally, if a cell zone contains one or more stations such as train or taxi stations, the probability is also increased. Note that these results do not conclude that the national or municipal roads, the intersections or the number of stations are the factor that cause accidents. For example, a zone composed of one or more stations is usually a busy area. Hence, the traffic density could possibly be the factor that influences the accident occurrence. density data per day or even per hour of the day).

Focusing on the performances of the model LGCP, we proposed to compute a weighted Mean Squared Error (wMSE), a R-squared value and the confusion matrix in the framework where the number of accidents has been classed into 0 for "no accident happened" and 1 for "at least one accident happened". These metrics enable us to decide which fit among the LGCP fits was the best according to respectively its wMSE, its R-squared value and its performance of predicting well that accidents happened when it was actually the case. On top of these metrics, it would have been interesting to simulate a realization from an inhomogeneous Poisson point process with intensity estimated from our LGCP fits. Then, this point pattern just generated can be compared to the observed road crash point pattern.

To do so, a comparison metric has to be set. I would have enjoyed to focus on this latter proposition of comparison if the time would have allowed it. My first thoughts go to the nearest neighbour distance.

Then, the LGCP models fitted in this chapter are only spatial models. Another direction for further research would be to consider spatio-temporal LGCP as suggested in [START_REF] Taylor | Bayesian inference and data augmentation schemes for spatial, spatiotemporal and multivariate log-gaussian cox processes in r[END_REF]. Unfortunately, due to the thesis time constraints and the fact that a spatio-temporal LGCP is very time costing, this proposition has not been deeply studied. Moreover, in order to drive this kind of spatio-temporal analysis, the main elements were missing: the temporal covariates. Chapter 4 handles traffic density data. However, these data are available only for a very short subset of the CAGB study area: the city of Besançon. We suggest in Chapter 4 to predict the traffic density data by using kriging. In order to adapt the LGCP spatial analysis made here into a spatio-temporal one, it is actually possible to only focus on Besançon city. But we assumed that the use of predicted values based on kriging was not rigorous for this kind of statistical modelling. It could be interesting to collect road traffic density data that are displayed on the apps Google Maps or Waze for example.

Finally, it could have been interesting to combine the goals of Chapter 1 and the goals of this chapter, that means, fit a spatial analysis with a special attention on accident injuries. Several methods can be investigated in order to achieve it. For example, our road crashes point pattern can be modelled by marked point processes that allow to treat labelled point pattern (Baddeley et al., 2015, Section 1.1.3). For example, in our case the road accidents would be labelled as "slight", "serious" and "fatal" as in Chapter 1. On the other hand, we can keep the grid for which we have the accidents located in the cells and the covariates values, and we can set a cell score that is the sum of the injury scores. More precisely if slight, serious and fatal injuries are scored respectively as 1, 2 and 3, a cell where three accidents of each category have occurred would have a final score that is equal to 6. [START_REF] Bao | A spatiotemporal deep learning approach for citywide short-term crash risk prediction with multi-source data[END_REF] have used a similar method as the one described just before.

Supplementary material

We give in this section the supplementary diagnostics needed for validation of the MCMC algorithm and prior distributions.

Markov Chain Monte Carlo diagnostic checks

After running the MCMC algorithm, monitoring methods have to be employed. This include to check that the Markov chain is mixing well and converging. We will follow the steps suggested in [START_REF] Taylor | Bayesian inference and data augmentation schemes for spatial, spatiotemporal and multivariate log-gaussian cox processes in r[END_REF] based on widely used graphical methods for MCMC convergence diagnosis.

An empirical approach to convergence control is the trace plot, which is a time series plot that shows the realizations of the Markov chain at each iteration. This graphical method is used to visualize the Markov chain in order to detect deviant or non-stationary behaviors.

The trace plots for the parameters β and η are computed as follows:

> traceplots ( lgcp 3 )

To produce the trace plots for the parameters β and η, the function traceplots from the package lgcp is used. The trace plot of parameter σ is shown in Fig 3 .19. The plot looks satisfactory as it shows random scatter around a mean value between 0.9 and 1.2 (approximatively). The reader may find all the trace plots in Appendix B. The autocorrelation plots can also be used in order to check the mixing of the chain. These are plots that graphically summarize the strength of a relationship between an observation in a time series with observations at prior time steps, called lags. Note that there are little autocorrelation in these plots but this is very slight. These plots are still satisfying. To completely avoid this case, it is suggested to run again the algorithm for a longer period of time.

The diagnostic checks performed allow to check that the Markov Chain was mixing well and has converged. As these monitoring steps have been established satisfactory, the best chosen model lgcp3 can be used to make inferences.

Prior and posterior distributions

Finally, it also of interest to make visual assessment of prior and posterior distributions, in order to graphically visualize how the posterior distribution acts relating to the prior While the covariate effects β seem to be well identified by the data, the priors for the parameters η are not so close to the data. This tended to be not so well identified, the reader can find similar results in [START_REF] Taylor | Bayesian inference and data augmentation schemes for spatial, spatiotemporal and multivariate log-gaussian cox processes in r[END_REF] or [START_REF] Ramírez | Spatiotemporal correlation study of traffic accidents with fatalities and injuries in bogota (colombia)[END_REF] for example.

Chapter 4

Road accident space and time preliminary analyses of the city of Besançon1

Linear network, kriging and Generalized Additive Models

In order to prevent and/or forecast road accidents, the statistical modelling of spatio-temporal dependence and potential risk factors is a major asset. The focus in the following is on the road accidents located in space and time. A short descriptive statistical study on the road network where the accidents happened has been developed. Then, the road traffic density has been used in a geostatistical framework in order to simulate a road crash point pattern that lies on the road network. This simulated point pattern has been merged to the road crash point pattern observed in order to be analysed into space and time in an epidemiological adapted framework known as case-control study. The spatio-temporal statistical modelling method used here is the Generalized Additive Model. This work aims at giving first exploratory space and time analyses, based on the road accident data that occurred between 2017 and 2019 in the city of Besançon.

Introduction

Chapter 3 focused on giving a spatial analysis of road crash data from the CAGB, urban community of Besançon. The method of log-Gaussian Cox processes has been used in order to fulfill the main goals that were : highlight the most critical zones of the CAGB and identify the riskiest accident factors. The final goal now is to perform spatio-temporal analyses. Remind that in Chapter 1, we explored some temporal components that were associated to the road accident data from the region of Franche-Comté. The results of the Multiple Correspondence Analysis and the ordinal logistic regression models show that the time components and the road crash injury were dependent. However, these temporal components were handled as categorical variables. Hence, the focus of this chapter is to analyse, this time, the road accident point pattern into a space and time framework with suitable spatio-temporal statistic tools. The analysis proposed here is inspired by common techniques used in the analysis of spatially-referenced case-control data in epidemiology. Our road crash data represent the cases in the study and "no crash data" represent the group of controls. Unfortunately, the group of controls is missing in our study so we propose to proceed with a simulation of the controls. Once the group of controls has been generated, we are interested in predicting the probability for a point location to be a case by considering semiparametric models based on environment characteristics into space and time. More precisely, the final goal is to identify the critical zones of the city of Besançon according to the time.

As the goal now is focused on the spatial and temporal components of our road crashes point pattern, we begin by exploring the temporal characteristics of the data. Then, a huge pre-processing work for the fitting of semiparametric models is presented in the following sections. The motivation of this pre-processing work is the simulation of the group of controls. The group of controls has to be simulated on the road network. Hence, the first part of the pre-processing tries to introduce the notion of linear networks and how to handle point patterns on a linear network. Then, the group of controls can be simulated according to a given quantity. The second part of the pre-processing work is focused on the manipulations of the traffic density data on which the simulation of the controls will be based. As our traffic density data are sparse data, the method of kriging is used in order to extrapolate these data beyond the observed locations. Finally a semiparametric space and time analysis is fitted, inspired from Generalized Additive Models, with the aim of estimating the probability of being a case, into space and time.

Similarly as Chapter 2 and Chapter 3, this chapter details the manipulations and implementations of specific statistical tools for spatial and temporal modelling from the software R (R Core Team, 2021) used for this exploratory analysis.

The following librairies will be used :

> library ( areal ) > library ( gstat ) > library ( ggplot 2 ) > library ( leaflet ) > library ( lubridate ) > library ( maptools ) > library ( mgcv ) > library ( raster ) > library ( sf ) > library ( sp ) > library ( spatstat ) > library ( tidyverse ) R packages areal [START_REF] Prener | areal: Areal Weighted Interpolation[END_REF], leaflet [START_REF] Cheng | leaflet: Create Interactive Web Maps with the JavaScript[END_REF], maptools [START_REF] Bivand | maptools: Tools for Handling Spatial Objects[END_REF], raster [START_REF] Hijmans | raster: Geographic Data Analysis and Modeling[END_REF], sf (Pebesma et al., 2022), sp [START_REF] Pebesma | sp: Classes and Methods for Spatial Data[END_REF] and spatstat [START_REF] Baddeley | spatstat: Spatial Point Pattern Analysis, Model-Fitting[END_REF] are tools for spatial data. The packages gstat [START_REF] Pebesma | gstat: Spatial and Spatio-Temporal Geostatistical Modelling, Prediction and Simulation[END_REF] and mgcv [START_REF] Wood | mgcv: Mixed GAM Computation Vehicle with Automatic Smoothness Estimation[END_REF] are packages used respectively to do kriging and to fit GAMs. Finally ggplot2 [START_REF] Wickham | ggplot2: Create Elegant Data Visualisations Using the Grammar of Graphics[END_REF], lubridate [START_REF] Spinu | Multivariate statistical analysis for exploring road crash-related factors in the Franche-Comté region of France[END_REF] and tidyverse [START_REF] Wickham | tidyverse: Easily Install and Load the 'Tidyverse[END_REF] are used respectively for plot, data wrangling basic operations and handling dates.

The current chapter is structured as follows. Section 4.2 gives descriptive analyses of the spatio-temporal data of the road crashes point pattern of the city of Besançon. Section 4.3 is focused on the generation of the group of controls, based on short road network analyses and traffic density data predicted by kriging. Then Section 4.4 described the semiparametric statistical modelling and its results.

Space and time descriptive analyses of Besançon road crashes

The purpose of this analysis is to describe the space and time components of the road crash point pattern of the city of Besançon. Chapters 2 and Chapter 3 have only focused until now on the spatial characteristics of these accidents. Before modelling the road crash point pattern in a space and time framework, this subsection will focus on handling such spatio-temporal data in the software R and describing globally the point pattern in space and time.

First, a new dataframe is loaded that corresponds to the road crashes point pattern of Besançon with the date of the accident occurrence associated : > bes <-read _ csv ( " DATA / bes . csv " ) > head ( bes ) > class ( bes $ date ) date latitude longitude ------------------------------------------------3 janvier 2 0 1 7 1 9 h 4 6 : 0 0 4 7 . 2 4 5 0 8 6 . 0 2 3 5 0 7 janvier 2 0 1 7 0 4 h 1 2 : 0 0 4 7 . 2 4 2 6 7 6 . 0 2 5 7 4 1 5 janvier 2 0 1 7 1 0 h 1 3 : 0 0 4 7 . 2 4 4 3 3 6 . 0 0 4 6 0 2 7 janvier 2 0 1 7 1 2 h 2 0 : 0 0 4 7 . 2 2 5 3 5 5 . 9 7 8 9 9 1 2 f é vrier 2 0 1 7 0 3 h 3 4 : 0 0 4 7 . 2 6 2 5 6 6 . 0 4 5 1 4 1 5 f é vrier 2 0 1 7 1 7 h 1 0 : 0 0 4 7 . 2 2 1 1 3 5 . 9 6 6 6 7

[ 1 ] " character "

The dataframe is composed of three columns: date, latitude and longitude. The first column corresponds to the date of the accident: the day, the month, the year and the time with hours, minutes and seconds. The coordinate reference system (CRS) used for the coordinates is W GS84. The first step is to specify to the software that the column date has to be handled in a date-time class. The class used in this study is POSIXct, which stores both date and time (contrary to the class date that is only a date class). A similar class as POSIXct is POSIXlt, the difference is that the class POSIXlt stores the hours, minutes, seconds, day, month and year separately. The transformation of date is computed as follows: > bes _ sf <-st _ as _ sf ( bes , coords = c ( " longitude " , " latitude " ) , crs = 4 3 2 6 ) > bes _ sf <-st _ transform ( bes _ sf , crs = 2 1 5 4 ) > class ( bes _ sf $ date )

[ 1 ] " POSIXct " " POSIXt " the week. Hence, it is interesting to look at the road crashes point pattern in space and time with the time component decomposed into week and weekend. Indeed for example, one can ask if road crashes can be more abundant in some locations according to if they happened during the week or the weekend. This can be visualized as follows:

> tmp <-bes _ sf % >% + mutate ( day = factor ( weekdays ( date ) , levels = d _ levels , + week = ifelse ( day % in % c ( " Saturday " , " Sunday " ) , + " weekend " , " week " ) , + year = year ( date ) ) Similarly as the previous plot, the road crash point pattern can be visualized according to the trimester of the year. This is computed as follows:

> tmp <-tmp % >% + mutate ( quarter = factor ( quarters ( date ) , levels = q _ levels ) ) This section gives descriptive analyses of the space and time road crashes point pattern of Besançon and enables to make assumptions on the potential temporal component that could influence these accident occurrences. Before fitting the space and time analysis in order to confirm a potential temporal effect, some elements are missing. The next section corresponds to the solution that we proposed to theses issues and is defined as pre-processing.

Spatio-temporal analysis pre-processing : simulation of the controls

In order to build a spatio-temporal analysis, we propose to adapt the case-control studies used in a classical epidemiological framework to our road accident study. This case-control study is designed to determine if an exposure is associated with an outcome. This can be described as follows : first, identify the cases (group known to have the outcome) and the controls (group known to be free of the outcome) ; then, look back in time to learn which subjects in each group had the exposure. In our case of road crashes, the recorded accident locations are the cases, the controls would be simulated locations in the study window and the potential exposure would be an environment characteristic such as road infrastructures for example.

The motivation of the following section is the simulation of the group of controls, as it is missing in the case-control study framework that we wish to adapt. The controls will be a point pattern in the study window. The question is then : how should we simulate the group of controls? Firstly, the controls in the framework of case-control studies can be potentially considered as the cases. Indeed, the goal of the modelling is to estimate the probability of being a case. Hence, the group of controls has to be simulated on the road network. Secondly, the points will be simulated according to the traffic density data. However, the available traffic data are sparse. Hence, we propose to extrapolate the data beyond the observed locations using kriging.

The following section introduces the notion of linear networks and what point patterns on linear networks. Then, a brief introduction to kriging is given, followed by the fit of this method on the traffic density data. Finally, in the end of this section, we generate several point patterns on the road network according to the traffic density data and hence form the group of controls.

Point processes on linear networks

This section aims at giving solutions on how to handle the road network by using the software R and especially, the road crashes point pattern of the city of Besançon on the road network. The road network is categorized as a linear network in the field of spatial statistics. A network can be railways, rivers or the work way of a worm. Baddeley et al. (2021a) gave many example of spatial point patterns on networks such as reported crimes in a neighbourhood, positions of spider webs on a urban brick wall or locations of spines of a neuron. The first strategy undertaken in order to analyse point patterns on a linear network is to adapt, if it is possible, the statistical tools already existing for point patterns in two dimensional space for the new setting of a linear network. An example of kernel estimation is given in the following that enables to make hypotheses on the riskiest road segments of the city of Besançon.

Linear network basics

Following [START_REF] Baddeley | Spatial Point Patterns: Methodology and Applications with R[END_REF], a linear network, denoted by L, is defined as

L = N i=1 l i , (4.1)
where l i are line segments and N < ∞ is the number of segments. Line segments

l i are set to [u i , v i ] = {ω : ω = tu i + (1 -t)v i , 0 ≤ t ≤ 1} where u i , v i ∈ R 2 are the vertices of l i .
Line segments meet themselves only at their endpoints. In the case where two road cross each other, each road is splitted into segments that end at the meeting-point which is a vertex of the network. The number of segments which exit from each vertex is referred to as the degree of that vertex.

The most common distance measure used between any two points u and v in the network L is the shortest-path distance. A path between two points u and v is defined to be a sequence x 0 , x 1 , . . . , x p of points in L with x 0 = u, x p = v and [x i , x i+1 ] ⊂ L. The shortest path distance is simply the minimum of the lengths of all paths from u to v, where the length of a path is the sum of the Euclidean distances between each points of the sequence x 0 , x 1 , . . . , x p .

We take the sf object road sf which is the road network of the CAGB used in Chapter 2. First, we keep only the road network that is inside the city of Besançon as follows:

> st _ crs ( road _ sf ) <-st _ crs ( owin _ bes _ sf ) > road _ sf <-st _ intersection ( road _ sf , owin _ bes _ sf )

The road network can be visualized with the package leaflet as follows:

> road _ sf _ 8 4 <-st _ transform ( road _ sf , crs = 4 3 2 6 ) > leaflet () % >% + addTiles () % >% + setView ( lng = 6 . 0 2 5 4 9 0 , lat = 4 7 . 2 3 6 1 6 8 , zoom = 1 5 ) % >% + addPolylines ( data = road _ sf _ 8 4 , + color = " black " , + opacity = 0 . 7 5 , + weight = 1 )

Remind that the creation of the sf object road sf 84, by converting the CRS to W GS 84, was required for using functions from the package leaflet. Command-lines above, by switching values of attribute zoom, produced Our purpose now is to describe how networks are handled in the software R. As for point patterns that have their own classes such as ppp, linear networks can also be manipulated in a specific class named linnet. An object of this class represents a linear network of straight line segments and contains information about each segment, vertex and connectivity of the network. The creation of such an object with our road network is as follows:

> road _ sp <-as ( road _ sf , ' Spatial ') > road _ linnet <-as . linnet . SpatialLines ( road _ sp ) First an object SpatialLines, collection of polygonal lines, is created from road sf in order to use the function as.linnet.SpatialLines from the package maptools that, as its name implies, converts such an object into an object of class linnet. Note that different methods exist for creating linnet objects such as for example the function linnet, that creates a linear network from vertices given by a ppp object. The object road linnet is composed of 34 665 vertices and 36 161 lines.

Point patterns on linear networks

A point pattern on a linear network L is a finite collection of points X = {x 1 , . . . , x n } of R 2 where each x i represents a location on L. As mentioned in Chapter 3 Section 3.2.1, the point process reference models are usually assumed to be stationary and isotropic. However, these assumptions in a point process framework on a linear network are difficult to stand. Indeed, a linear network is not a homogeneous space as there is no guarantee that points will still live on the underlying network after applying some transformations and/or rotations [START_REF] Baddeley | Spatial Point Patterns: Methodology and Applications with R[END_REF].

To specify in the software R that a given point pattern lies on an network, the class lpp stands. An object of this class contains information such as the linear network, the spatial coordinates of the points and other kind of coordinates that specify which line segment of the network contains the point and the position of the point along this segment (between 0 and 1 where 0 corresponds to the first endpoint and 1 the second one).

Before creating an object of class lpp, it is interesting to visualize the point pattern and the network simultaneously. > bes _ ppp <-as . ppp ( st _ coordinates ( bes _ sf ) , owin _ bes ) > bes _ lpp <-lpp ( bes _ ppp , road _ linnet ) > tmp <-as . data . frame ( cbind ( bes _ lpp $ data $x , bes _ lpp $ data $ y ) ) > tmp <-st _ as _ sf ( tmp , coords = c ( " V 1 " , " V 2 " ) , crs = 2 1 5 4 ) > tmp <-st _ transform ( tmp , crs = 4 3 2 6 ) > leaflet () % >% + addTiles () % >% + setView ( lng = 6 . 0 2 5 4 9 0 , lat = 4 7 . 2 3 6 1 6 8 , zoom = 1 7 ) % >% + addPolylines ( data = road _ sf _ 8 4 , + color = " black " , + opacity = 0 . 7 5 , + weight = 1 ) % >% + addCircleMarkers ( data = tmp , + weight = 1 , + radius = 3 , + fillOpacity = 1 , + color = " blue " )

The final step was to create a ppp object from bes sf and to associate it to the linnet object road linnet with the function lpp from the package spatstat. Then, in order to visualize it with the package leaflet similarly as in Point pattern on linear network 2 9 6 points Linear network with 3 4 6 6 5 vertices and 3 6 1 6 1 lines Total length 6 5 5 8 3 0 . 7 units Average intensity 0 . 0 0 0 4 5 1 3 3 6 points per unit length Unmarked Enclosing window : rectangle = [ 9 2 2 5 7 1 . 8 , 9 3 2 9 4 0 . 5 ] x [ 6 6 8 2 2 3 0 , 6 6 9 5 0 9 3 ] units

The call of summary gives information about the point pattern on the linear network such as the number of events, that are 296, or the average density points per unit length. The first property that should be investigated from this point pattern on the network is the intensity of the underlying point process.

Intensity of a point process on a linear network

Let X = {x 1 , . . . , x n } be a point pattern on a linear network L. A point process X on a linear network L has homogenous intensity λ if

E[n(X ∩ B)] = λ (B) (4.2)
where (B) denotes the total length of subset B ⊆ L and n(X ∩ B) denotes the number of points of X that fall in B. Note that λ represents now the expected number of points per unit length of network. The homogeneous Poisson process on a linear network is defined similarly as the one in two dimensions defined in Section 3.2 where the property HPP1 is simply replaced with Eq 4.2.

Alternatively, a point process X on a linear network L has inhomogeneous intensity function λ(u) defined at all locations u on L if

E[n(X ∩ B)] = L λ(u)d(u), (4.3)
where du denotes integration with respect to arc length and B ⊆ L a subset. Here λ(u) represents the expected number of points per unit length of network, in the vicinity of location u. Note also that the inhomogeneous Poisson process on a linear network is defined similarly as the one in two dimensions defined in Section 3.2.2 where the property IPP1 is simply replaced with Eq 4.3.

In practice, the purpose of point pattern analysis is the estimation of the spatially varying density of events. Intensity functions of inhomogeneous point processes can be estimated non-parametrically with kernel smoothing. Whereas these methods were simple for spatial point pattern data in two dimensions, as briefly introduced in Section 3.2.3, kernel estimation on a linear network is mathematically and computationally difficult (Baddeley et al., 2021a).

Various kernel smoothing techniques have been proposed, [START_REF] Baddeley | Spatial Point Patterns: Methodology and Applications with R[END_REF] suggested that the method of choice is the equal-split continuous [START_REF] Okabe | A kernel density estimation method for networks, its computational method and a gis-based tool[END_REF]. However, as mentioned above, algorithms of kernel estimation are computationally challenging and timely consuming. Hence, we follow [START_REF] Rakshit | Fast kernel smoothing of point patterns on a large network using twodimensional convolution[END_REF] and estimate the intensity with the method of convolution kernel estimation, which can be computed rapidly using the socalled Fast Fourier Transform computation algorithm. The convolution kernel estimator of the inhomogeneous intensity λ(•) is defined as

λ(u) = 1 c(u) n i=1 κ(u -x i ), u ∈ L ⊂ R 2 , (4.4)
where κ(•) is the smoothing kernel and c(u) = L κ(v -u)dv is the convolution of the kernel κ with the arc-length measure on the network. More particularly, the kernel κ is a function of two spatial locations u and v, u, v ∈ R 2 , in contrast to spatial point pattern in two dimensions where for example the kernel estimator given in Eq 3.2 in Section 3.2.3 was a function of the distance between u and v.

An estimation of the intensity function of bes lpp with the convolution estimator can be obtained as follows:

> smoothing _ band <-bw . scott ( bes _ lpp ) > opt _ density <-densityQuick . lpp ( bes _ lpp , sigma = smoothing _ band ) > plot ( opt _ density , main = " )

It is difficult to choose suitable bandwidth values when dealing with linear networks. Few methods are available to set these values. We used Scott's rule [START_REF] Rakshit | Fast kernel smoothing of point patterns on a large network using twodimensional convolution[END_REF] to determine the smoothing bandwidth by computing the function bw.scott from the package spatstat. Then, the estimation is computed with the function densityQuick from spatstat, it returns an object of class linim which represents a pixel image on the linear network. Besançon. We propose now to compute the density estimation again in order to better visualize the situation in Besançon city centre. The creation of a SpatialPolygons object, focused on the city centre of Besançon, is as follows: > x <-c ( 9 2 8 0 0 0 , 9 2 8 0 0 0 , 9 2 9 5 0 0 , 9 2 9 5 0 0 , 9 2 8 0 0 0 ) > y <-c ( 6 6 8 7 0 0 0 ,6 6 8 5 5 0 0 ,6 6 8 5 5 0 0 ,6 6 8 7 0 0 0 ,6 6 8 7 0 0 0 ) > centre _ sp <-cbind (x , y ) > centre _ sp <-Polygon ( centre _ sp ) > centre _ sp <-Polygons ( list ( centre _ sp ) , 1 ) > centre _ sp <-SpatialPolygons ( list ( centre _ sp ) ) > centre _ sp@proj 4 string <-CRS ( " + init = epsg : 2 1 5 4 " ) > centre _ sp <-spTransform ( centre _ sp , CRSobj = CRS ( " + init = epsg : 4 3 2 6 " ) ) > centre _ sf <-st _ as _ sf ( centre _ sp ) > centre _ sf % >% + leaflet () % >% + addProviderTiles ( " Esri . WorldImagery " ) % >% + addPolygons ( color = " red " )

First, the coordinates of the polygon vertices are set in x and y in order to form a SpatialPolygons object centre sp with the functions Polygon and Polygons from spatstat. The coordinates are given in Lambert93, hence the CRS 2154 is specified in the attribute proj4string of centre sp. In order to visualize with leaflet, the CRS is transformed to W GS84 and a sf object from centre sp is created. Command-lines above produced Now that a new smaller study window has been chosen, the next step is to intersect the point pattern of Besançon road crashes and the road network both with the new window, and then follow each step of the kernel estimation similarly as above. This is done as follows: It is of interest to overlay this intensity estimation on the map of Besançon city centre. To do so, the linim object density centre has to be transformed into a sf object. This is done as follows:

> extent ( d _ centre _ ras ) <-extent ( centre _ sp ) > d _ centre _ sp <-rasterToPolygons ( d _ centre _ ras ) > d _ centre _ sp@proj 4 string <-CRS ( " + init = epsg : 2 1 5 4 " ) > d _ centre _ sp <-spTransform ( d _ centre _ sp , + CRSobj = CRS ( " + init = epsg : 4 3 2 6 " ) ) > d _ centre _ sf <-st _ as _ sf ( d _ centre _ sp ) > pal <-colorNumeric ( palette = " Blues " , domain = d _ centre _ sf $ layer ) > d _ centre _ sf % >% + leaflet () % >% + addProviderTiles ( " Esri . WorldImagery " ) % >% + addPolygons ( fillOpacity = 0 . 5 , weight = 0 . 5 , color = ~pal ( layer ) )

The steps from a linim object to a sf proposed here is the transitions to RasterLayer objects, as seen in Section 3.5.2, and SpatialPolygonsDataFrame. The sf object d centre sf is composed of polygons that were pixels of density centre. Finally, we set the colors to the color palette Blues for the sake of clarity on the map. Command-lines above produced

Kriging

The purpose of this chapter is to perform space and time analyses of the road crashes point pattern of the city of Besançon. The goal of such a study is to obtain relevant temporal information that is related to road crashes. An important related factor in this case is the traffic density. For example [START_REF] Tang | Improving the transferability of the crash prediction model using the TrAdaBoost.R2 algorithm[END_REF] used the average traffic volume per lane as a covariate in their supervised method named TrAdaBoost.R2, [START_REF] Ma | Long short-term memory neural network for traffic speed prediction using remote microwave sensor data[END_REF] also used the traffic volume as covariate in order to fit a long short term memory neural network for road accident analysis and [START_REF] Park | Real-time prediction and avoidance of secondary crashes under unexpected traffic congestion[END_REF] used the traffic congestion in a gradient boosted decision trees model to analyse road crashes data. During this thesis, we tried to get such information. Thanks to the Direction Départementale des Territoires (DDT) of Doubs department and the Grand Besançon Metropole (CAGB), under confidentiality agreements, traffic density data has been made available. The mobility and transportation ministries set meters that record the number of vehicles crossing at fixed locations in Besançon during one week of the year. Data recorded during this week are considered to be constant over the year and are then used in order to get information about the annual average daily traffic for example.

However, the traffic density is available only at some locations in the city of Besançon and represent a sparse sample data. Hence, it would be difficult to use this information into a spatio-temporal analysis. However, this information still remains important in the road accident framework. The space and time framework analysis proposed in this chapter is inspired from case-control studies in order to identify the critical zones of Besançon into space and time. The statistical modelling that will be fitted further will enable to estimate the probability of controls being a case. This last state suppose that a control can potentially be considered as a case. Hence, the traffic density will be used for the simulation of the group of controls as it is a relevant information for road accidents.

First, the traffic density data are loaded as follows:

> traffic <-read _ delim ( " DATA / traffic . csv " , + delim = " ; " , escape _ double = FALSE , trim _ ws = TRUE ) > head ( traffic ) latitude longitude year tmja - -----------------------------------4 7 . 2 2 0 6 3 5 . 9 7 8 2 7 2 0 1 7 1 2 5 0 9 4 7 . 2 6 0 6 4 6 . 0 4 7 7 1 2 0 1 7 1 3 2 7 6 4 7 . 2 4 8 4 1 6 . 0 2 9 9 2 2 0 1 7 9 5 0 6 4 7 . 2 5 0 8 5 6 . 0 3 4 1 4 2 0 1 7 1 2 6 9 6 4 7 . 2 5 6 4 8 6 . 0 2 0 6 8 2 0 1 7 2 4 2 1 7 4 7 . 2 6 3 3 6 6 . 0 4 3 3 5 2 0 1 7 2 0 2 3 6

The column containing the traffic density is tmja which stands for traffic journalier moyen annuel which means the annual average daily traffic. The traffic density data have been collected during 2017 and 2019 in the city of Besançon.

As traffic density data are sparse, the idea is to extrapolate beyond the observed locations and to predict the traffic density on a given zone (that will be set further). Such method is part of the field of geostatistics. Geostatistics consist in making maps of the quantities of interest, such as the traffic density values, for a larger area than the finite numbers of locations where it has been recorded. That means, predictions in places where we do not have available data. The geostatistical method of prediction is known as kriging. It is assumed that the sparse sample data are realizations of an underlying stochastic process. Let t(u i ) denotes the traffic values at observation points u i , i = 1, . . . , n. The process T = {T (u) : u ∈ D ⊂ R 2 } that generated these values can be decomposed as

T (u i ) = m(u i ) + Y (u i ) + (u i ), i = 1, . . . , n, (4.5)
where Y is a zero mean Gaussian process and ∼ N (0, σ 2 ). The component m(u i ) can be specified by a regression term as

p j=1 z j (u i )β j ,
where z j (u i ) is the measure of the jth covariate at u i and β j the associated effect. This case in geostatistics is referred as universal kriging. The goal is to kriging our traffic density data. A related information is the air pollution [START_REF] Dekoninck | Correlating traffic data, spectral noise and air pollution measurements: Retrospective analysis of simultaneous measurements near a highway in the netherlands[END_REF]. In the case of our geostatistical model includes this covariate, we would need to know the values of air pollution at each of the prediction locations in order to be able to predict the traffic density. The air quality index, for the city of Besançon, is provided by the organization ATMO Bourgogne-Franche-Comté. However, such data are recorded at only two fixed locations. Hence, this relevant information related to the traffic density can not be used. On the other hand, exploratory correlation analyses have been made in order to find if traffic density data are correlated (in some sense) to another continuous information such as the population for example, for which we do have the data at all the locations. However these analyses did not give significant results.

As no covariates are available, the component m(•) can be specified simply as m, which is a special case of universal kriging where the p-vector of covariates is z(•) = 1 with p = 1 and β = m ∈ R unknown. This specification is known as ordinary kriging.

The Gaussian process Y in Eq 4.5 is usually assumed to be a second order stationary Gaussian process, which means that ∀u, h

∈ D ⊂ R 2 : E[Y (u)] = 0 Cov(Y (u), Y (u + h)) = C Y (h) Cov(Y (u), Y (u + 0)) = C Y (0) = Var(Y (u)) = σ 2 Y ≥ 0, (4.6)
and intrinsic which means that ∀u, h ∈ D : 4.5. The following expressions are straightforward (Cressie, 1993, Chapter 3)

E[Y (u + h) -Y (u)] = 0 Var(Y (u + h) -Y (u)) = 2γ Y (h). ( 4
, h ∈ R 2 : γ T (h) = γ Y (h) + σ 2 I {h =0} C T (h) = C Y (h) + σ 2 I {h=0} .
where γ T (h) and C T (h) denote respectively the semivariogram and the covariance function of the process T . An appropriate estimation of γ Y (•) is the empirical semivariogram (Cressie, 1993, Chapter 3) given by

γ * T (h) = 1 2n(h) n(h) i=1 [t(u i + h) -t(u i )] 2 ,
where t(u i + h) and t(u i ) are observed values of T at locations u i and u i + h and n(h) is the number of paired comparisons at lag h.

A wide range of theoretical models for semivariogram and corresponding covariance functions have been proposed (Cressie, 1993, Chapter 2). The model that will be fitted further is the Gaussian semivariogram model given by

γ T (h) = σ 2 + σ 2 Y [1 -exp(-h φ ) 2 ] h > 0 0 otherwise. ( 4.8)
The shape of semivariogram models, such as the one given above, is specified basically by three parameters σ 2 , σ 2 + σ 2 Y and φ respectively called the nugget, the sill, and the range. The value obtained by subtracting the nugget from the sill is called the partial sill.

The semivariogram is the cornerstone of kriging. Indeed, we predict T at any new points u 0 by

T (u 0 ) = n i=1 ω i t(u i ),
where the weights ω i are made to sum to 1, n i=1 ω i = 1, and depend on the semivariogram γ T . For more details see (Cressie, 1993, Chapter 3).

Remind that the framework proposed here is to adapt the case-control study to our situation. As the group of controls is missing, we proposed to generate it based on the road network and the traffic density data. The latter data, as they are sparse, will be predicted using kriging. The aim of the case-control study that will be fitted further in Section 4.4 is to perform a space and time analysis. For each timed case, one (or more) control has to be set on the same date(in order to eliminate confounders at the design stage). Hence, we propose to do kriging for traffic density values per year. The steps are as follows : plot the empirical semivariogram ; fit the Gaussian semivariogram model ; kriging.

The year 2017 will be taken as example for R command-lines in the following. The first step is to transform traffic data into a SpatialPolygonsDataFrame as follows:

> traffic _ 2 0 1 7 <-traffic % >% + filter ( year == 2 0 1 7 ) % >% + dplyr :: select ( -year ) > traffic _ 2 0 1 7 _ sp <-traffic _ 2 0 1 7 > coordinates ( traffic _ 2 0 1 7 _ sp ) = ~longitude + latitude > proj 4 string ( traffic _ 2 0 1 7 _ sp ) <-CRS ( " + init = epsg : 4 3 2 6 " ) > traffic _ 2 0 1 7 _ sp <-spTransform ( traffic _ 2 0 1 7 _ sp , + CRS ( " + init = epsg : 2 1 5 4 " ) )

Then the empirical semivariogram is obtained as follows:

> traffic _ 2 0 1 7 _ sp@data <-traffic _ 2 0 1 7 _ sp@data % >% + mutate ( tmja = sqrt ( tmja ) ) > spplot ( traffic _ 2 0 1 7 _ sp , " tmja " ) > vg _ 2 0 1 7 <-variogram ( tmja ~1 , data = traffic _ 2 0 1 7 _ sp ) > plot ( vg _ 2 0 1 0 , pch = 4 , cex = 0 . 5 ) The final step now is to do the kriging. Before fitting this method, an output grid has to be set onto which the traffic density values will be predicted. The construction of a regular grid covering the observation window owin bes sf is as follows:

> extent ( owin _ bes _ sf ) > x <-seq ( 9 2 1 0 3 4 , 9 3 4 4 3 4 , by = 1 0 0 ) > y <-seq ( 6 6 8 2 1 3 3 , 6 6 9 5 5 3 3 , by = 1 0 0 ) > pred _ grid <-expand . grid (x , y ) > pred _ grid <-SpatialPixels ( SpatialPoints ( pred _ grid ) ) > proj 4 string ( pred _ grid ) <-CRS ( " + init = epsg : Given the extent of the window owin bes sf and the wish to predict the traffic density per cell of 100 × 100 meters, the extent of the grid are set as from 921 034 to 934 434 and from 6 682 133 to 6 695 533, respectively longitude and latitude values.

Then, the grid is created using the functions expand.grid, SpatialPoints and SpatialPixels that respectively creates a data frame from all combinations of the vectors x and y, creates objects of class SpatialPoints and defined a spatial grid from the points as a SpatialPixels object which has a GridTopology object in its list of attributes. The class SpatialPixels is a class for defining a pixels, forming a possibly incomplete rectangular grid of arbitrary dimension. On the other hand, the class GridTopology is a class for defining a rectangular grid of arbitrary dimension. Both are classes of the package sp. The overlay of the window owin bes sf on the grid pred grid is computed as follows:

> pred _ grid _ sf <-st _ as _ sf ( pred _ grid ) > st _ crs ( pred _ grid _ sf ) <-st _ crs ( owin _ bes _ sf ) > ggplot () + + geom _ sf ( data = predictgrid _ sf , color = ' black ' , size = 0 . 0 5 ) + + geom _ sf ( data = owin _ bes _ sf , color = ' red ' , fill = NA ) + + coord _ sf ( xlim = c ( 9 1 5 0 0 0 , 9 4 0 0 0 0 ) , + ylim = c ( 6 6 8 0 0 0 0 , 6 6 9 7 0 0 0 ) , + crs = st _ crs ( 2 1 5 4 ) , datum = proj _ plot ) + + theme _ bw () + + theme ( panel . grid . major = element _ line ( colour = " black " , linetype = " dashed " , size = 0 . 1 ) , + panel . grid . minor = element _ line ( colour = " black " , linetype = " dashed " , size = 0 . 1 ) ) + + xlab ( " Longitude " ) + + ylab ( " Latitude " ) As the grid pred grid onto which the traffic density values will be predicted has been created, we are now in position to perform the kriging. This is done as follows:

> k _ 2 0 1 7 <-krige ( tmja ~1 , + traffic _ 2 0 1 7 _ sp , + pred _ grid , + model = vgfit _ 2 0 1 7 ) > k _ 2 0 1 7 @data $ var 1 . pred <-k _ 2 0 1 7 @data $ var 1 . pred ^2 > spplot ( k _ 2 0 1 7 , " var 1 . pred " )

[ using ordinary kriging ]

The kriging is performed with the function krige from gstat. The object k 2017 is of class SpatialPixelsDataFrame and contains the predicted values in the column var1.pred that can be plotted using spplot. Command-lines above produced

Simulation of the group of controls

The Section 4.3.1 introduced the notion of linear networks and gave also first preliminary spatial non-parametric analyses of the intensity of the point process that generated the road crash point pattern on the road network in the city of Besançon. The purpose was to show various manipulations on the software R that were available to handle the road network. Next, the Section 4.3.2 introduced the notion of kriging and gave the results of this method that allowed to extrapolate traffic density data over a grid that overlays the study window. We propose now to combine these analyses by simulating point patterns on the road network according to traffic density data.

The traffic density values have been extrapolated for each cell of the grid pred grid for each year 2017, 2018 and 2019. The group of controls can be then simulated. To do so, we suggest to generate independent realizations of a Poisson point process on a linear network according to a given intensity. More particularly, a point pattern is produced on the road network based on traffic density data. This is computed as follows:

> k _ 2 0 1 7 _ im <-k _ 2 0 1 7 > k _ 2 0 1 7 _ im@data <-k _ 2 0 1 7 _ im@data % >% + dplyr :: select ( var 1 . pred ) > k _ 2 0 1 7 _ im <-as ( k _ 2 0 1 7 _ im , ' S p a t i a l G r i d D a t a F r a m e ') > k _ 2 0 1 7 _ im <-as ( k _ 2 0 1 7 _ im , ' im ') > road _ psp <-as . psp ( road _ sp ) > controls _ 2 0 1 7 <-rpoisppOnLines ( t _ 2 0 1 7 _ im , road _ psp ) > controls _ 2 0 1 7 Planar point pattern : 1 2 3 7 points window : rectangle = [ 9 2 2 5 7 1 . 8 ,9 3 2 9 4 0 . 5 ] x [ 6 6 8 2 2 3 0 ,6 6 9 5 0 9 3 ] units First, a pixel image k 2017 im of class im is created from the SpatialPixelsDataFrame object k 2017. Then, an object road psp of class psp is created from road sp with as.psp from spatstat. An object of this class represents a line segment pattern in the twodimensional plane. The creation of these objects was necessary in the following. Finally, a point pattern on the linear network according to traffic density value is simulated using the function rpoisppOnLines from spatstat. This function computes realizations of Poisson point processes from which the intensity is specified in the first argument. The point pattern controls 2017 on the network road psp produced is a realization of a Poisson process with intensity k 2017 im and is composed of 1 237 points. Note that the range of number of points is related to the intensity given.

Many implementation methods are available in order to simulate a point pattern on a network according to preliminary information. For example, the function rpoislpp from spatstat produces also a realization of a Poisson process with a specified intensity on a given linear network. Actually, this function is very similar to the previous one except that the linear network can be specified as an object of class linnet. On the other hand, we can also compute the intersection between the pixel image k 2017 im and the road network road sf and simply generate a point pattern with the function rpoispp seen in Section 3.2.1. The intersection of the pixel image and the network can be computed, in another way than using st intersection from sf, as follows:

> extract _ 2 0 1 7 <-t _ 2 0 1 7 _ im [ road _ linnet , drop = FALSE ] > plot ( extract _ 2 0 1 7 , main = " " )

The subset between the pixel image t 2017 im and the linear network road linnet is plotted in

Ratio of cases and controls

We focus on the ratio of matching case and controls. Indeed, how many controls do we have to include in the analysis ? According to [START_REF] Setia | Methodology series module 2: Case-control studies[END_REF], the most optimum case-control ratio is one for one, denoted as 1:1. However in many situations, the number of cases can be poor. Hence, the number of controls can be increased in order to increase the statistical power of the analysis (as the number of cases is limited). If data are available at no extra cost, the number of controls for each case is not limited. However in the cases where it is expensive to collect data, the optimal ratio is four controls per case, 1:4. Our situation is a specific case of figure as the controls are simulated. Hence, the only cost here is the computation time. We will not conclude on saying that the total number of cases, that is the total number of road crashes (296), is low or high. Hence we propose to set two different datasets where the matching ratio is 1:1 and 1:4.

The dataset design is as follows : each case would have one (or four) control that is sharing the same date, with values of the same covariates and a column flags that is the label of the observation (1 for a case and 0 for a control). The first step is to assign the same dates as the cases to the controls. The creation of the dataset where the matching ratio is 1:1 is taken as an example for the software command-lines. For the year 2017, the process of matching the dates and the controls are computed as follows:

> dates _ 2 0 1 7 <-bes _ sf % >% + filter ( year ( date ) == 2 0 1 7 ) % >% + dplyr :: select ( date ) % >% + st _ drop _ geometry () > nrow ( dates _ 2 0 1 7 ) > controls _ 2 0 1 7 _ sf <-st _ as _ sf ( controls _ 2 0 1 7 ) % >% + filter ( label == " point " ) % >% + dplyr :: select ( geom )

> s <-sample ( nrow ( controls _ 2 0 1 7 _ sf ) , nrow ( dates _ 2 0 1 7 ) ) > c _ 1 _ 2 0 1 7 _ sf <-controls _ 2 0 1 7 _ sf [s , ] > c _ 1 _ 2 0 1 7 _ sf <-bind _ cols ( dates _ 2 0 1 7 , c _ 1 _ 2 0 1 7 _ sf ) > c _ 1 _ 2 0 1 7 _ sf <-st _ as _ sf ( c _ 1 _ 2 0 1 7 _ sf ) > colnames ( c _ 1 _ 2 0 1 7 _ sf ) <-c ( " date " , " geom " ) [ 1 ] 8 7
First, the dates of the year 2017 from the cases are extracted and stored in dates 2017. Then, for the sake of simplicity, the ppp object controls 2017 is transformed into a sf object controls 2017 sf. This transformation implies the creation of a column label that describes the type of row, that is if it is a point or the window. Hence, we select only the points and then keep only the column that contains the geometries. Then, a number of points c 1 2017 sf of the object controls 2017 sf is randomly selected, equal to the number of dates of the year 2017 which is 87. Finally, the match is simply computed by merging the two objects c 1 2017 sf and dates with bind cols from the package dplyr. Note that the use of this function was necessary as it is an efficient tool for binding many data frames (of any type) into one, contrary to the function cbind that makes a dispatch between dataframe and sf objects. Note also that the call of the function st as sf is required after the use of The same whole process has been adopted for the creation of the object c 4 sf, that is similar to c 1 sf, where the matching ratio is 1:4.

Generalized Additive Model: fits and results

The space and time analysis framework proposed is to adapt our situation as a casecontrol study. To do so, the previous sections introduced the notion of a linear network that has been used later in order to simulate a group of controls on the road network and kriging that consisted in extrapolating the traffic density values on a grid that overlaps the study window of the city of Besançon that helped to simulate the group of controls according to the traffic density. As all the necessary elements for a spatio-temporal modelling are available, we are now in position to drive this space and time case-control analysis. The final goal is to predict the probability for a point location on the road network to be a case based on environment characteristics. More particularly, the idea is to map the riskiest zones of Besançon into space and time. We suggest to introduce the environment characteristics as linear predictors and spatio-temporal components in a nonlinear way into the semiparametric statistical method, known as Generalized Additive Models, initially introduced by [START_REF] Hastie | Generalized additive models[END_REF]. This class of model is common used in the field of spatial statistics in order to fit space and/or time analyses. For instance, Wood (2017, Chapter 7) gives many data and fit examples such as spatio-temporal analyses of fish eggs, Feng (2022) fitted a spatio-temporal GAM on COVID-19 data and Wang and Brown (2012) also used a space and time GAM to model criminal incidents.

Let F ∈ {0, 1} be the binary response variable that labels the point locations as 1 = "case" and 0 = "control". In our case, the model takes the following form for F ∼ binomial(1, µ i ) logit(µ i ) = Z i β + f (x i , y i , t i ), i = 1, . . . , n, (4.9)

where logit(a) = ln(a/(1 -a)), t ∈]0, 1[, is the logistic link function, Z i is the vector of environment covariate values for the ith observation (more details in the next section) with associated effect β and f is a nonparametric smooth function of x i , y i and t i that are respectively the longitude, latitude and temporal coordinate of the ith observation. The function f is approximated into a multivariate basis function such as tensor product spline basis (Wood, 2017, Chapter 5). Model parameters are estimated using a penalised maximum likelihood approach.

Fits and results

As previously, the manipulations of the dataset of matching ratio 1:1 is taken as an example for the software command-lines that will be used for fitting GAMs. First, the controls are merged to the cases as follows :

> c _ 1 _ sf <-c _ 1 _ sf % >% + mutate ( flags = 0 ) > bes _ sf <-bes _ sf % >% + mutate ( flags = 1 ) > bes _ c _ 1 _ sf <-rbind ( bes _ sf , c _ 1 _ sf ) Note that a label has been created in order to specify which observation is a control or a case before merging the objects. The column flags labels the control observations as 0 and the cases observations as 1.

Then, we propose to incorporate information into the analysis through covariates.

Environment characteristics Remind that the goal of the analysis is to perform a spatiotemporal analysis as a case-control study. In order to determine if one exposure (or more) are associated to the outcome which is the accident occurrence, additional information through covariates will be incorporated. The covariates used are the same as the ones used in Chapter 2 and Chapter 3, that are prop18, prop65, health, school, college, shop, station, gasoline, leisure, intersection, radars, municipal length and national length. Data collected for the following work were reported between 2017 and 2020. This information has been considered unchanged over the years in order to associate them to road crashes that occurred between 2017 and 2019. This information will be associated this time to a point, instead of a polygon as seen in Chapter 2 and Chapter 3. The covariate values are disposed on a grid, named grid bes sf, that is the same as the one used for kriging in Section 4.3.2. Note that the choice of this grid of cells 100 × 100 meters was motivated by having the information at a finer scale than in the previous chapters 2 and 3 (given at cells of 650 × 650 meters). However, this finer scale implies the use of different interpolation methods as the ones used in Chapter 2. The reader may find the interpolation details used to create the object grid bes sf in Section 4.6.

The covariate values of the grid grid bes sf can be associate to the controls and the cases as follows:

> st _ crs ( bes _ c _ 1 _ sf ) <-st _ crs ( grid _ bes _ sf ) > bes _ c _ 1 _ sf <-st _ intersection ( bes _ c _ 1 _ sf , grid _ bes _ sf )

The association of the grid with the covariates values and the object bes c 1 sf has been computed using simply the function st intersection as the intersection between polygons and points are points. It is a easier way to process for the merger wished.

The final step before fitting the GAMs is the one as follows:

> bes _ c _ 1 <-cbind ( bes _ c _ 1 _ sf , st _ coordinates ( bes _ c _ 1 _ sf ) ) % >% + st _ drop _ geometry ()

The need of separate columns that contain the longitude and the latitude of the points implied the use of the function st coordinates. The longitude and the latitude are now part of bes c 1 in columns respectively automatically named X and Y. Then, the geometries have been dropped out in order to have simply a dataframe object. The total number of observation in this dataset is equal to 592. The same whole process has been adopted for the creation of the dataframe bes c 4, that is similar to bes c 1, where the matching ratio is 1:4. The total number of observation in this dataset is equal to 1 480.

Generalized additive model fits We now discuss potential models. The date will not be given in its simple form. In order to introduce temporal components in the following GAMs, the creation of temporal covariates is needed. We proposed to incorporate the time given at different scales such as trimester, month and day of week. The command-lines which give the creation of the corresponding columns in the datasets, named respectively quarter, month and day, are not shown.

The dataset bes c 1 and the temporal covariate quarter will be taken as examples for the command-lines in this section. First, the simplest model of the form given in Eq (4.9) is as follows logit(µ i ) = f (X i , Y i , quarter i ), i = 1, . . . , 592, where f is a smoothing function. In practice, a satisfactory approach to approximate the smooth functions depending on covariates measured on different scales is to use tensor product smooth bases. The reader may find more details on the latter notion in Wood (2017, Chapter 5). In our case the longitude and the latitude are given in meters and the time in terms of trimester, month or day. Hence, this situation expresses the need to use tensors.

Then, the use of cubic spline is a common choice. The model above is implemented as follows:

> The GAM is fitted using gam from the package mgcv. Then, the smooth term used is te() with attributes bs = 'cr' and k = 4 which corresponds respectively to the tensor product, cubic spline and the number of knots (hyperparameter for splines). The spatio-temporal term is significant with a p-value equal to 8.13e-05.

We propose now to fit a similar model as above but with including the covariate national length:

logit(µ i ) = national length i β + f (X i , Y i , quarter i ), i = 1, . . . , 592,
where β is the associated effect of the covariate national length. This covariate was considered as an important risk factor in Chapter 3. This model is computed as follows: The covariate national length and the spatio-temporal term are both significant. The exponential of the estimate of national length is equal to 6.70 which means that the increase of length of national roads increases the probability of being a case. In other global words, the environment covariate national length is a risky factor.

Several models have been fitted, with each temporal component and each environment covariate, both on the datasets bes c 1 and bes c 4. The results are respectively summarized in Tab C.1 and Tab C.2 in Appendix C. Globally for models on data bes c 1, the significant covariates are shop, intersection and national lenght. The spatio-temporal components that are always significant are the ones with the temporal covariates quarter and day. Then for models on data bes c 4, the significant covariates are shop, gasoline, intersection and national lenght. All the spatio-temporal components, with the temporal covariates quarter, month and day, are almost always significant. The model forms proposed in this chapter are set in order to make assumptions, more research is needed to implement more rigorous models implying covariate selection, spline hyperparameter tuning and is planned to be treated later.

Riskiest zones of Besançon into space and time For now, it is interesting to map the estimated probability at each location of being a case, according to the temporal component. With the fitted model gam quarter nat, this can be computed as follows :

> plot ( owin _ bes _ sf ) > vis . gam ( gam _ quarter _ nat , view = c ( " X " , " Y " ) , + plot . type = " contour " , type = " response " , + cond = list ( quarter = 1 ) , color = " terrain " , + too . far = 0 . 0 8 , add = TRUE ) > plot ( owin _ bes _ sf , add = TRUE )

The function vis.gam from the package mgcv enables to produce perspective or contour plot views of gam objects. The attribute view has to contain the names of the two main effect density kriging. Firstly, the part focused on the road network enabled to handle the road network on the software. On the other hand, the study also gave the road segments that were the riskiest using a kernel estimation of the intensity of the point process that generated the road crashes point pattern of Besançon. More specifically a strong hypothesis on road segments near the bridges Pont de la République and Pont Robert Schwint to be risky has been made. Secondly, the traffic density data have been predicted on a given grid using kriging. The data have been produced in order to be considered as the intensity of a point process that generated point patterns on the road network. These point patterns constituted the group of controls for our case-control study. Finally, space and time analyses have been fitted using semiparametrics models, based on Generalized Additive Model (GAM). Maps of probabilities being a case have been produced and enable to conclude that the riskiest zones of the city of Besançon are a circle centred on the train station Gare Viotte and the departmental road D673.

Discussions This chapter gives only preliminary analyses and allows to make assumptions on potential spatio-temporal dependences or eventual future investigations. It could be interesting to model the road crashes point pattern on the road network using point processes (Baddeley et al., 2021a). Then for the spatio-temporal analysis, the focus on the GAM has to be set. Indeed, the GAMs need to be improved. These models are composed of hyperparameters that can be tuned and there are several propositions of covariate combinations to be tested.

Supplementary material: areal interpolation

This section aims at giving the interpolation methods used in order to form the grid of covariate values grid bes sf used in Section 4.4.1.

The information through covariates in GAMs is associated this time to a point, instead of a polygon as seen in previous chapters. The process proposed is as follows: use the same grid that was used for kriging for the interpolation methods and then make the intersection between the cells and the points that will keep the data. Note that the choice of this grid of cells 100 × 100 meters was motivated by having the information at a finer scale than in the previous chapters (given at cells of 650 × 650 meters).

As almost all the steps for the interpolation methods are similar to ones used in Section 2.3.2, only the steps for the interpolation of socio-demographic data will be presented below. Indeed, remind that in Section 2.3.2 the socio-demographic data were available on a grid of cells 200 × 200 meters, named as source zones. The target zones, that was a grid of cells 650 × 650 meters, were bigger than the source zones. Hence, the interpolation method used was simply the point-in-polygon method. However, the target zones now are cells of 100 × 100 meters, which are smaller than the source zones. Hence, in order to be as rigorous as possible, the method point-in-polygon should be avoided [START_REF] Do | Guidelines on areal interpolation methods[END_REF] and we used instead the areal weighting interpolation (DAW).

Remind some notations given in Section 2.3.2. The set of target and source zones are respectively t 1 , . . . , t T and s 1 , . . . , s S . The value of the variable Z (variable of interest to be interpolated) on the the target zone t i and the source zone s j is denoted respectively as Z t i and Z s j . The intersection zone between zones t i and s j is I t i ,s j . The value of Z on the intersection zone I t i ,s j is denoted as Z t i ,s j . The DAW method is defined as follows

Z t i = S j=1 Z t i ,s j = S j=1 |I t i ,s j | |s j | Z s j
where |I t i ,s j | and |s j | denote respectively the area of the intersection zone I t i ,s j and the source zone s j , i = 1, . . . , T , j = 1, ..., S.

In other words, in the case where for example a source zone overlaps two target zones, the DAW method disaggregates the values of the variable Z to be interpolated between the two target zones, proportionally to the area of the intersected zones.

First for the sake of clarity, a copy of the object pred grid sf is made, named grid bes sf, in order to use another named object as their uses have different goals. New socio-demographic datasets are loaded and named ngrid insee sf. In the date of research work written in Chapter 2 and Chapter 3, the socio-demographic data dated to 2015 and have been provided by INSEE in July 2019. The website INSEE made socio-demographic data available, similar as ones used in previous chapters, dated to 2017 and provided in March 2022. Hence, we decided to use the up-to-date data in order to be as accurate as possible.

The data of ngrid insee sf are the same as grid insee sf from Section 2.3.2:

• Ind : the number of individuals ;

• Ind 18 24 : number of individuals between 18 and 24 years old ;

• Ind 65 79 : number of individuals between 65 and 79 years old ;

• Ind 80p : number of individuals more than 80 years old.

> nrow ( grid _ bes _ sf )

> sum ( st _ area ( grid _ bes _ sf ) ) > nrow ( ngrid _ insee _ sf ) > sum ( st _ area ( ngrid _ insee _ sf ) )

[ 1 ] 1 8 2 2 5 1 8 2 2 5 0 0 0 0 [ m ^2 ]

[ 1 ] 9 0 0 3 4 0 5 4 5 4 3 [ m ^2 ]

The grid where the information has to be interpolated is composed of T = 18 225 target zones that cover an area of 182 250 000 squared meters. A pre-processing of ngrid insee sf data (command-lines not shown here) consisted in making the intersection between the INSEE cells and the study window owin bes sf. The sf object ngrid insee sf is composed of S = 900 sources zones that cover an area of 34 054 543 squared meters.

The interpolation of these four variable values on the grid grid bes sf using the DAW method is computed as follows:

> grid _ bes _ sf $ id <-seq ( 1 , nrow ( grid _ bes _ sf ) ) > grid _ bes _ sf $ id <-paste 0 ( ' target ' , grid _ bes _ sf $ id ) > ngrid _ insee _ sf $ id <-seq ( 1 , nrow ( ngrid _ insee _ sf ) ) > ngrid _ insee _ sf $ id <-paste 0 ( ' source ' , ngrid _ insee _ sf $ id ) > st _ crs ( ngrid _ insee _ sf ) <-st _ crs ( grid _ bes _ sf ) > grid _ bes _ sf <-aw _ interpolate ( grid _ bes _ sf , tid = id , + source = ngrid _ insee _ sf , sid = id , + weight = " sum " , output = " sf " , + extensive = c ( " Ind " , " Ind _ 1 8 _ 2 4 " , + " Ind _ 6 5 _ 7 9 " , " Ind _ 8 0 p " ) )

The function for applying the DAW method is aw interpolate from the package areal. This function requires first : a sf object that represents the target zones, the column name that contains the identification of the target zones, a sf object that represents the source zones and the column name that contains the identification of the source zones. Hence, the first four command-lines above consist in the creation of the identifications required. Then, the target variables are specified in the attribute extensive.

Finally, the proportions of people aged between 18 and 24 years old, and over 65 years old are computed as follows:

> grid _ bes _ sf <-grid _ bes _ sf % >% + mutate ( prop 1 8 = Ind _ 1 8 _ 2 4 / Ind , + prop 6 5 = ( Ind _ 6 5 _ 7 9 + Ind _ 8 0 p ) / Ind ) % >% + dplyr :: select ( -Ind , -Ind _ 1 8 _ 2 4 , -Ind _ 6 5 _ 7 9 , -Ind _ 8 0 p ) > grid _ bes _ sf [ is . na ( grid _ bes _ sf $ prop 1 8 ) , ]$ prop 1 8 <-0 > grid _ bes _ sf [ is . na ( grid _ bes _ sf $ prop 6 5 ) , ]$ prop 6 5 <-0

The remaining covariates health, school, college, shop, station, gasoline, leisure, intersection, radars, municipal length and national length do not suffer from the smaller cell size of 100 × 100 meters and are, hence, interpolated as seen in Section 2.3.2. The final sf object grid bes sf can be exported as follows: La modélisation s'inspire des études cas-contrôles épidémiologiques et prend en compte la structure du réseau routier ainsi que des données spatio-temporelles de trafic.

Mots-clés: analyse des correspondances multiples; interpolation de données surfaciques; krigeage; modèle généralisé additif; processus de Cox log-Gaussien; régression logistique ordinale; régression log-linéaire; réseau linéaire.

Abstract. In this thesis, we focus on the statistical analysis of road accident data. Several issues are studied depending on whether the accident has already occurred (retrospective point of view) or before the accident occurs (predictive point of view). In order to do that, we use classical machine learning statistical methods and spatial and spatio-temporal prediction models. The first part of the thesis focuses on the statistical analysis of the accident severity. Many factors such as alcohol and/or drug consumption, department, time of day are related to accident severity through unsupervised or supervised statistical learning approaches. The dependence between these factors is modelled by using first log-linear models based on the associations highlighted by preliminary analyses of multiple correspondences and next, by ordinal logistic regression. These two types of modelling allow to quantify the risks associated with the factors analysed in relation to the severity of the accidents. The second part of the thesis focuses on the accident occurrence. The accident data are modelled by log-Gaussian Cox processes (LGCP) based on the geolocated coordinates of the accidents as well as on socio-demographic and road infrastructure covariates in order to identify the most critical geographical areas. We propose a variable selection method based on an aggregation of Poisson models and a variable importance criterion to select the most important covariates to be then used in an LGCP type model. The best model is then used to determine the riskiest areas. Secondly, the temporal component is introduced in the model and semiparametric generalized additive models are proposed in order to identify the critical zones and time periods. The modelling is inspired by casecontrol studies from epidemiology and takes into account the road network structure and space-time traffic data.

  Je dédie cette thèse à mes parents, Maryan et Ilma, pour la force dont ils font preuve quotidiennement, notamment face à la maladie. Na Zdrowie, Salute et Živjeli ! blablaIntroductionI Injuries analysis of road accidents1 Multivariate statistical analysis for exploring road crash related factors in the Franche-Comté region of France 1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2 Material and methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2.1 Franche-Comté accident data . . . . . . . . . . . . . . . . . . . . . . . 1.2.2 Statistical analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3.1 MCA of road crash temporal variables . . . . . . . . . . . . . . . . . . 1.3.2 MCA of road crash spatial variables . . . . . . . . . . . . . . . . . . . 1.3.3 MCA of road crash temporal and spatial variables . . . . . . . . . . . 1.3.4 Hierarchical log-linear modelling . . . . . . . . . . . . . . . . . . . . . 1.3.5 Log-linear modelling using MCA . . . . . . . . . . . . . . . . . . . . . 1.3.6 Ordinal regression modelling . . . . . . . . . . . . . . . . . . . . . . . 1.4 Summary of injury road accident analysis and discussions . . . . . . . . . II Space and time analyses of road accidents 2 Spatial road crashes and related factors data handling Spatial point pattern and areal interpolation methods 2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2 Road accident spatial point pattern . . . . . . . . . . . . . . . . . . . . . . List of Tables 1.1 Contingency tables crossing the accident severity type acc with the other categorical variables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2 Different structures of log-linear models corresponding to different dependence structures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3 Three-way contingency table with type acc, substance and department as categorical variables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4 Goodness-of-Fit Tests for log-linear models relating type acc (T), substance (S) and department (D). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.5 Odds ratio estimated from (TS, TD, SD) log-linear model. . . . . . . . . . . . 1.6 Seven-way contingency table with type acc (T), department (D), substance (S), time (Ti), season (Se), week (W) and daytime (Da) as categorical variables. 1.7 Odds ratio estimated from log-linear model 1.5. . . . . . . . . . . . . . . . . . 1.8 Ordinal regression model results with type acc as ordered response variable. .3.1 Mean squared error (MSE) and R-squared (R 2 ) values of various statistical models fitted on the road crash data. . . . . . . . . . . . . . . . . . . . . . . . 3.2 Metric results of the LGCP models fitted. . . . . . . . . . . . . . . . . . . . 3.3 Confusion matrix results. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.4 Parameter estimates of LGCP3 model. . . . . . . . . . . . . . . . . . . . . .

Fig 1. 1 :

 1 Fig 1.1: France map with road crash frequency of Franche-Comté region. Each small division corresponds to a canton.

Fig 1. 2 :

 2 Fig 1.2: MCA temporal analysis: variance percentage explained by the first 10 axes.

Fig 1. 3 :

 3 Fig 1.3: MCA temporal analysis: factorial plane made by axis 1 and axis 2.

Fig 1. 4 :

 4 Fig 1.4: MCA temporal analysis: factorial plane made by axis 1 and axis 3.

Fig

  Fig 1.5: MCA temporal analysis: factorial plane made by axis 2 and axis 3.

Fig

  Fig 1.6: MCA spatial analysis, Doubs department: variance percentage explained by the first 10 axes.

Fig

  Fig 1.7: MCA spatial analysis, Doubs department: factorial plane made by axis 1 and axis 2.

  Fig 1.8: MCA spatial analysis, Jura department: variance percentage on the first 10 axes.

Fig

  Fig 1.9: MCA spatial analysis, Jura departement: factorial plane made by axis 1 and axis 2.

  Fig 1.10: MCA global analysis: factorial plane made by axis 1 and axis 2.

Fig 1 .

 1 Fig 1.11: MCA global analysis: factorial plane made by axis 1 and axis 3.

Fig

  Fig 1.12: MCA global analysis: factorial plane made by axis 2 and axis 3.

Fig 1 .

 1 Fig 1.13: Odds ratios obtained by ordinal regression model. Grey lines represent the confidence intervals and black points the values of the odds ratios.

Fig

  Fig 1.14: Franche-Comté map with department odds ratio. Each color corresponds to a department with its odds ratio value considering the Doubs department as the reference and each small division corresponds to a canton.

Fig 2 .

 2 Fig 2.1: Spatial distribution of road crashes in the CAGB area.

Fig 2 . 2 :

 22 Fig 2.2: Polygons of CAGB cities. The blue one corresponds to the city of Besançon.

Fig 2 . 3 :

 23 Fig 2.3: Polygons of the study area.

Fig 2 . 4 :

 24 Fig 2.4: Road accident spatial point pattern in the CAGB. Using plot function.

Fig 2 . 5 :

 25 Fig 2.5: Road accident spatial point pattern in the CAGB. Using ggplot2 functions.

Fig 2 .

 2 Fig 2.6: Plot of quadrats of road accident spatial point pattern. Left to right : 3 × 3 quadrat sand 9 × 9 quadrats.

Fig 2 .

 2 Fig 2.7: Computational support grid.

•

  Fig 2.8: Plot of INSEE data cells with centroids (in red) overlaying computational grid cells (in black).

Fig 2 .

 2 Fig 2.9: Plot of shop variable values, between 0 and 50, per cells of grid cagb sf.

Fig 3 .

 3 Fig 3.1 gives three possible realizations of a homogeneous Poisson point process with an intensity value λ of 30. The simulations have been made with rpoispp from package spatstat. This function takes the intensity of the Poisson process as first argument, hence in the homogenous case, a constant is required. The default window, in which the point pattern is simulated, is the unit square. The function returned a list of ppp objects as nsim = 3 specified that three realizations were required.

Fig 3 .

 3 Fig 3.1: Three simulated realizations of the Poisson point process with intensity 30 in the unit square.

  Fig 3.2 shows a high density of points in the top right corner of the window.

Fig 3 . 2 :

 32 Fig 3.2: Plot of intensity function λ 1 and realization of the associated inhomogeneous Poisson point process in the unit square.

  Fig 2.1 from Section 2.2 in Chapter 2 showed a high density of points in the middle of the window. In order to inspect how the intensity function in our case would be, the same plot as Fig 3.2 is obtained as follows:

Fig 3 . 3 :

 33 Fig 3.3: Plot of road accident spatial point pattern in the CAGB overlapping an estimation of its intensity function.

Fig 2 .

 2 6 from Section 2.2 in Chapter 2 have been created once again below with quadratcount from spatstat package. Then, estimates of the intensity function can be obtained with the function intensity, from spatstat, which takes an object quadratcount as argument. Fig 3.4 and Fig 3.5 are plotted as follows:

Fig 3 . 4 :

 34 Fig 3.4: Quadrat counting for CAGB road accidents data. Quadrat counts 3 × 3 in left and intensity estimates (point per square meters) in right.

  3.

Fig 3 .

 3 Fig 3.5: Quadrat counting for CAGB road accidents data. Quadrat counts 9 × 9 in left and intensity estimates (point per square meters) in right.

>

  quadrat . test ( cagb _ ppp , nx = 2 , ny = 1 ) Chi -squared test of CSR using quadrat counts data : cagb _ ppp X 2 = 0 . 8 2 7 2 4 , df = 1 , p -value = 0 . 7 2 6 1 alternative hypothesis : two . sided Quadrats : 2 tiles ( irregular windows )

  Fig 3.6: Kernel estimates of intensity for CAGB road crashes using different smoothing bandwidths. Left to right: smoothing bandwidth σ equal to 50, 250 and 500. Same colour code interpretation as Fig 3.3 (plot legend not displayed as it has been resized).

Fig 3 .

 3 Fig 3.7: Perspective views of intensity kernel estimates of CAGB road crashes using different smoothing bandwidths. Left to right: smoothing bandwidth equal to 50, 250 and 500.

  5 3 1 1 Smoothing bandwidth estimate value obtained by the chosen algorithm is σ = 787.5311 (much larger than the ones tried before) and Fig 3.8 displays the kernel estimate of the

Fig 3 .

 3 Fig 3.8: Plot of a kernel estimate of intensity of CAGB road crashes with smoothing bandwidth selected by likelihood cross-validation method. Left to right : classical plot and perspective plot.

Fig 3 . 9 :

 39 Fig 3.9: Output of chooseCellwidth(cagb ppp, cwinit = 650).

  parameter level : distribution of θ; latent process level : distribution of Y |θ; observation level : distribution of X|θ, Y.

  Wikle, 2011, Chapter 4): parameter level : θ = (β, η) with β the covariate effects and η = (log(σ), log(φ)) parametrizing the covariance functions of Y ; latent process level : Given θ, Y (•) is a Gaussian process and Λ(u) = exp Z(u) β + Y (u) , u ∈ W ; observation level : Given Λ(•) = λ(•), X is an inhomogeneous Poisson process with intensity function λ(•).

  unobserved level : Θ with distribution π(Θ) observation level : X with distribution π(X|Θ), where π(Θ) = π(Y |θ)π(θ) and π(Θ|X) ∝ π(X|Θ)π(Θ) = π(X|θ, Y )π(Y |θ)π(θ).

Algorithm 2

 2 Poisson models aggregation (I) For the mth bootstrapped training sample B m selected from selection train, m = 1, . . . , M , do:

  > rf _ poisson <-function ( train , test , N , varZ , mtry , M ) { + # Storing results + Nhat _ train _ Bm <-matrix ( NA , nrow ( train ) , M ) + Nhat _ test _ Bm <-matrix ( NA , nrow ( test ) , M ) + VIM <-matrix ( NA , nrow = length ( varZ ) , ncol = 1 ) + rownames ( VIM ) <-varZ Objects Nhat train Bm, Nhat test Bm and VIM will contain respectively values of N Bm s train , N Bm stest and V IM j , m = 1, . . . , M , j = 1, . . . , 13. The next steps then correspond to the aggregation. Before fitting a Poisson regression, a bootstrap sample Bm, a random selection of mtry covariates Zstar and the formula of the Poisson model FORM are setted as follows: + for ( m in ( 1 : M ) ) { # Start M Poisson models + # Bootstrap sample Bm + b <-sample ( nrow ( train ) , nrow ( train ) , replace = TRUE )

  <-which ( colnames ( oob _ Bm ) == j ) + oob _ Bm _ j <-gdata :: resample ( oob _ bm [ , ind _ j ] , + size = nrow ( oob _ bm ) ) + oob _ Bm _ j <-oob _ Bm % >% + dplyr :: select ( -j ) % >% + cbind ( oob _ Bm _ j ) + colnames ( oob _ Bm _ j ) <-c ( colnames ( oob _ Bm [ , -ind _ j ]) , j ) + err _ oob _ Bm _ j <-predict ( fhat _ Bm , + newdata = oob _ Bm _j , + type = " response " ) + err _ oob _ Bm _ j <-mean (( err _ oob _ Bm _ j -oob _ Bm _ j [ , N ]) ^2 ) + # VIM + VIM [j , ] <-sum ( VIM [j , ] , err _ oob _ Bm _ j -err _ oob _ bm , + na . rm = TRUE ) + }

+

  # Mean predictions and VIM + Nhat _ train <-rowMeans ( Nhat _ train _ Bm [ , 1 : M ] , na . rm = TRUE ) + Nhat _ test <-rowMeans ( Nhat _ test _ Bm [ , 1 : M ] , na . rm = TRUE ) + VIM <-VIM / M + # Aggregation assessment + R 2 _ train <-1 -Metrics :: rse ( train [ , N ] , Xhat _ train ) + R 2 _ test <-1 -Metrics :: rse ( test [ , N ] , Xhat _ test ) + MSE _ train <-Metrics :: mse ( train [ , N ] , Xhat _ train ) + MSE _ test <-Metrics :: mse ( test [ , N ] , Xhat _ test ) The objects Nhat train and Nhat test correspond respectively to Ns train and Nstest . Rsquared values on train and test are evaluated using the function rse from the package Metrics. The MSE values are computed similarly using the function mse.

>

  set . seed ( 1 2 3 ) > index <-c re a t eD a t aP a r ti t i on ( selection $ accidents _ class , p = 0 . 7 5 , list = FALSE ) > selection _ train <-selection [ index , ] > selection _ test <-selection [ -index , ] > selection _ train <-DMwR :: SMOTE ( accidents _ class ~. , + data . frame ( selection _ train )

  First, the same results as Tab 3.1 are given. Then, the methods are compared according to the training samples which are simply a training set where the distribution of the column accidents class of selection have been preserved (which means around 89% for the class 0 and 11% for the class 1), referred as Distribution preserved in Tab B.1, and finally the whole dataset selection, which means that no training and test sets have been created, referred as No split rule in Tab B.1.

  Fig 3.10. The four covariates that are the most important are municipal length, shop, station and national length.

Fig 3 .

 3 Fig 3.10: Variable importance plot for Poisson models aggregation with four covariates randomly included at each iteration.

  list = ls () , file = file . path ( BASEDR , " lgcp 1 . RData " ) )

  l g c p P r e d i c t S p a t i a l O n l y P l u s P a r a m e t e r s ( lgcp 1 , numCases ) [[ 1 ]] | = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = | 1 0 0 %

Fig 3 .

 3 Fig 3.11 shows the observed number of road crashes per cell of the computational grid.Fig 3.12 represents the predicted values from lgcp1, that are, the expected number of road crashes per cell of the computational grid. The grey background of the plots corresponds to the cells where no accidents happened. Graphically speaking, these plots are similar. The same structure as Fig 3.11 can be recognized in Fig 3.12. Moreover, note that the five green cells in the middle ofFig 3.11, that represent globally cells where between eight and fourteen accidents happened, seem to have been predicted properly as it can be seen in Fig 3.12.

>

  Fig 3.11: Plots of road crash observed values on a 64 × 64 grid.

Fig 3 .

 3 Fig 3.12: Plots of road crash fitted values from lgcp1 on a 64 × 64 grid

Fig 3 .

 3 Fig 3.13: Plot of weights used in the wMSE for model lgcp1.

>

  pois _ proba 0 <-function (Y , beta , eta , Z , otherargs ) { + ca <-diff ( otherargs $ mcens [ 1 : 2 ]) * diff ( otherargs $ ncens [ 1 : 2 ]) + lambda <-ca * + otherargs $ poisson . offset [ 1 : otherargs $M , 1 : otherargs $ N ] + * exp ( matrix ( Z % * % t ( beta ) , otherargs $ M * otherargs $ ext , + otherargs $ N * otherargs $ ext ) [ 1 : otherargs $M , 1 : otherargs $ N ] + Y ) + x <-dpois ( 0 , lambda ) + return ( x ) + } > lgcp 3 _ proba 0 <-lgcp ::: expectation . l g c p P r e d i c t S p a t i a l O n l y P l u s P a r a m e t e r s ( lgcp 3 , pois _ proba 0 ) [[ 1 ]] | = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = | 1 0 0 %

0

  True negative (TN) False positive (FP) 1 False negative (FN) True positive (TP)

  ex 1 <-lgcp ::: expectation . l g c p P r e d i c t S p a t i a l O n l y P l u s P a r a m e t e r s ( lgcp 3 , exceed ) [[ 1 ]] | = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = | 1 0 0 %

Fig 3

 3 Fig 3.14. Fig 3.14 shows that the zones where at least one accident could occur with a high probability are in the centre of the study window.

Fig 3 .

 3 Fig 3.14: Plot of the posterior probability that the number of road crashes exceeds 1.

Fig 3 .

 3 Fig 3.15: Plot of the posterior probability that the number of road crashes exceeds 5.

Fig 3 .

 3 Fig 3.16: Plot of the posterior probability that the number of road crashes exceeds 10.

Finally

  , we propose to plot the boundaries of the riskiest cell on a map in order to visualize explicitly where the zone is in the urban community of Besançon. The code below generates the result in Fig 3.

  17

  :

Fig 3 .

 3 Fig 3.17: Plot of the riskiest cell in the CAGB regarding to its probability that at least 10 accidents occur.

Fig 3 .

 3 Fig 3.18: Plot that the relative risk exceeds a given threshold. Left to right : threshold equal to 2 and 5.

Fig 3 .

 3 Fig 3.19: Trace plot for the parameter σ from lgcp3.

  For fast-mixing Markov chains, lag-k autocorrelation values drop down to (practically) zero as quickly as k increases. On the other hand, high lag-k autocorrelation values for larger k indicate the presence of a high degree of correlation and slow mixing of the Markov chain. The autocorrelation check of the latent Gaussian process and the autocorrelation plots for the parameters β and η are computed as follows: > lagch <-c ( 1 , 5 , 1 5 ) > Sacf <-autocorr ( lgcp 3 , lagch , inWindow = NULL ) > for ( i in 1 : 3 ) { + image . plot ( xvals ( lgcp 3 ) , yvals ( lgcp 3 ) , + Sacf [ , , i ] , zlim = c ( -1 , 1 ) , + axes = FALSE , xlab = " " , ylab = " " , asp = 1 , + sub = paste ( " Lag : " , lagch [ i ]) ) + plot ( cagb _ ppp $ window , add = TRUE ) = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = | 1 0 0 % First, different lags of the chain are chosen: 1, 5 and 15 for example. The function autocorr from package lgcp computes cell-wise for selected autocorrelations of the Gaussian process of lgcp3. Then, the results are plotted with the function image.plot on which the study window owin cagb is added with the plot call and the autocorrelation plots are obtained with the function parautocorr from the package lgcp. The results are given in Fig 3.20.

Fig 3 .

 3 Fig 3.20: Autocorrelation plot of the gaussian process from lgcp3. Left to right: lag 1, 5 and 15.

Fig 3 .

 3 Fig 3.21: Autocorrelation plot for the parameter σ from lgcp3.

Fig 3 .

 3 Fig 3.22: Plot of the prior and posterior distributions of each parameter.

Fig 4 .

 4 Fig 4.1: Number of road crashes per month in a year.

Fig 4 . 2 :

 42 Fig 4.2: Number of road crashes per trimester in a year.

>

  ggplot () + + geom _ sf ( data = owin _ bes _ sf ) + + geom _ sf ( data = tmp , size = 0 ) + + facet _ grid ( week ~year ) + + theme _ bw () + + theme ( panel . grid . major = element _ line ( colour = " black " , + linetype = " dashed " , size = 0 . 1 ) , + panel . grid . minor = element _ line ( colour = " black " , + linetype = " dashed " , size = 0 . 1 ) , + axis . text . x = element _ blank () , + axis . text . y = element _ blank () ) The day of week of each observation is obtained with the function weekdays. Command-lines above produced Fig 4.4. It seems that accidents that happen during the weekend have no geographical preferences compared to the ones happening during the week but it should be properly analysed.

Fig 4 . 4 :

 44 Fig 4.4: Road crash point pattern per time of the week in a year.

  > ggplot () + + geom _ sf ( data = owin _ bes _ sf ) + + geom _ sf ( data = tmp , size = 0 ) + + facet _ grid ( year ~quarter ) + + theme _ bw () + + theme ( panel . grid . major = element _ line ( colour = " black " , + linetype = " dashed " , size = 0 . 1 ) , + panel . grid . minor = element _ line ( colour = " black " , + linetype = " dashed " , size = 0 . 1 ) , + axis . text . x = element _ blank () , + axis . text . y = element _ blank () ) Command-lines above produced the Fig 4.5. Graphically, it is hard to make assumptions on a possible space and time trend.

Fig 4 . 5 :

 45 Fig 4.5: Road crash point pattern per trimester in a year.

  Fig 4.6.

Fig 4 .

 4 Fig 4.6: Road network of the city of Besançon. Left to right : anoverview and a focus on Besançon city centre.

>

  Fig 4.7: Road network and road accident point pattern of the city of Besançon. Note that the points do not lie on the network.

  Fig 4.7, the point pattern from the lpp object bes lpp has been extracted and named tmp, like temporary, as its use is only to show that the point pattern lie well on the network now. Command-lines above produced Fig 4.8.

Fig 4 . 8 :

 48 Fig 4.8: Road network and road accident point pattern of the city of Besançon. Use of the function lpp. Note that the points now lie on the network.

Fig 4 . 9 :

 49 Fig 4.9: Kernel estimate of intensity for the road crashes of the city of Besançon on road network.

  Fig 4.10. The polygon centre sp sets the limits of the city centre of Besançon, called la Boucle by the inhabitants, which means "the loop" due to its shape.

Fig 4 .

 4 Fig 4.10: Polygon boundaries focused on Besançon centre.

  sf <-st _ transform ( centre _ sf , crs = 2 1 5 4 ) > r _ centre _ sf <-st _ intersection ( road _ sf , centre _ sf ) > b _ centre _ sf <-st _ intersection ( bes _ sf , centre _ sf ) # Creation of linnet , ppp and lpp objects > centre _ sp <-spTransform ( centre _ sp , CRSobj = CRS ( " + init = epsg : 2 1 5 4 " ) ) > r _ centre _ sp <-as ( r _ centre , ' Spatial ') > r _ centre _ linnet <-as . linnet . SpatialLines ( r _ centre _ sp ) > centre _ owin <-as . owin ( centre _ sp ) > b _ centre _ ppp <-as . ppp ( st _ coordinates ( b _ centre _ sf ) , centre _ owin ) > b _ centre _ lpp <-lpp ( b _ centre _ ppp , r _ centre _ linnet ) # Kernel estimation > density _ centre <-densityQuick . lpp ( b _ centre _ lpp , + sigma = bw . scott ( b _ centre _ lpp ) ) > plot ( density _ centre , main = " " ) Command-lines above produced the Fig 4.11.

Fig 4 .

 4 Fig 4.11: Kernel estimate of intensity for the road crashes of Besançon city centre.

Fig 4 .

 4 Fig 4.12. The expected number of road crashes per unit length of road network is higher in the top right, above the river Doubs, where stand two bridges called Pont de la République and Pont Robert Schwint that are busy places. Note that since February the 14 th of 2022, this bridge is closed to all motorised vehicles (Eme-Ziri, 2022).

Fig 4 .

 4 Fig 4.12: Kernel estimate of intensity for the road crashes of Besançon city centre. With package leaflet.

First

  , the data are transformed in order to estimate easier the semivariogram further. The squared root function sqrt is the function chosen to be applied as it as shown good results during our preliminary tests of the method. The locations of the data, as well as the specific attribute tmja are plotted using the function spplot from sp. The range of squared root values are between 23 and 202 as shown in Fig 4.13. Then, the empirical semivariogram is obtained with the function variogram from the package gstat. The result is plotted in Fig 4.14.

Fig 4 .

 4 Fig 4.13: Squared root of traffic density values of 2017.

Fig 4 .

 4 Fig 4.14: Empirical semivariogram of traffic density values of 2017.

Fig 4 .

 4 Fig 4.15: Fit of Gaussian semivariogram model (solid line) and empirical semivariogram (crosses) of traffic density data of 2017.

Fig 4 .

 4 Fig 4.16: Overlay of the study window of the city of Besançon on the kriging grid.

Fig 4 .

 4 17. Note that as the values have been transformed earlier, they have to be transformed onto squared scale in order to go back to the original values.

Fig 4 .

 4 Fig 4.17 shows higher traffic density values in the bottom left that corresponds to the bottom left of the study window. On the other hand, the lowest values of predicted density traffic data are located in the middle and the top of the study window. The object k 2019 that corresponds to the predicted values for the year 2019 has been obtained with the same

Fig 4 .

 4 Fig 4.17: Predicted values of traffic density of 2017 for cells of pred grid.

Fig 4 .

 4 Fig 4.18: Predicted values of traffic density of 2019 for cells of pred grid.

Fig 4 .

 4 Fig 4.19: Traffic density values of 2018 for cells of pred grid.

  Fig 4.20. The function [ , ] from spatstat is named extract.im. The argument drop = FALSE specifies simply that the values outside the subset (here road linnet) are assigned to NA values. Point patterns on the road network for the years 2018 and 2019 have been created using the same command-lines for the creation of controls 2017, named respectively controls 2018 and controls 2019. They are composed respectively of 727 and 928 points. The three point patterns produced are plotted in Fig 4.21. Points seem to be more abundant in the bottom left than on the top of the study window, as expected.

Fig 4 .

 4 Fig 4.20: Plot of the intersection between the pixel image of traffic density values of 2017 and the road network.

Fig 4 .

 4 Fig 4.21: Point patterns simulated on the road network of Besançon according to traffic density values. Left to right: year 2017, 2018 and 2019.

  bind cols. The same command-lines have been computed for the years 2018 and 2019. The objects c 1 2018 sf and c 1 2019 sf, then created, are composed respectively of 118 and 91 controls. The three objects c 1 2017 sf, c 1 2018 sf and c 1 2019 sf are simply merged into one object c 1 sf.

  gam _ quarter <-gam ( flags ~-1 + te (X , Y , quarter , bs = ' cr ' , k = 4 1 + te (x , y , quarter , bs = " cr " , k = 4 ) Approximate significance of smooth terms : edf Ref . df Chi . sq p -value te (x ,y , quarter ) 2

>

  gam _ quarter _ nat <-gam ( flags ~national _ length + + te (X , Y , quarter , bs = ' cr ' , k = 4 ) , + data = bes _ c _ 1 , + family = binomial ( link = logit ) ) > summary ( gam _ quarter _ nat ) Family : binomial Link function : logit Formula : flags ~te (X , Y , quarter , bs = " cr " , k

Fig 4 .

 4 Fig 4.23: Plot of estimated probabilities of being a case from the fit gam quarter nat. Left to right: levels 2, 3 and 4 of quarter. Green to red: probability values from 0 to 1.

Fig A. 2 :

 2 Fig A.2: Plot of prop65 variable values, between 0 and 0.70, per cells of grid cagb sf.

Fig A. 3 :

 3 Fig A.3: Plot of health variable values, between 0 and 80, per cells of grid cagb sf.

Fig A. 4 :

 4 Fig A.4: Plot of school variable values, between 0 and 7, per cells of grid cagb sf.

Fig

  Fig A.5: Plot of college variable values, between 0 and 5, per cells of grid cagb sf.

Fig A. 6 :

 6 Fig A.6: Plot of station variable values, between 0 and 3, per cells of grid cagb sf.

Fig

  Fig A.7: Plot of gasoline variable values, between 0 and 2, per cells of grid cagb sf.

Fig A. 8 :

 8 Fig A.8: Plot of leisure variable values, between 0 and 14, per cells of grid cagb sf.

Fig

  Fig A.9: Plot of intersection variable values, between 0 and 23, per cells of grid cagb sf.

Fig

  Fig A.10: Plot of radars variable values, between 0 and 1, per cells of grid cagb sf.

Fig

  Fig A.11: Plot of municipal length variable values, between 0 and around 13 812, per cells of grid cagb sf.

Fig

  Fig A.12: Plot of national length variable values, between 0 and around 9 762, per cells of grid cagb sf.

Fig B. 1 :

 1 Fig B.1: Variable importance plot for Poisson models aggregation with six covariates randomly included at each iteration.

Fig B. 3 :

 3 Fig B.3: Variable importance plot for Poisson models aggregation with ten covariates randomly included at each iteration.

Fig B. 5 :

 5 Fig B.5: Variable importance plot for the Random Forest model with eight covariates randomly included at each iteration.

Fig C. 1 :

 1 Fig C.1: Fit of Gaussian semivariogram model (solid line) and empirical semivariogram (crosses) of traffic density data of 2019. Arguments of fit.variogram : model = "Gau", psill = 3200, range = 2200 and nugget = 1000.

  Tab 1.6 gives two partial tables of the seven-way contingency table made with type acc, substance, department, time, season, week et daytime as categorical variables. It is quite difficult, actually, to give the whole seven-way contingency table due to the high number of cells

							values
			type acc		type acc
	D, S, Ti, Se, Da	week	slight safe serious fatal	slight safe serious fatal
	Doubs
	none	weekday	10	27	4	8,33	32,01 7,02
	7am 10am	week end	2	8	0	2,06	10,96 1,95
	spring
	day
	D, S, Ti, W, Da	season	slight safe serious fatal	slight safe serious fatal
	Doubs	spring	8	36	8	5,90	31,34 5,57
	none	summer	4	44	6	5,44	41,08 7,24
	11am 3pm	autumn	5	30	2	3,68	30,19 6,15
	week end	winter	2	18	4	4,52	24,26 4,87
	day

  Each variable can be plotted, here are command-line examples for Fig 2.9 which represents range of values of the variable shop per grid cagb sf cells :

	> grid _ cagb _ sf % >%
	+	dplyr :: select ( shop ) % >%
	+	ggplot () +
	+	geom _ sf ( aes ( fill = shop ) ) +
	+

  As mentioned before and described in Algorithm 2, the aim of the aggregation process is to average all the predictions computed in the M iterations. The mean of predictions Ns train and Nstest , where Ns = 1

	Then, the R-squared values on selection train and selection test are defined as
	R 2 s = 1 -			ns i=1 ( Ns,i -N s,i ) 2 ns i=1 ( Ns -N s,i ) 2 ,	s in {s train , s test }	(3.28)
	Ns =	1 M	M m=1	N Bm s ,	s in {s train , s test }
				M	M m=1	N Bm s	for s ∈ {s train , s test }, are used then in order
	to evaluate model accuracy metrics. First, the Mean Squared Errors (MSE) of our process
	on selection train and selection test are defined as
	M SE s =	1 n s	ns i=1	(3.27)

Bm,j = err OOB Bm,j -err OOB Bm 5. Compute the prediction of the number of accidents on the two whole subsets selection train and selection test, respectively denoted as N Bm s train and N Bm stest (II) Average all the predictions for the subsets selection train and selection test ( Ns,i -N s,i ) 2 , s in {s train , s test }.

  Tab 3.1: Mean squared error (MSE) and R-squared (R 2 ) values of various statistical models fitted on the road crash data.

			selection train	selection test
	Model fitted	Number of covariates introduced	MSE R-squared	MSE R-squared
	Poisson regression	13	1.14	0.70	0.42	0.69
	Poisson regression with AIC	7	1.19	0.68	0.45	0.67
	Poisson regressions aggregation	4	1.39	0.63	0.58	0.57
		6	1.16	0.69	0.46	0.66
		8	1.09	0.71	0.42	0.69
		10	1.07	0.72	0.41	0.70
		13	1.18	0.69	0.42	0.69
	Random Forest	8	0.28	0.92	0.51	0.62

  Tab 3.3: Confusion matrix results.

				Model
	Metric	LGCP1	LGCP2	LGCP3	LGCP4	LGCP5	LGCP6
	Sensibility	91.45	90.13	92.76	92.11	90.13	92.76
	Precision	33.49	38.70	39.50	34.06	37.23	34.90
	Specificity	77.19	82.07	82.15	77.60	80.91	78.26
	Accuracy	78.78	82.97	83.33	76.87	81.92	79.88
	F1-Score	49.03	54.15	55.40	49.73	52.69	50.72
	AUC	94.51	95.17	95.03	94.68	94.67	95.06
	accuracy, precision and F1-score values associated to this threshold are respectively 92.76%,
	82.15%, 83.33%, 39.50% and 55.40%.

  Tab 3.4: Parameter estimates of LGCP3 model.

	Parameter	Median	Lower 95% CRI	Upper 95% CRI
	exp(β Intercept )	4.78e-08	2.54e-08	8.34e-08
	exp(β municipal length )	26.65	8.10	101.71
	exp(β national length )	87.80	33.96	264.83
	exp(β intersection )	2.99	1.50	7.14
	exp(β station )	2.12	1.09	4.31
	exp(β prop65 )	3.53	0.61	17.49
	exp(β leisure )	2.18	0.87	5.57

  .7) The function γ Y (•) is called the semivariogram. Developing the second state in Eq 4.7 gives γ Y (h) = C Y (0) -C Y (h). The semivariogram γ Y (•) is unknown is estimated based on data t(u 1 ), . . . , t(u n ). The processes T (•) and Y (•) are related through the relation given in Eq

  Tab C.2: Results of GAMs fitted on the dataset bes c 4. The item * means that the p-value of the nullity coefficient test is less than 0.05. Dans cette thèse, nous nous intéressons à l'analyse statistique des données d'accidents routiers dans la région Franche-Comté. Plusieurs problématiques sont étudiées selon que l'on adopte un point de vue rétrospectif (analyse des facteurs de risques des accidents déjà produits) ou prédictif (position spatiale et période temporelle les plus à risque). Pour se faire, nous avons employé des méthodes de prédiction plutôt classiques d'apprentissage statistique et des outils de prédiction spatiale et spatio-temporelle. La première partie de la thèse est centrée sur l'analyse statistique de la gravité des accidents. De nombreux facteurs (tels que la consommation d'alcool et/ou drogues, le département, le moment de la journée) sont mis en relation avec la gravité de l'accident via des approches non-supervisées ou supervisées d'apprentissage statistique. La dépendance entre ces éléments est modélisée par des modèles log-linéaires proposés suite à une analyse préliminaire de correspondances multiples et également par une régression logistique ordinale. Ces deux modélisations permettent de quantifier l'effet des différents facteurs de risques sur la gravité des accidents. La deuxième partie de la thèse porte sur la prédiction spatiale ou spatio-temporelle de la survenue d'un accident. Les données d'accidents sont modélisées par des processus de Cox log-Gaussiens (LGCP) basés sur les coordonnées géolocalisées des accidents ainsi que sur des covariables socio-démographiques et d'infra-structures routières afin d'identifier les zones géographiques les plus critiques. Nous proposons également une méthode de sélection de variables basée sur une aggrégation de modèles de Poisson et un critère d'importance de variables pour sélectionner les variables les plus importantes à incorporer dans le modèle LGCP. Le meilleur modèle est utilisé pour déterminer les zones les plus risquées. Dans un deuxième temps, la composante temporelle est ajoutée à l'étude et une modélisation semiparamétrique par modèle additif généralisé est proposée afin d'identifier les zones et périodes critiques.

	Résumé.
	Environment covariate included Environment covariate included	Estimate p-value Estimate p-value	Smoothing term included Smoothing term included	p-value p-value
				te(X, Y, quarter) te(X, Y, quarter)	1.29e-04 * 1.28e-06 *
				te(X, Y, month) te(X, Y, month)	2.48e-06 * 3.19e-03 *
				te(X, Y, day) te(X, Y, day)	2.16e-06 * 2.16e-06 *
		-0.19 0.82	0.92 0.57	te(X, Y, quarter) te(X, Y, quarter)	1.73e-04 * 2.92e-06 *
	prop18 prop18	-0.68 -0.01	0.78 0.99	te(X, Y, month) te(X, Y, month)	0.07 0.02 *
		0.57 0.56	0.79 0.73	te(X, Y, day) te(X, Y, day)	1.33e-04 * 4.09e-06 *
		0.96 -0.49	0.31 0.48	te(X, Y, quarter) te(X, Y, quarter)	7.16e-04 * 3.58e-06 *
	prop65 prop65	1.01 -0.81	0.41 0.30	te(X, Y, month) te(X, Y, month)	0.12 0.03 *
		1.03 -0.81	0.33 0.28	te(X, Y, day) te(X, Y, day)	2.87e-04 * 3.70e-06 *
		1.95 1.18	0.24 0.16	te(X, Y, quarter) te(X, Y, quarter)	6.58e-04 * 2.92e-06 *
	health health	0.69 0.69	0.44 0.44	te(X, Y, month) te(X, Y, month)	0.03 * 0.03 *
		2.35 0.65	0.19 0.45	te(X, Y, day) te(X, Y, day)	3.12e-04 * 4.69e-06 *
		1.95 0.12	0.24 0.85	te(X, Y, quarter) te(X, Y, quarter)	6.58e-04 * 1.45e-06 *
	school school	1.68 -0.11	0.27 0.86	te(X, Y, month) te(X, Y, month)	0.08 0.02 *
		2.13 -0.25	0.17 0.70	te(X, Y, day) te(X, Y, day)	1.52e-04 * 2.31e-06 *
		-2.25 0.01	0.32 0.99	te(X, Y, quarter) te(X, Y, quarter)	1.39e-04 * 1.28e-06 *
	college college	-1.67 -0.17	0.51 0.93	te(X, Y, month) te(X, Y, month)	0.07 0.02 *
		-1.01 -0.09	0.66 0.96	te(X, Y, day) te(X, Y, day)	1.24e-04 * 2.14e-06 *
		4.75 3.35	0.04 * 0.01 *	te(X, Y, quarter) te(X, Y, quarter)	8.58e-04 * 4.67e-04 *
	shop shop	5.37 2.66	0.04 * 0.04 *	te(X, Y, month) te(X, Y, month)	0.11 0.08
		5.69 2.48	0.02 * 0.07	te(X, Y, day) te(X, Y, day)	3.64e-04 * 3.47e-05 *
		2.95 1.75	0.12 0.09	te(X, Y, quarter) te(X, Y, quarter)	1.03e-04 * 1.53e-06 *
	station station	1.89 1.40	0.33 0.19	te(X, Y, month) te(X, Y, month)	0.07 0.02 *
		2.89 1.89	0.14 0.08	te(X, Y, day) te(X, Y, day)	1.09e-04 * 2.21e-06 *
		0.92 1.18	0.20 0.02 *	te(X, Y, quarter) te(X, Y, quarter)	1.59e-04 * 1.38e-06 *
	gasoline gasoline	1.45 1.12	0.09 0.04 *	te(X, Y, month) te(X, Y, month)	0.06 0.02 *
		1.19 0.96	0.12 0.07	te(X, Y, day) te(X, Y, day)	7.3e-05 * 3.16e-06 *
		-1.14 -1.46	0.37 0.19	te(X, Y, quarter) te(X, Y, quarter)	1.21e-04 * 2.83e-06 *
	leisure leisure	-1.28 -1.72	0.37 0.13	te(X, Y, month) te(X, Y, month)	0.06 0.02 *
		-0.67 -1.74	0.62 0.13	te(X, Y, day) te(X, Y, day)	1.05e-04 * 1.70e-06 *
		1.63 3.28e-03 * 1.73 1.15e-06 *	te(X, Y, quarter) te(X, Y, quarter)	2.04e-03 * 6.77e-05 *
	intersection intersection	1.44 1.58 1.70e-05 * 0.02 *	te(X, Y, month) te(X, Y, month)	0.13 0.06
		1.71 3.13e-03 * 1.57 1.44e-05 *	te(X, Y, day) te(X, Y, day)	6.70e-04 * 3.78e-05 *
		0.39 1.14	0.74 0.22	te(X, Y, quarter) te(X, Y, quarter)	1.54e-04 * 2.19e-06 *
	radars radars	0.22 1.49	0.89 0.14	te(X, Y, month) te(X, Y, month)	0.06 0.02 *
		0.63 1.29	0.62 0.17	te(X, Y, day) te(X, Y, day)	1.19e-04 * 2.76e-06 *
		-0.11 -0.18	0.86 0.71	te(X, Y, quarter) te(X, Y, quarter)	1.51e-04 * 1.29e-06 *
	municipal length municipal length	0.07 -0.18	0.93 0.72	te(X, Y, month) te(X, Y, month)	0.06 0.02 *
		-0.06 -0.22	0.93 0.65	te(X, Y, day) te(X, Y, day)	1.24e-04 * 2.01e-06 *
		1.90 4.53e-04 * 1.93 1.74e-07 *	te(X, Y, quarter) te(X, Y, quarter)	2.14e-05 * <2e-16 *
	national length national length	1.32 1.70 2.78e-05 * 0.04 *	te(X, Y, month) te(X, Y, month)	0.04 * 4.84e-03 *
		1.30 1.71 1.73e-05 * 0.03 *	te(X, Y, day) te(X, Y, day)	6.14e-05 * 1.16e-06 *

Je tiens à remercier vivement tous ceux du Laboratoire de Mathématiques de Besançon (LmB) qui, de près ou de loin, ont participé à cette thèse. Je pense notamment à Julien qui s'est arraché les cheveux avec moi sur le plan informatique, il m'a accordé un temps précieux et n'a jamais refusé de discuter longuement avec moi de nos passions pour la programmation. Merci à Charlène et Pascaline pour leur disponibilité et leur service, sans qui, aucune conférence ni aucun voyage n'aurait été

This chapter leads to an article that has been accepted for publication in Communications in Statistics: Case Studies, Data Analysis and Applications.

The reader can find the BAAC open data on the government website https://www.data.gouv.fr/fr/

This chapter leads to an article writing in progress for publication.

This chapter corresponds to a work in progress with Benjamin Taylor started when visiting University of Lancaster in April and May

> d _ centre _ ras <-raster ( as . matrix ( density _ centre ) )

Remerciements

Log-Gaussian Cox Processes pre-processing: variable selection

Our main goal is the analysis of georeferenced road crashes in CAGB and more exactly, to prevent and/or forecast road accidents. Taking into account the spatial characteristics of these accidents therefore seems essential. Hence, the statistical modelling of spatial dependence and potential risk factors is a major asset. More specifically regarding risk factors, the information will be incorporated through covariates in order to build a model according to a "explanatory-predictive tradeoff". Hence, it has to be decided which covariates will play a part in the analysis.

We will use a LGCP to model the occurence of the road crashes in CAGB and we will include spatially explanatory covariates in the varying intensity function λ(•) as explained in Section 3.3. However, algorithms used in order to run a LGCP are computationally challenging and time consuming. For example, [START_REF] Ramírez | Spatiotemporal correlation study of traffic accidents with fatalities and injuries in bogota (colombia)[END_REF] fitted a "saturated" model (i.e. a model with all the available covariates) for which the total computation time was around two days by using a 2.2 GHz Intel core i7-4702MQ processor with 16Gb of RAM and they reduced the computation time to one day by using a model based only on the significant covariates chosen manually. We suggest in this work automatic variable selection methods and variable selection criterion in order to choose the most important covariates, in a small number, to be used next in a LGCP model allowing in this way an important reduction of the computation time. In order to do that, we need to do first several preliminary data processing operations such as normalization and interpolation of covariates on the chosen grid. Next, variable selection methods based on Poisson aggregation and variable importance criterion will be used in order to choose the most important covariates to be plugged-in the LGCP model. We consider all these preliminary treatments as LGCP pre-processing.

We consider the covariates as structured and associated to the computational grid of the LGCP as described in Chapter 2. The data are loaded as follows: + colnames ( tmp ) <-c ( " proba " , " obs " , " geometry " )

+ # AUC computation > pROC :: roc ( response = tmp $ obs , predictor = tmp $ proba ) $ auc Setting levels : control = 0 , case = 1 Setting direction : controls > cases Area under the curve : 0 . 9 5 0 3

First, a vector threshold is set containing various threshold values to be used. Then, storing objects sensi, speci, acc, prec and f1 score are declared for respectively each confusion matrix metrics sensitivity, specificity, accuracy, precision and F1-score. A for loop enable to iteratively run the creation of a sf object named tmp (as temporary) that contains the observed values of obs sf and the probabilities that no accident happened of lgcp3 proba0, the transformation of these probabilities to the binary class regarding to the t th element of threshold, and finally the computation of the corresponding confusion matrix and its associated metrics. Finally, the AUC is computed using the function roc of the package pROC. Note that the command-lines used above contain redundant steps. Indeed, it would have been more optimal not to compute the class of the observed values at each iteration of the for loop for example.

The first metric AUC value is 95.03e-02 which tells that how much the model lgcp3 enables to distinguish between classes. The higher the AUC value is, the better model is for predicting the classes 0 and 1. The final model lgcp3 is the best model regarding to the

Summary of the spatial analysis of the urban community of Besançon road crashes and discussions

Summary results

The LGCP model is a tool for modelling a spatial point pattern assumed to be generated by an inhomogeneous Poisson process from which the intensity is a stochastic process assumed to vary spatially. The analysis goals of this chapter were to identify the critical areas of the CAGB while highlighting the risk factors.

A significant number of factors were available for the analysis. However, the LGCP model represents a challenge in terms of calculation and computation time. In order to choose which factors would play a role in the analysis, we proposed to proceed with a variable selection before fitting the LGCP based on the Poisson distribution, which is as close as possible to the LGCP statistical modelling. The variable selection methods, mainly inspired by Random Forest, established six variable combination to be fitted in the LGCP. Hence, six LGCP models have been fitted and have been then assessed in order to choose the best model from both explanatory and predictive points of view. The best model consists of the covariates national length, municipal length, intersection, station, prop65 and leisure. This model enables to conclude that 91.13% of the predicted values are correlated to the observed values. In addition, we are able to predict in 92.76% of cases the occurrence of accidents.

Finally, to meet the objectives of the analysis mentioned above, we proposed to produce maps plotting the probability that one, five and ten accidents occur. This allows us to conclude on the riskiest area of the CAGB, corresponding to an area where the N 57 and D673 roads intersect and represents an area known to be very busy. Then, we are able to say that the most risky factors in the hierarchical order are the length of national roads, the length of municipal roads, the number of intersection and the number of stations (train or taxis) per unit area.

Discussions Work realized in this chapter may be extended in several directions. It would have been interesting to compare the LGCP fits to other spatial statistical modellings. One possible extension with the same framework as the one set for the LGCP fits, is to model the number of road crashes per cell by with a Poisson distribution in a semiparametric model, inspired from Generalized Additive Models, for which the road crash spatial components longitude and latitude could be fitted in smooth functions (Wood, 2017, Chapter 7). Some similar examples will be given in Chapter 4.

On the other hand, it would have been interesting also to compare the LGCP prediction performances to other statistical models. The methods undertaken for the variable selection are actually models that can be compared to the LGCP as the statistical framework was the same: the number of road crashes per cell of the grid; covariates values per cell of the grid. Actually, the results have shown, according to the R-squared values, that the LGCP fits are the best. However, there exist many machine learning methods such as boosting models, support vector machines, neural networks, ... [START_REF] Bao | A spatiotemporal deep learning approach for citywide short-term crash risk prediction with multi-source data[END_REF][START_REF] Tang | Improving the transferability of the crash prediction model using the TrAdaBoost.R2 algorithm[END_REF][START_REF] Dong | Support vector machine in crash prediction at the level of traffic analysis zones: assessing the spatial proximity effects[END_REF][START_REF] Li | Real-time crash risk prediction on arterials based on lstm-cnn[END_REF]. One major difficulty to use such methods on our road crash data is the lack of information recorded at a very fine scale (for example the traffic

DESCRIPTIVE ANALYSES

> date _ format <-" % d % B % Y % Hh % M :% S " > bes <-bes % >% + mutate ( date _ single = as . POSIXct ( date , format = date _ format ) )

The format on which the date will be handled is specified in date format. Then, the class is defined with the function as.POSIXct.

The advantages of using the class POSIXct is that it is easier to handle the temporal characteristics of the variable. Indeed, many functions of the software, in the base or with packages such as lubridate for example, help to directly deal with the year, the month, the day and the time. For instance, the number of accidents per month in a year can be visualized as follows:

> m _ levels <-c ( " January " , " February " , " March " , " April " , + " May " , " June " , " July " , " August " , + " September " ," October " , " November " , " December " ) > tmp <-tmp % >% + mutate ( year = year ( date ) , + month = factor ( months ( date ) , levels = m _ levels ) )

> tmp % >% + ggplot ( aes ( month ) ) + + geom _ bar ( width = 1 ) + + facet _ wrap (~year , nrow = 1 ) + + theme ( axis . text . x = element _ text ( angle = 9 0 , vjust = 0 . 5 , hjust = 1 ) )

The year and the month of each observation in the dataframe are obtained respectively with the functions year and month. Command-lines above produced the Fig 4 .1. The number of road crashes per month vary from year to year, we can make the hypothesis that there is probably no seasonality. What could probably be interesting is to investigate why in April, May and June of 2018, the number of road crashes is much higher than in 2017 and 2019.

We propose now to plot the number of road crashes per trimester in a year. This is computed as follows:

> q _ levels <-c ( " Q 1 " , " Q 2 " , " Q 3 " , " Q 4 " ) > tmp <-tmp % >% + mutate ( quarter = factor ( quarters ( date ) , levels = q _ levels ) ) > tmp % >% + ggplot ( aes ( quarter ) ) + + geom _ bar ( width = 1 ) + + facet _ wrap (~year , nrow = 1 ) + + theme ( axis . text . x = element _ text ( angle = 9 0 , vjust = 0 . 5 , hjust = 1 ) )

The trimester of each observation is obtained with the function quarter. Command-lines above produced the Fig 4 .2. Graphically, it is easier to see that the number of road crashes is higher in 2018 than in 2017 and 2019.

The data can also be plotted in space and time. First, the creation of the sf object from bes is computed as follows:

The CRS is modified in order to use Lambert 93 as usual. On the other hand, as you can see, the conversion to a sf object did not modify the class of date.

Then, the road crashes point pattern of the city of Besançon can be visualized as follows:

> owin _ bes _ sf <-st _ as _ sf ( owin _ bes ) > st _ crs ( owin _ bes _ sf ) <-st _ crs ( bes _ sf ) We propose now to plot the road crash point pattern per day in a year. In Chapter 1, a variable week was used in order to compare the injury accidents that happened during the week to the ones happening during the weekend. Our results have concluded on the fact that accidents happening during the weekend were riskier than the ones happening during terms to be displayed on the x and y dimensions of the plot. Then, the attribute view is a list of the values to use for the other predictor terms. Note that the column quarter has been labelled differently as seen previously in Section 4.2 and is of type double with values 1, 2, 3 and 4. Here the value equal to 1 of the covariate quarter has been taken as an example. Command-lines above produced The plots for the remaining values 2, 3 and 4 of the covariate quarter have been produced using similar command-lines as above. The corresponding plots are given in Fig 4 .23. The comparison of the estimated probabilities according to each level of quarter is slightly varying. The probability of being a case is higher in the middle of the study window as well as in the bottom left, for each trimester. The middle of the study window corresponds to a circle of centre approximatively equal to the train station Gare Viotte of the city of Besançon. Then the bottom left of the study window corresponds globally to the departmental road D673. Remind that in Chapter 3, the riskiest cell of the urban community of Besançon (CAGB) was a cross between roads N 57 and D673. The zone of this cell is clearly included in the bottom left of the study window here.

Summary of the space and times analyses of the Besançon road crashes and discussions

Summary results

In order to conduct a space and time analysis of the Besançon road crashes, the chosen statistical method was inspired from case-control studies. As only the group of cases (occurred accidents) was available, the group of controls had to be simulated.

To do so, two big steps have been set: the manipulation of the road network; the traffic Appendix A

Spatial road crashes and related factors data handling

This appendix corresponds to the supplementary materials of Chapter 2. In the following, the reader may find plots of each variable values that composed the object grid cagb sf created in Section 2. This appendix corresponds to the supplementary materials of Chapter 3. In the following, the reader may find a table that summarizes the result of the variable selection methods fitted, variable importance plots for the Poisson models aggregation and Random Forest methods, trace plots and autocorrelation plots of the parameters of the model LGCP3.

The variable selection methods have been fitted on various training samples : first a training sample based on the SMOTE method ; second a training sample where the distribution has been preserved ; finally on the whole dataset. The results are given in Tab B.1.

The variable importance plot for the Poisson models aggregation where six, eight, ten and all the covariates have been randomly selected at each iteration is given respectively in The results of the space and time semiparametric models fitted on the datasets bes c 1 and bes c 4, that respectively corresponds to the dataset of cases and controls from which the matching ratio is 1:1 and 1:4, are respextively given in Tab C.1 and C.2.