Data distributions

qq plot (normal data)

A qq plot compares theoretical quantiles to the actual sample quantiles. First, we need to draw some random numbers

Then, we create the simplest form of qq plot - the points. This is made with Base R graphics - as always and excellent start.

From this it is hard to judge if the data is normally distributed. We switch to the grammar of graphics for more flexibility. Of course, there is a package for plotting qq plots, qqplotr.

Still hard to judge if the data is normally distributed. We nee the qq line and the confidence band.

qq plot (normal data with mean and sd)

Here you can see how a qq plot looks for data with a mean and sd

qq plot for non normal data

Below you can see how a qq plot looks for non normally distributed data

But a qq plot can also work for non normally distributed data, if the distribution is adjusted in the code (unif).