A Method to Assess the Accuracy of Pseudo-Random Number Sampling Methods from Evacuation Datasets

We propose a method for assessing the accuracy of pseudo-random number sampling methods for evacuation modelling purposes. It consists of a systematic comparison between experimental and generated distributions. The calculated weighted relative error (Ew_rel) is based on the statistical parameters as central moments (mean, standard deviation, skewness and kurtosis) to shape the distribution. The case study involves the Box–Muller transform, the Kernel-Epanechnikov, the Kernel-Gaussian and the Piecewise linear generating samples from eight evacuation datasets fitted against normal, lognormal and uniform distributions. Keeping in mind that the Bos Muller method has two potential sources of error (i.e. distribution fitting and sampling), this method produces plausible results when generating samples from the three types of distributions (Ew_rel < 0.30 for normal, lognormal and uniform distributions). We also fund that the Kernel Gaussian and the Kernel Epanechnikov methods are well accurate in generating samples from normal distributions (Ew_rel < 0.1) but potentially inaccurate when generating samples from uniform and lognormal distributions (Ew_rel > 0.80). Results suggest that the Piecewise linear is the most accurate method (Ew_rel = 0.01 normal; Ew_rel = 0.04 lognormal; Ew_rel = 0.009 uniform). This method has the advantage of sampling directly from empirical datasets i.e. no previous distribution fitting is needed. While the proposed method is used here for evacuation modelling, it can be extended to other fire safety engineering applications.


