How do I sample data in a distribution and run a normality test with XLSTAT?

An Excel sheet with both the data and the results can be downloaded by clicking here. In this tutorial we first show how to generate a sample from a normal distribution, then a sample from a uniform distribution. Then we show you how to run normality tests on both samples.

We want to generate two samples, the first one sampled in a Normal N(2,4) distribution (mean = 2, variance = 4), the second one in a Uniform distribution, between -1.5 and 5 (mean = 2 and variance = 49/12 =4.08). To do that, we use the "Distribution sampling" tool available in the "Preparing data" section.

After opening XLSTAT, select the XLSTAT/Preparing data/Distribution sampling command, or click on the corresponding button of the "Preparing data" toolbar (see below).


Once you've clicked on the button, the dialog box appears. Select the distribution to use, and the corresponding parameters. Then enter the size of the sample to generate. The dialog box displayed below corresponds to the generation of a 1000 cases normal N(2,2) sample.


The computations begin once you have clicked on the "OK" button, and the sample is displayed. A second sample is then generated using a Uniform distribution between -1.5 and 5.

We then want to tests the normality of the two samples. Select the XLSTAT/Describing data/Normality tests, or click on the corresponding button of the "Describing data" toolbar.


Once you've clicked on the button, the dialog box appears. Select the two samples, and activate the "Independent columns" option to confirm that the two samples are independent. The Q-Q plot option is activated to allow us to visually check the normality of the samples.


The computations begin once you have clicked on the "OK" button, and the results are displayed on a new sheet. The results are first displayed for the first sample and then for the second sample.

The first result displayed is the Q-Q plot for the first sample. The Q-Q plot allows to compare the cumulative distribution function (cdf) of the sample (abscissa) to the cumulative distribution function of normal distribution with the same mean and standard deviation (ordinates). In the case of sample following a normal distribution, we should observe an alignment with the first bisecting line. In the other cases some deviations from the bisecting line should be observed.


We can see here that the empiric cdf is very close to the bisecting line. The Shapiro-Wilk and Jarque-Bera confirm that we cannot reject the normality assumption for the sample. We notice that with the Shapiro-Wilk test, the risk of being wrong when rejecting the null assumption is greater than with the Jarque-Bera test.


The following results are for the second sample. Contrary to what we observed for the first sample, we notice here on the Q-Q plot that there are two strong deviations indicating that the the distribution is most probably not normal.


This gap is confirmed by the normality tests (see below) which allow to assert with no hesitation that we need to reject the hypothesis that the sample might be normally distributed.


As a conclusion, in this tutorial we have seen to generate two samples, one following a Normal distribution, the second following a Uniform distribution. We then confirmed on these samples the validity of the Shapiro-Wilk and Jarque-Bera tests: these tests have confirmed the normality assumption for the first sample, and allowed us to reject it for the second sample.

Click here for other tutorials.

About KCS

Kovach Computing Services (KCS) was founded in 1993 by Dr. Warren Kovach. The company specializes in the development and marketing of inexpensive and easy-to-use statistical software for scientists, as well as in data analysis consulting.

Mailing list Join our mailing list

Home | Order | MVSP | Oriana | XLStat
QDA Miner | Accent Composer | Stats Books
Stats Links | Anglesey


Like us on Facebook Facebook

Get in Touch

  • Email:
  • Address:
    85 Nant y Felin
    Pentraeth, Isle of Anglesey
    LL75 8UY
    United Kingdom
  • Phone:
    (UK): 01248-450414
    (Intl.): +44-1248-450414