# Cyber-Secure IoT and Machine Learning Framework for Optimal Emergency Ambulance Allocation
## 3 Methodology
### Simulation-Based Weight Calibration  
To facilitate the practical application of the machine learning model in real-world policy decision-making, a simulation-based weight calibration procedure was developed. This simulation system was designed with a dual focus on operational flexibility in the field and policy scalability. It allows users to dynamically adjust key input variables, after which the predictive results are automatically recalculated in real time. This design ensures that the model's outputs function not merely as static forecasts but as adaptable tools for conducting sensitivity analyses and constructing policy scenarios. The simulation engine generates recommended ambulance deployment volumes or expected dispatch durations based on user-defined input variables at the EMS center level. These variables include population size within the jurisdiction, daily dispatch volume, number of inter-center critical patient transfers, average dispatch duration, number of local food establishments, and incidence of traffic accidents. Users can input values manually or adjust them via interactive controls. The simulation then compares these user-defined inputs with the model's baseline values and recalculates the outcome by applying variable-specific weights that reflect each feature's relative importance. The prediction mechanism is built upon a reference baseline, adjusting the predicted values by computing the weighted differences between user-provided inputs and their corresponding baseline values. This can be formally expressed as  
\[\hat{y}=y_{ref}+\sum_{i=1}^{n}w_{i}\cdot\left(x_{i}-x_{i,ref}\right)\]  
where \(\hat{y}\) is the adjusted prediction, \(y_{ref}\) is the baseline value, \(x_{i}\) represents each user input variable, \(x_{i,ref}\) is the corresponding baseline input value, and \(w_{i}\) is the weight assigned to the \(i-th\) variable based on its learned importance in the predictive model. For example, variables such as population size and the number of critically ill patients exert a strong influence on demand prediction and are therefore assigned relatively high weights. In contrast, indirect variables, such as the number of restaurants or local alcohol consumption rates, are given lower weights due to their weaker direct impact on emergency response needs. Rather than relying on a simple weighted average, the simulation model adopts a baseline-adjusted prediction mechanism based on the deviation of each input variable from its reference value. Each deviation is multiplied by a pre-defined weight, and the cumulative result is added to the baseline to produce the final output. This approach enhances both transparency and interpretability, allowing users to understand how changes in individual inputs affect the prediction. Moreover, the system is designed such that adjustmentsto input variables are immediately reflected in the visualized results, enabling intuitive exploration of scenario outcomes in real time. All simulation weights are calculated using a standardized reference framework across all EMS centers, ensuring consistency in comparative analyses. Based on these weights, the system can support policy scenario design, such as increasing or decreasing ambulance allocations, reassigning hospital linkages, or reconfiguring regional deployment strategies. Simulation results can be visualized either as temporal scenarios or spatial distribution maps, offering decision-makers a user-friendly interface through which they can explore center-specific recommendations, structural risk levels in emergency response, and the capacity of nearby hospitals based on weighted rankings. This simulation framework provides a systematic basis for identifying not only areas with high emergency response demand but also regions where structural delays in response time are prevalent.