# Applying Spectral Clustering to Decode Mobility Patterns in Athens, Greece
## 2 Data and Methods
### Data Collection and Processing  
The data used to conduct this research were collected from a revealed preferences online survey distributed by the Hellenic Broadcasting Corporation (ERT) websites and radio frequencies in 2022. The number of survey participants was 513 coming from almost all zones of AMA (see the maps in Appendix A). The innovation of the data collection process lies in the distribution strategy, as these channels are accessed by a diverse group of people. The survey was anonymous, and respondents were not required to provide all their socio-demographic information. Consent was obtained from all participants in the research. Initially, participants responded to questions about demographic and socio-economic content. In more detail, they were asked about their gender, age, level of education, employment status, income category, residential zone, and whether they own a private car. Subsequently, respondents were asked to describe five trips they made on a typical workday. For each trip, the purpose of the trip, the departure time, the mode of transport, and the destination zone were to be mentioned. The available mode options were car (driver or passenger), taxi, bus (or trolley bus), train (metro, tram, and suburban railway), motorcycle, bicycle (or e-bike), walking, and e-scooter. The purposes of the trips could be work, returning home, education, shopping, recreation, service, and other. The travel time was given in a 24 h timeframe. AMA was divided into 36 zones, with one of these zones referring to transitioning outside of the study. Through this zoning system, respondents reported their residential zone without further specifying their location. A centroid per zone was defined, so that the travel distances can be estimated. In the measurement process, a Euclidean distance multiplied by 1.3 was used. In other words, the network distance in Athens is 30% larger than the Euclidean distance. The parameter value is based on a mean factor derived from previous accessibility analyses conducted in the same city [35]. Another assumption that was made in the data collection is that the first trip of the day starts from home. It is also assumed that the destination zone of trip \(i\) is the origin zone of trip \(i+1\), creating a chain of activities. In this analysis, each trip comprised a separate and independent observation. The final dataset contained 1347 trips. Table 1 gives a summary of the variables that are considered in two different stages of the data analysis process. The variables that imported in the spectral clustering were the travel distance (from centroid to centroid), the start time of the trip, the transport mode, as well as the trip purpose. These constitute the main attributes of trips. The data were processed by applying a dummy coding scheme in all the categorical variables. This means that for each level of each categorical variable, one variable with binary format (0 or 1) was created in the dataset. This approach enables the exploration of potential non-linear relationships between categories that cannot be naturally ordered (e.g., transport mode or trip purpose). Socio-demographic characteristics are not imported in the cluster analysis, but they were utilized later to interpret the clusters. A Chi-squared test is later conducted to investigate potential statistically significant dependencies between clusters and socio-demographic characteristics. In this process, dummy coding is applied to both socio-demographic characteristics and trip clusters. At this point, it should be mentioned that socio-demographic attributes describe the trip 'owner' and not the trip itself. The data analysis with spectral clustering was conducted in Python, using the following open-source packages: NumPy (version 1.21.5), Scikit-learn (version 1.0.2), Matplotlib (version 3.5.2) SciPy (version 1.9.1) and Panda (version 1.4.4). The computations were carried out on a system equipped with an Intel i8 processor and 16 GB of RAM.