The master thesis is focused on the analysis of the average waiting time for patients from triage evaluation to treatment in the emergency rooms of Trieste and Udine. The thesis is based on the publicly available data provided by the Region Friuli Venezia Giulia (on the web page https://servizionline.sanita.fvg.it/psonline/#/index); data were collected between 24th of December 2016 and 19th of January 2017. The publicly available data are updated every 10 minutes and include the number of patients in waiting room, the number of patients in treatment and their average waiting time. We observed that the publicly available average waiting times calculations are wrong, as the waiting times of patients in the waiting room and those in treatment are given the same weight. The reported average waiting times thus underestimate the real waiting time. The problem of the wrongly calculated average waiting times is described in detail, as is the data collection process. We propose an algorithm for transforming the publicly available data into suitable data for the correct estimation patients' waiting times. The algorithm transforms the aggregated data into individual records, estimating for each patient the date and time of his or her triage evaluation, beginning of treatment and discharge from emergency room. The algorithm is based on some assumptions that make the estimated average times slightly overestimated. We quantify the magnitude of the overestimation with a series of simulation studies. Based on the reconstructed individual histories we estimate the average waiting times; moreover, we propose a set of regression models that can be used for predicting the average times for new patients. The results of regression models show that there is a difference in waiting times between emergency rooms of Cattinara and Udine. The number of patients in the waiting room has the greatest impact on the waiting time.