8_634_akbilgic.dvi EUROPEAN JOURNAL OF PURE AND APPLIED MATHEMATICS Vol. 4, No. 4, 2011, 448-454 ISSN 1307-5543 – www.ejpam.com A Novel Normality Test Using an Identity Transformation of the Gaussian Function Oğuz Akbilgiç1∗, J. Andrew Howe 2 1 Department of Quantitative Methods, Istanbul University School of Business Administration, Is- tanbul, Turkey 2 Tennessee Valley Authority, Chattanooga Tennessee, USA Abstract. Normality is the most frequently required assumption for statistical techniques. Thus, eval- uation of the normality assumption is the first step of many statistical analyses. Although there are many normality tests in the literature, none dominate for all conditions. This paper introduces a novel normality test, and its performance is compared with some of the other normality tests via a Monte Carlo simulation study. Tests are evaluated according to the Type I error and Power. 2000 Mathematics Subject Classifications: 62E15,62F03 Key Words and Phrases: normality test, Gaussian distribution,probability distributions 1. Introduction For a given sample dataset, testing whether it follows a normal distribution is a common starting point for many statistical analysis techniques. The literature has many different nor- mality tests using one or more characteristics of the normal distribution function such, as the mean, variance, skewness, kurtosis etc. The Shapiro-Wilk Test [3], Jarqua-Bera [2], and Anderson and Darling Test [1] are some of the most familiar. In this study, we aim to simultaneously handle all the characteristics mentioned. Logically, the Gaussian function is the unique and most appropriate tool having these characteristics; thus, we have built our test on the Gaussian density function. In section 2, we define a con- tinuous random variable by transforming data using the Gaussian PDF. Then we derive some statistical characteristics like mean, variance, standard deviation and cumulative distribution for this variable. These characteristics are then used to construct a novel normality test, testing the null hypothesis that a given sample data comes from the normal distribution. We show and discuss results from simulation studies in section 3, then finish with some concluding remarks. ∗Corresponding author. Email addresses: oguzakbilgi �gmail. om (O. Akbilgiç), ahowe42�gmail. om (A. Howe) http://www.ejpam.com 448 c© 2011 EJPAM All rights reserved. O. Akbilgiç, A. Howe / Eur. J. Pure Appl. Math, 4 (2011), 448-454 449 2. Test For Normality Let X be a continuous random variable from a normal distribution with mean µ and variance δ2, X ∼ N(µ,δ2). It is known that X ’s density function, called the Gaussian function, and distribution function are shown in (1) and (2), respectively. f (x) = 1 δ p 2π e− 1 2 ((x−µ)/δ)2 (1) FX (t) = 1 δ p 2π ∫ t −∞ e− 1 2 ((x−µ)/δ)2 d x (2) If we use a transformation to define a new random variable as a function of our data Y = f (X ), the mean and variance of Y are obtained by the following process. E[Y ] = E[ f (X )] = ∫ ∞ −∞ 1 δ p 2π e− 1 2 ((x−µ)/δ)2 · 1 δ p 2π e− 1 2 ((x−µ)/δ)2 d x = 1 2πδ2 ∫ ∞ −∞ e−((x−µ)/δ) 2 d x = 1 2πδ2 ∫ ∞ −∞ e− 1 2 ( p 2(x−µ)/δ)2 d x let u = p 2(x −µ)/δ, so du= p 2 δ d x −→ = 1 2πδ2 ∫ ∞ −∞ e− u2 2 δp 2 du= p 2π 2 p 2πδ = 1 2 p πδ (3) E[Y 2] = E[ f (X )2] = ∫ ∞ −∞ { 1 δ p 2π e− 1 2 ((x−µ)/δ)2}2 · 1 δ p 2π e− 1 2 ((x−µ)/δ)2 d x = 1 δ32π p 2π ∫ ∞ −∞ e− 3 2 ((x−µ)/δ)2 d x = 1 δ32π p 2π ∫ ∞ −∞ e− 1 2 ( p 3(x−µ)/δ)2 d x let u = p 3(x −µ)/δ, so du= p 3 δ d x −→ = 1 δ32π p 2π ∫ ∞ −∞ e− u2 2 δp 3 du= 1 δ32π p (2π) · δ p 2πp 3 = 1 2 p 3πδ2 (4) Var[Y ] = E[(Y − E[Y ])2] = E[Y 2]− E[Y ]2 = 1 2 p 3πδ2 − ( 1 2 p πδ )2 = 2−p3 4 p 3πδ2 (5) Thus, we have µY = 1/(2 p πδ), and δ2 Y = (2 − p 3)/(4 p 3πδ2) for a random variable Y . Further, we may extract the distribution function of Y as shown here, using the CDF trans- formation method for a random variable. Here we make use of the common standardization notation z = (x −µ)/δ. F(y) = P � Y ≤ y � = P � 1 δ p 2π e− 1 2 ((x−µ)/δ)2 ≤ y � = P � e− 1 2 ((x−µ)/δ)2 ≤ δp2πy � O. Akbilgiç, A. Howe / Eur. J. Pure Appl. Math, 4 (2011), 448-454 450 = P � ln e− 1 2 ((x−µ)/δ)2 ≤ lnδ p 2πy � = P � ((x −µ)/δ)2 ≥ −2 lnδ p 2πy � = P � (x −µ)/δ ≤ − Æ −2 lnδ p 2πy � + P � (x −µ)/δ ≥ Æ −2 lnδ p 2πy � = 2P � (x −µ)/δ ≥ Æ −2 lnδ p 2πy � = 2 � 1− P � (x −µ)/δ ≤ Æ −2 lnδ p 2πy �� = 2 � 1− P � z ≤ Æ −2 lnδ p 2πy �� = 2 � 1−Φ �Æ −2 lnδ p 2πy �� (6) The complete CDF is F(y) =    0 y ≤ 0 2 h 1−Φ �p −2 lnδ p 2πy �i 0< y < 1 δ p 2π 1 y ≥ 1 δ p 2π . (7) For the original data, we have X ∈ R. With the Gaussian density function, we know that l im x→±∞ f (X ) = 0, and f (µ) = 1 δ p 2π e− 1 2 ((µ−µ)/δ)2 = 1 δ p 2π . Thus, our random variable Y has support (0,1/(δ p 2π)]. The following calculations show that some features of density functions are satisfied by (7). F(0) = 2 � 1−Φ �p −2 lnδ p 2π · 0 �� = 2 h 1−Φ �p −2 ln0 �i = 2 h 1−Φ �p −2 · −∞ �i = 2 [1−Φ(∞)] = 2[1− 1] = 0 F � 1 δ p 2π � = 2  1−Φ r −2 lnδ p 2π · 1 δ p 2π ! = 2 h 1−Φ �p −2 ln1 �i = 2 h 1−Φ( p −2 · 0) i = 2[1−Φ(0)] = 2[1− 0.5] = 1 We can use the random variable Y to test if a given sample follows a normal distribution. After transformation with the Gaussian density function, any data generated from a normal distribution should have mean 1/(2 p πδ) and variance (2−p3)/(4 p 3πδ2). These facts are the basis of our proposed normality test. In our derivation here, we have relied upon the transformation of a data sample, using unknown population parameters µ and δ. While these unknown parameters cancel out in the calculation of our critical value, the sample test statistic does rely on the conversion to Y . Here, we muse use the sample statistics X and S. Our hypotheses H0: Data are normally distributed, vs. H1: Data are not normally distributed, O. Akbilgiç, A. Howe / Eur. J. Pure Appl. Math, 4 (2011), 448-454 451 can be rewritten in a more precise representation that lends itself to a test the relies on both (3) and (5). These hypotheses and the one-sided test A, are as follows. H0: µsample = 1/(2 p πδ) vs H1: µsample 6= 1/(2 p πδ) A= µsample−µ0 δ0 = µsample− 1/(2 p πδ) p (2−p3)/(4 p 3πδ2) (8) The upper bound of the (1−α)% confidence interval is found below with respect to 0< 1/(2 p πδ)< yup. P(0≤ y ≤ yup) = 1−α→ F(yup)− F(0) = 1−α → 2 � 1−Φ �Æ −2 lnδ p 2πyup �� − 0= 1−α → Φ �Æ −2 lnδ p 2πyup � = 1+α 2 → Æ −2 lnδ p 2πyup = Φ −1 � 1+α 2 � → yup = 1 δ p 2π exp � −1 2 Φ−2 � 1+α 2 �� (9) Consequently, the 90% confidence interval, for example, is expressed as (0,0.3958/δ). These boundaries are used to determine the comparison criteria of the test statistic, as shown in (10). A0 = exp � −1 2 Φ−2 � 1+α 2 �� / � δ p 2π � − 1/(2 p πδ) p (2−p3)/(4 p 3πδ2) = exp � −1 2 Φ−2 � 1+α 2 �� / p 2π− 1/(2 p π) p (2−p3)/(4 p 3π) (10) For α= 0.10, we find this quantity to be A0 = 1.025. Note that the critical value for our test is hence independent of the values µ and δ, which we must estimate from our data sample. For a sample of size n, the test statistic is then given in (11), where Y and Sy indicate the sample mean and standard deviation of the transformed data. Asample = p n � Y − 1/(2 p πSy) � Sy (11) So, we can say that we are unable to reject the null hypothesis, saying given data could be normally distributed, if Asample ≤ A0. Similarly, we reject the null hypothesis if Asample > A0; the data are not from a Gaussian distribution. O. Akbilgiç, A. Howe / Eur. J. Pure Appl. Math, 4 (2011), 448-454 452 3. Simulation Studies The efficiency and efficacy of a hypothesis test is characterized by Type I and Type II errors. The Type I error is the probability of falsely rejecting the null hypothesis - saying the given data is not from normal distribution when it really is. On the other hand, a Type II error is to falsely accept the null hypothesis when the given data is actually non-normal. The Power indicates the probability with which a test can correctly reject the null hypothesis. The power is equal to the Type II error subtracted from unity. We used two sets of Monte Carlo simulation studies to compare the performance of our test with the other common normality tests already mentioned; in both cases, we used α = 0.10. First, we ran 18 sets of 5,000 simulations to evaluate performance with respect to Type I errors. We generated data from two normal distributions: N(0,1) and N(50,5), using sample sizes n= [5,20,30,50,100,250,300,500,1000]. Secondly, in order to evaluate the power of the tests (and hence, Type II error rate), we gener- ated data from four other distributions: Uni f orm(50,100), Gamma(5; 3), E x ponential(5), and Student(15), using the same sample sizes. Results from the studies are reported in Ta- ble 1 and Table 2. Table 1 shows the Type I error percentages of: our proposed test (pt), Jarqua-Bera Test (jb), Shapiro-Wilk Test (ws), Anderson and Darling Test (and). These re- sults suggest our test is superior to the others. For almost all sample sizes evaluated, the false negative rate was much lower than the other tests. Even more interesting is the relative consistency demonstrated by our proposed test.Table 1: Type I Error Probabilities of Compared Normality Tests. N(0; 1) N(50; 5) n pt jb ws and pt jb ws and 5 0.0 0.0 9.8 0.0 0.0 0.0 9.4 0.0 20 1.1 2.0 12.5 10.1 1.6 2.1 12.3 10.0 30 1.7 3.4 12.3 10.3 1.8 3.7 12.4 10.0 50 2.0 4.7 12.0 10.0 1.8 4.4 12.4 10.5 100 1.9 6.0 12.3 10.3 2.0 6.1 12.1 9.9 250 1.9 7.6 11.2 10.0 2.0 7.6 12.0 10.1 300 1.7 7.9 12.0 10.2 1.8 7.6 11.5 9.3 500 2.1 9.1 12.2 9.7 1.8 8.2 11.4 9.8 1000 1.9 9.6 12.0 10.3 1.8 9.2 12.1 10.0 In Table 2, we see that the proposed test does not seem to be more powerful than the other three, which exhibit high power rates for sample sizes greater than 100 for the first three distributions. For the two symmetric distributions - uniform and Student’s t, - the performance of our test is similar to that of the Anderson and Darling test. As would be expected, we see that increasing the sample size increases the power. For the uniform and exponential distributions, a sample size larger than 100 is enough to detect non-normality approximately REFERENCES 453 perfectly; much larger samples are required for the gamma distribution. Not surprisingly, when data were generated from the Student’s t distribution, none of the compared tests were sufficient to detect non-normality except for extremely large samples. 4. Concluding Remarks In this study we proposed a novel normality test using the density function to transform data before testing. Of course, we have used very simple calculus methods. However, the simplicity of the calculus employed does not negate the value of our proposed test. Simulation studies show that the proposed test gives approximately perfect results for all sample sizes according to Type I error. However, according to Power, we can not say that our proposed test works better than the others. It is also seen that the Type I error rate seems invariant with respect to sample size, while the Type II error decreases with higher sample sizes. The logic underlying our test could be readily adapted to specific tests for other probability distributions. This could be a promising avenue of further research. ACKNOWLEDGEMENTS The first author offers his thanks to The Scientific and Technolog- ical Research Council of Turkey (TUBITAK) for their support and encouragement of young Turkish researchers. The authors also thank the anonymous referee for assistance, which helped improve the presentation of this research. References [1] T Anderson and D Darling. A test of goodness of fit. Journal of the American Statistical Association, 49(268):765–769, 1954. [2] C Jarque and A Bera. A test for normality of observation and regression residuals. Inter- national Statistical Review, 55(2):163–172, 1987. [3] S Shapiro and M Wilk. An analysis of variance test for normality. Biometrica, 52(3 & 4):591, 1965. R E F E R E N C E S 4 5 4 Table 2: Power Probabilities of Compared Normality Tests. Uniform(50;100) Gamma(5;3) Exp(5) t(15) n pt jb ws and pt jb ws and pt jb ws and pt Jb ws and 5 0.0 0.0 13.0 0.0 0.0 0.0 11.8 0.0 0.0 0.0 26.2 0.0 0.0 0.0 9.4 0.0 20 7.8 0.0 35.8 29.2 6.1 13.6 37.3 31.6 26.8 50.3 90.8 85.8 2.9 4.7 16.1 12.3 30 20.6 0.1 59.1 45.4 8.9 24.3 48.8 40.0 37.7 77.7 98.7 96.8 4.7 8.4 18.4 13.3 50 55.2 8.6 88.7 74.1 12.7 47.7 70.7 61.0 55.4 98.3 100.0 99.8 6.8 13.6 22.0 15.8 100 95.7 94.9 99.9 98.2 16.9 86.2 94.4 87.6 79.4 100.0 100.0 100.0 9.4 20.5 26.6 17.2 250 100.0 100.0 100.0 100.0 29.9 100.0 100.0 99.9 98.6 100.0 100.0 100.0 18.0 35.7 38.4 22.8 300 100.0 100.0 100.0 100.0 32.0 100.0 100.0 100.0 99.4 100.0 100.0 100.0 21.7 41.1 43.7 25.7 500 100.0 100.0 100.0 100.0 45.0 100.0 100.0 100.0 100.0 100.0 100.0 100.0 31.7 53.2 53.9 34.1 1000 100.0 100.0 100.0 100.0 69.5 100.0 100.0 100.0 100.0 100.0 100.0 100.0 56.7 77.0 75.6 52.7