Introduction
Computer models are being used to simulate, visualize, manipulate and gain information of evacuation process. It is greatly accepted that evacuation is a random process due to the variability in occupant characteristics, reactions and behaviours [1][2][3][4]. A key point is the way current and future computer evacuation models address this randomness. Evacuation models may be based upon ''best fit curves'' to represent a set of data. In other words, a distribution giving a close fit is supposed to lead to more accurate predictions. This involves two main issues that can increase or decrease the deviation of the behaviour of the potential-actual evacuation from the desired behaviour of the simulated evacuation.
The first issue is the selection of the appropriate Probability Density Function (PDF) that suits the data well. Most computer evacuation models allow the user to introduce random inputs by a defined set of PDFs. Normal, lognormal and uniform are the most commonly used distributions [5][6][7][8][9][10][11][12][13]. Also, other distributions (exponential, polynomial, gamma, beta, triangular, Weibull and Gumbel) have been observed in models [5,[8][9][10][11][12][13]. Some models allow the users to build a PDF based on their own sampling [6,9,[11][12][13][14]. In addition, data to shape the random variables in evacuation models is scarce and limited. We can find a number of works in the literature collecting data [15]. Datasets are usually presented in the following format: average, standard deviation, maximum and minimum values. Information such as sample sizes, data collection techniques and the background conditions are occasionally provided [16,17]. Nevertheless, in most cases, neither the raw data is available nor the type of PDF is defined. Within this context, the user has two options to configure the model for evacuation analysis: (1) choose a PDF (from a library of standard distributions available in the model) and use the parameters from the literature (mean, standard deviation, max. and min. values) or (2) process and use empirical data. The first choice is commonly applied. For instance, the selection of positively skewed distributions for pre-evacuation times and normal distributions for walking speeds is suggested in [18][19][20]. Another approach suggests also the use of uniform distributions [21]. The second one is the most plausible choice (process and use empirical data) as it uses distributions derived from the scenario of analysis.
The second issue is related with the degree to which a random variable (or a set of random variables) within a computer evacuation model conforms to a true value or referent. In other words, the way computer evacuation models generate pseudo-random numbers that are distributed according to a given probability distribution. Although some works have attempted to address uncertainty in evacuation modelling [2,22,23], the analysis of Pseudo-random Number Sampling Methods (PNSMs) potentially applied to evacuation models has been ignored. Furthermore, to the author's knowledge, current evacuation models do not specify the mathematical and computational basis for generating stochastic inputs of the variables. It is well known that the applications for random numbers cover several fields such as simulation [24], chemistry [25] or cryptography [26]. There are several methods for the assessment of the accuracy and robustness of pseudo-random sampling in the literature [26,27]. Studies have focused on randomness testing to

650
Fire Technology 2018 analyse whether or not the generated data by random number generator (RNG) is ''patternless'' and therefore the RNG used is suitable for a particular application. Evacuation modellers can choose validated RNGs from reputable sources. The PNSMs are typically based on the availability of a RNG producing numbers X that are uniformly distributed. Computational algorithms are then used to manipulate a single random variate, X, or often several such variates, into a new random variate Y such that these values have the required distribution. This paper focuses on PNSMs defined here as a transformation from an independent uniform sample or samples [0,1] to a sample of another given distribution. Given the importance of using random variables and understanding the issues associated with the inputs and the intrinsic algorithms of models, our primary objective in this paper is to provide a comprehensive method for assessing the accuracy of different PNSMs when sampling from evacuation datasets. The paper is intended for those involved in evacuation modelling-from model users to model developers-to better understand and improve current and future developments.

Method
This section presents the analysis of different PNSMs when sampling from evacuation datasets. It includes an overview of the proposed method, a description of the evacuation datasets, the PNSMs selected and the description of the software developed for the application case.

Overview of the Proposed Method
Sampling in the statistical sense means to retrieve a value. The value we get is decided by the probability distribution we are trying to sample from. Accuracy is defined here as the closeness of a modelled/computed value to its ''true'' value. The ''true'' value is the value it would have if we had perfect information. Hence, we establish the following postulate: the smaller the relative error between the shape of the observed distribution and the shape of the generated distribution, the more accurate the PNSM used. Figure 1 shows an overview of the proposed method to assess the accuracy of PNSMs for evacuation modelling purposes. It mainly consists of a systematic comparison between experimental and generated distributions including both Analytical and Empirical PNSMs. Analytical PNSMs are based on algebraic equations using a Random Number Generator (RNG). Empirical PNSMs are other nonparametric alternatives for sampling of a random variable based on observed data. The accuracy of PNSMs is given by the following two steps. The first step is the calculation of the relative error of each statistical parameter (mean, standard deviation, skewness and kurtosis): where E rel x -relative error of the parameter x; x r -statistical parameter from the observed variable; x g -statistical parameter from the generated variable; m-the PNSM used. The second step is the calculation of the weighted relative error of the statistical parameters: where E w rel -weighted relative error; E rel M -relative error of the mean value; E rel S:D: -relative error of the standard deviation value; E rel S -relative error of the skewness value; E rel K -relative error of the kurtosis value. The coefficients in Eq.
(2) are based on the order of statistical parameters as central moments and their importance as estimators of a given distribution (4 mean, 3 standard deviation, 2 skewness and 1 kurtosis).

Datasets
As mentioned, data to shape the random variables in evacuation models is scarce and limited. A deliberate effort was made to use representative datasets derived from evacuation experiments and fire drills conducted in different evacuation scenarios: passenger train, school building and transport station. Given the practical scope of this paper, datasets corresponded to several variables, with different sample sizes and fitted against different distributions. The datasets used are already published and further information can be found in the references of each experiment. However, the data are presented in this section independently, given the different possible uses of this data. We also describe the collection techniques and the background conditions to better understand how the data was obtained.

652
Fire Technology 2018 The fire drills in passenger trains consisted of a relocation procedure inside the train (coach by coach) and the evacuation by a single exit once the train has stopped (see Figs. 2 and 3). The Drill 1 and the Drill 2 involved 83 and 218 participants respectively. Participants were railroad employees. They had no luggage, but could gather personal belongings and carry them out during the drills [28,29]. Video-cameras were used to capture passengers' behaviours. Video images were collected at a frequency of 30 frames/s and were analysed using the Avidemux 2.5.2 software that allows the footage to be manually advanced frame by frame. The data collected consisted of the response time (t res1 ), the stop time (t stop ), the exit time (t exit ) and the walking speed within the aisle (S aisle ). The response time (collected from Drill 1) is defined as the time from the moment at which the evacuation is announced (alarm) through public address system until the passenger is stood up and starts the preparation activities. The stop time (collected from Drill 1) is the time spent by some passengers blocking the aisle to collect belongings, wait others, etc. The exit time (collected from Drill 2) is the time spent by each passenger to negotiate the train steps.
Finally, the walking speed within the aisle (collected from Drill 2) is defined as the unimpeded walking speed of each passenger through the aisle inside the train. Collected from Drill 2. Figure 4 shows the histograms of the observed data.
The analysis also included datasets collected during a semi-announced evacuation trial in a school building [16,17] (i.e. students had no warning, while the teaching staff had some prior warning in the trial). The video-cameras were positioned at ceiling height to improve the vantage point and reduce the impact of the cameras on the evacuation process (see Fig. 5). Video images were analysed frame by frame using the Avidemux 2.5.2 software as well. Figure 6 shows the histograms of the observed response times and walking speeds downstairs. Datasets consist of the response time (t res2 ) defined as the time from the alarm to the child is stood up and starts evacuation movement (students from 6 to 7 years old) and the walking speed downstairs (S stair ) defined as walking speed of each child on a stair (students from 12 to 16 years old). We also use datasets from evacuation trials in an underground bus concourse [30]. Participants were recruited by a casting agency. They were told that they were going to take part in transport comfort and mobility tests. Each participant was given a slip of paper with the number of a boarding gate to go and was instructed to remain there. When all participants were at their respective location, the alarm went off. The trials were finished when all participants had evacuated the bus concourse trough the available emergency exits (see Fig. 7).
Two response time data samples were selected from the 15 trials conducted, namely t res3 and t res4 . Here, the response is also defined as the time from the sounding of the alarm (voice message) to deliberate evacuation movement(s). Figure 8 shows the histograms of the response time variables (t res3 and t res4 ). Table 1 summarizes the statistical characteristics of the data samples used (mean, standard deviation, kurtosis and skewness).
The statistical treatment of the samples described allowed the probability distribution laws to be obtained. For assessing whether a given distribution is suited to dataset, the following Goodness-of-fit tests and their underlying measures were used: the D' Agostino's K-square normality test (Omnibus K 2 statistic) [31,32], the Hypothetical log-normal test applying the normality test (y i = ln(x i )) and the Modified Anderson-Darling test for Uniformity (modified normality test) [33]. Specific tests were considered because they have more power. Table 2 shows the results of the Goodness-of-fit tests conducted. Data from t res1 , t stop and t exit variables fitted against lognormal distribution, and data of S aisle , S stair and t res2 variables fitted against normal distribution and data of t res3 and t res4 variables fitted against uniform distribution.

Selected PNSMs
As mentioned, PNSMs are defined as a transformation given a source of uniformly distributed random numbers [0,1] generated by RNGs to a sample of another given distribution. There are several PNSMs in the literature. Note that the aim of this study was to test the validity of the proposed method. The criteria for selecting the PNSMs for this analysis was based on authors judgment but con- where z-random number normally distributed (mean 0 and standard deviation 1); R 1 ; R 2 -two different random numbers uniformly distributed between 0 and 1 (generated by the RNG). Then, to generate a random input from a normal distribution with specific statistical parameters: where y-random variable from a specific normal distribution (mean m and standard deviation s); m-mean value of the normal distribution; s-standard deviation of the normal distribution;

Generation of Log-Normally Distributed Numbers
It is well known that a lognormal distribution function is a continuous probability distribution of a random variable with a logarithm normally distributed: where x-random variable from a specific lognormal distribution (mean l and standard deviation r); y-random variable from the specific normal distribution (mean m and standard deviation s). Based on this relationship, the method defined in the previous section can be applied for generating Lognormal distributions. However, the following transformations will be employed to get the mean m and standard deviation s values from the normal distribution.

656
Fire Technology 2018 where l-mean value from the lognormal distribution; r-standard deviation value from the lognormal distribution; m-mean value from the normal distribution (obtained from the Lognormal distribution); s-standard deviation value from the normal distribution (obtained from the lognormal distribution).

Generation of Uniformly Distributed Numbers
The selected method is based on the RNG to generate a random number R uniformly distributed [0,1]. The following transformation is considered to obtain a random input from a uniform distribution between a minimum value a and a maximum value b: where: y-number uniformly distributed between a and b.

Empirical Methods
There are also non-parametric alternatives to generate pseudo-random numbers directly from evacuation datasets, namely Empirical methods. In other words, no previous distribution fitting is needed. Here we describe those methods selected for the case study; the Piecewise linear [37], the Kernel-Gaussian and the Kernel-Epanechnikov [38].

Piecewise Linear Function
Given a sample data x-from drill, experiment or actual emergency-: The Piecewise linear function F(x) is composed of straight-line sections (see Fig. 9) with CDF values calculated by and a random number R i uniformly distributed on interval [0,1] is possible to choose a series k, such that: the expression for generating a random variable y from the sample data x is: (10) shows the general expression for the generation of a random input by using a Kernel estimation:

Kernel Estimation Equation
where n-the size of the initial sample whose PDF is estimated; x ¼ x 0 ; x 1 ; x 2 ; . . . ; x nÀ1 f g -the initial sample; K h -Kernel function; h-bandwidth.and

658
Fire Technology 2018 We propose the analysis of the following kernel functions:Gaussian: Epanechnikov.
Based on the previous equation, the generation of stochastic inputs from an estimated PDF through Kernel is implemented to generate a random number j between [1, n] and to generate a random number fitted to the Kernel function-Gaussian or Epanechnikov-centred in x j . Firstly, the bandwidth is obtained according to Silverman's rule of thumb to minimize the AMISE (asymptotic mean integrated squared error) as [39]: Secondly, the random input y i using the corresponding Kernel is obtained as Gaussian and Epanechnikov. For Gaussian: where N i -random number normally distributed between 0 and 1 (using Box-Muller transform). For Epanechnikov, considering: Based on Eq. (18) and solving the corresponding integral, the generation of the random input y i using Kernel-Epanechnikov is completed thusly: where

Software for PNSMs Accuracy
As mentioned, the smaller the relative error between the shape of the observed distribution and the shape of the generated distribution, the more accurate the PNSM. To test this, we developed a software in C# Object Oriented Programming language by using Visual Studio. As Fig. 10 shows, the software operates following four main steps. In the first step, the software imports and processes statistically the experiment data. The software provides distribution fitting and estimated central moments. It uses the following Goodness-of-fit tests (a = 0.05): D' Agostino's K-square normality test, Hypothetical log-normal test applying the normality test and Anderson-Darling uniformity test (modified normality test). In the second step, the software generates samples of data using each PNSM described in Sect. 2.3 (i.e. based on distribution parameters). The RNG used by the software is based on the modified version of Donald E. Knut's subtractive random generator algorithm [24]. In the third step, the software calculates the relative error for the statistical parameters described in Eq. (1). Finally, in the fourth steps the software calculates the weighted relative error for each PNSM based on the order of the statistical parameters as central moments (4 mean, 3 standard deviation, 2 skewness and 1 kurtosis) as described in Eq. (2).

Results
The software allows generating pseudo-random numbers with different sample sizes. A previous analysis was conducted to check the sensitivity of results to number of data under consideration. Sample sizes of 250, 500, 1.000 and 1.500 were generated to do an explanatory check of if (and to what extend) this affects results. The absolute errors for the weighted relative errors produced when compare 250 and 1.500 are presented in Table 3. It is apparent from Table 3 that very few differences are produced with different sample sizes except for the variable t res1 by using the Box-Muller method. Despite the changes in the generated sample size is out of the purpose of this paper, this comparison helps drawing more solid conclusions in the following results.
According to the Law of Large Numbers, the larger the sample size the narrower the confidence interval of the central moments (mean, standard deviation, skewness and kurtosis). The dedicated software was used for generating samples using each PNSMs: the Box-Muller, the Piecewise linear, the Kernel-Gaussian and the Kernel-Epanechnikov. The results presented here correspond to a generated sample sizes of 1.500 values. The distributions were statistically analysed and the relative errors for the central moments were calculated to compare the accuracy of the selected PNSMs. Table 4 shows the relative errors of central moments. All PNSMs produce accurate (and precise) values for the means with relative errors between 0 and 0.030.
The higher relative errors are produced by Kernel-Gaussian and the Kernel-Epanechnikov methods for the standard deviations of response time variables t res1 , t res3 and t res4 with values ranged from 3.465 to 6.337. This is possibly due to the use of Silverman's rule of thumb to minimize the AMISE (asymptotic mean integrated squared error). While this rule of thumb is easy to compute, it should be used with caution as it can yield widely inaccurate estimates when the density is not close to being normal. Figure 11 compares the weighted relative errors (E w_rel ) produced by each PNSM when sampling from the observed variables. The Kernel-Gaussian and the Kernel-Epanechnikov methods are less accurate for t res1 , t res3 and t res4 variables with E w_rel > 1 while the Box-Muller transform method produces E w_rel ranged from 0.2 to 0.7. The Piecewise linear method is most accurate and produces E w_rel = 0 for t res1 , t stop , t exit , S aisle and S stair variables, E w_rel = 0.1 for t res3 and t res4 variables and E w_rel = 0.4 for t res2 variable. Figure 12 shows the accuracy of the PNSMs according to the type of distribution. As expected, the Kernel-Gaussian and the Kernel-Epanechnikov methods are the most accurate in sampling from normal distributions (E w_rel = 0.06 and E w_rel = 0.07 respectively). Nevertheless, the E w_rel values produced by these two methods increase dramatically when sampling from uniform and lognormal distributions. The Piecewise linear method is the most accurate in sampling from lognormal (E w_rel = 0.04) and uniform distributions (E w_rel = 0.009) and it is the only method that produces E w_rel values below 0.15 for the three types of distributions. On the other hand, the Box-Muller method produces E w_rel values between 0.23 and 0.29 when sampling from the three types of distributions. It is important to note that this method involves two potential sources of error related with (1) the goodness-of-fit and (2) the pseudorandom numbers generation.

Discussion
The evacuation analysis using computer modelling and simulation involves random variables. This work is a novel contribution for assessing degree of exactness of different PNSMs when sampling from evacuation datasets. The method is based on the comparison between experiment and generated distributions. We focus on the statistical parameters as central moments to describe (shape) a given distribution (mean, standard deviation, skewness and kurtosis). It should be noted  that this method could be employed to other fire safety engineering applications. The method was applied to eight empirical data samples derived from evacuation experiments and fire drills (3 samples were normally distributed, 3 lognormally distributed and 2 were uniformly distributed).  As expected, the accuracy of the PNSMs varied. The Kernel-Gaussian and the Kernel-Epanechnikov methods are accurate when sampling from normal distributions but potentially inaccurate when sampling from other distributions. The principal finding of this study is that the Piecewise linear method is the most accurate method for data samples used and showed a better fit with normal, uniform and lognormal distributions. This method is simple and no previous distribution fitting is needed. Therefore, the Piecewise linear is suggested here for evacuation modelling and future developments as long as the model user/developer can have access to empirical (raw) data. Otherwise, analytical methods such as the Box-Muller transform method can provide plausible estimations.
Note that this method is likely to produce errors when used for normal and lognormal distributions: (1) the error derived from the previous goodness-of-fit test conducted and (2) the error derived from sampling from the distribution.
Although we feel that the results of the present study are promising, there are some limitations in relation to the number of PNSMs used and the number of datasets studied and their relatively limited sample size. Care should be taken, however, in generalizing from these findings since the use of other (hopefully larger) datasets may lead to different results.
Future research should conduct more tests using the proposed method involving more data samples and PNSMs exploring the generated sample sizes to improve current and future computer evacuation models. For instance, some methods may show a better fit with data-sets of different sizes.