QQPlot Demo

Andy Long, Spring, 2019

We’ll generate some random data (normal data, in aa, and uniform data in bb). Then plot against normal “expectations” to see how each looks. 
I’ll also plot a data set where we combine the two, to create wonkier and wonkier distributions. These should have qqplots that don’t fit the straight line expectation....

aa=RandomReal[NormalDistribution[0,1],500];
bb=RandomReal[{-1,1},500];
Manipulate[
Module[{a=aa,b,c,h1,h2,h3,q1,q2,q3},
b=bb+center;
c=Join[a,b];

h1=Histogram[a];
h2=Histogram[b];
h3=Histogram[c];

q1=QuantilePlot[a,NormalDistribution[Mean[a],StandardDeviation[a]],FrameLabel->{"Theoretical","Empirical"},PlotLabel->"Normal"];
q2=QuantilePlot[b,NormalDistribution[Mean[b],StandardDeviation[b]],FrameLabel->{"Theoretical","Empirical"},PlotLabel->"Uniform"];
q3=QuantilePlot[c,NormalDistribution[Mean[c],StandardDeviation[c]],FrameLabel->{"Theoretical","Empirical"},PlotLabel->"Combined"];
GraphicsGrid[{{h1,h2,h3},{q1,q2,q3}}]
],{center,-2,5}
]