# A Cox Model-Based Workflow for Increased Accuracy in Activity-Travel Patterns Generation
## 3 Methodology
Each observation can belong either to one group or the other, depending on both the individual characteristics it possesses and the individual characteristics of the others, and this is calculated using probabilities as will be further explained. The model is based on the estimation of a Cox model with frailty, using a non-parametric baseline hazard function:  
\[h_{i}(t)=ho(t)\sum_{c=1}^{2}Z_{ic}*\exp(\beta_{c}^{T}X_{iK}+frailty_{c})\]  
where:  
* \(h_{i}(t):\) The hazard function for individual \(i\) at time \(t\),
* \(h_{0}(t)\): The non-parametric baseline hazard function,
* \(Z_{ic}\): The probability that individual \(i\) belongs to latent class \(c\),
* \(X_{i}\): The vector of predictor variables for individual \(i\),
* \(\beta_{c}\): The vector of coefficients for latent class \(c\),
* \(frailty_{c}\): The frailty term for class \(c\), calculated as:  
\[frailty_{c}=z_{frailty_{c}}*\sigma_{frailty}\]  
where:  
* \(z_{frailty}\) is an uncentered random factor ranging from 0 to 1,
* \(\sigma_{frailty}\) is the standard deviation. Given this fundamental discussion, the sets, parameters and variables of our model are presented in more detail in Table 2.  
Regarding the model's input, a research survey conducted by the National Technical University of Athens (NTUA) is used, with the analysis focusing on daily activity chains of a typical working day. Table 3 below presents all the variables included in the study. \begin{table}
\begin{tabular}{c c} \hline \hline  & _Sets_ \\ \hline \(K\) & Set of covariates included as predictive factors in the model \\ \(C\) & Set of Latent Classes \\ \(I\) & Set of Observations \\ \hline  & _Parameters_ \\ \hline \(\beta_{c,x}\) & Coefficients for each characteristic \(k\) and latent class \(c\) \\ \(z_{frailty}\) & Latent frailty variables for each class \\ \(\sigma_{frailty}\) & Standard deviation of frailty terms \\ \(class_{probs}\) & The probabilities of belonging to each latent class \\ \hline  & _Variables_ \\ \hline \(activity\) & The duration of activity (survival time) for each observation i \\ \(Mur_{i}\) & The vector of predictor variables k for each observation i \\ \(X_{iK}\) & The censoring variable (1 = event occurred, 0 = censored) \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Cox model’s characteristics. To add a bit of perspective on the input data used in the models and the proposed workflow, the columns in Table 3 are explained in the following paragraph. The table outlines various survey variables used to analyze activity-travel patterns, grouped into Demographic, Spatial, Mode Choice, and Temporal categories. Demographic variables include gender, age, education, employment, income, and car ownership, with most being categorical except for age, which is continuous. Spatial variables describe destination and home locations, with the home variable assumed to match the destination in categorical form. Mode Choice is represented by the categorical \"Mode\" variable, which captures different transportation types such as car, taxi, bus, train, and others. Finally, the Temporal variables include \"Time\" and \"Distance\", both continuous, representing the trip start time and travel distance, respectively. The survey variables described in Table 3 are used as features in the Cox and Cox-based machine learning models, as detailed in later sections. The same variables/features are the ones of the synthetically generated datasets, since the goal of the workflow is to create a wider OD dataset based on an initial one that comes from a small-scale survey. **Latent Class Membership Probabilities**  
For classifying observations into the two latent classes, we use the probability \(Z_{ic}\). This represents the a posteriori probability that observation \(i\) belongs to latent class \(c\).