## 2 Materials and Methods
### Data  
The data used in this study consist of two datasets: soccer and weather. The data on soccer results are from previous matches played in the Spanish La Liga and Segunda division (La Liga 2) in the seasons 2013-2014 to 2017-2018. These are the top two divisions in men's professional football in the Spanish football league. Overall, 20 teams compete in La Liga and 22 in the Segunda division. After each season, the three teams that finish in the lowest positions in La Liga are relegated and replaced by the two best teams and the winner of a play-off in the Segunda division. The data are available online in comma-separated values (CSV) files [19]. They include shots on goal, corners, fouls, offsides, odds (more than ten major online bookmakers, for example, Bet365, Blue Square, Gamebookers, Interwetten, Ladbrokes, William Hill odds), red cards, referees, and full-time and half-time results. The weather data were obtained from the Agencia Estatal de Meteorologia (AEMET) [20]. They include a station identifier, date, maximum temperature (\({}^{\circ}\)C), time of maximum temperature, minimum temperature (\({}^{\circ}\)C), time of minimum temperature, average temperature (\({}^{\circ}\)C), maximum gust of wind (Km/h), the maximum gust time, maximum wind speed (Km/h), maximum wind speed time, daily total precipitation (mm), precipitation from 00.00 to 06.00 (mm), precipitation from 06.00 to 12.00 (mm), precipitation from 12.00 to 18.00 (mm), and precipitation from 18.00 to 24.00 (mm). To combine two datasets, the first step was to find the nearest weather stations to the stadiums where certain football matches took place. Figure 2 shows the location of the weather stations and the stadiums in Spain. Overall, there are 775 weather stations and 25 stadiums in the selected datasets. After finding the closest weather station, the next step was to join the two datasets using ID and Date columns. The features that were extracted for this study are dates, names of teams, odds (_Bet365_, _BetEWin_), maximum, minimum and average temperature, precipitation, maximum gust of wind, and maximum wind speed. The dataset contains 3884 records, excluding all null values. Table 1 displays existing weather variables, new created variables using several features from an existing list  
Figure 2: The location of weather stations and stadiums in Spain. and equivalent ranges, where _Tmax_, _Tmin_, _Tmed_ are maximum, minimum, and average temperatures, _Racha_ is maximum gust of wind, _Tprec_ is daily total precipitation, _Vmax_ is maximum wind speed, _Tmed_Diff_ is the average temperature difference, _Trange_Diff_ is the difference in temperature range, _Tprec_Diff_ is the difference in precipitation, and _Vmax_Diff_ is the difference in wind speed (the last four components are calculated using the home team and the away team observations). Regarding full-time results for the whole period, Figure 3 illustrates the distribution as a percentage for each case: home win, draw, and away win. It can be seen that the number of full-time results with the home team winning exceeds other results, which can be explained by the advantage enjoyed by the home team. Many studies and analyses aim to reveal the benefits of a home team [21; 22]. There are many factors behind this concept, such as traveling, fans, referees, and field composition. Traveling, which is closely related to the research questions of this study (weather conditions), as well as the duration of the journey, and geographical conditions affect the performance of teams [23]. Apart from this factor, the influence of fans and referees is also very important. The shouting and noise expressed by the fans can cause low performance in the away team, but more often it can affect referees when it comes to making a decision, and it is obvious that the referees' decisions can have a vital effect on the final result [24]. Several studies have confirmed the belief that referees are biased toward the home team [25; 26].