Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Q-Q Plots' topicStudent Support Forum > General > "Q-Q Plots"

< Previous CommentHelp | Reply To Comment | Reply To Topic
Author Comment/Response
Bill Simpson
10/09/12 10:46pm

I am really guessing on this one, so that means you have to at least triple check this to make certain there are no silly misunderstandings or other errors.

Based on my reading of
http://en.wikipedia.org/wiki/Q%E2%80%93Q_plot
I'm thinking you might be able to adapt something like this:

In[1]:= normal01data=RandomVariate[NormalDistribution[0,1],100];
q1=Table[Quantile[normal01data,i/5],{i,0,5}]

Out[2]= {-2.02704,-0.909314,-0.331198,0.455767,0.870899,2.3196}

In[3]:= chi1data=RandomVariate[ChiDistribution[1],120];
q2=Table[Quantile[chi1data,i/5],{i,0,5}]

Out[4]=
{0.0125909,0.384116,0.644235,1.08265,1.41824,2.62645}

In[5]:= ListPlot[Transpose[{q1,q2}],PlotStyle->{PointSize[.05]}]

Out[5]= <graphic snipped>

That creates quintiles for each distribution and uses Transpose to flip them into a form that ListPlot can use.

So take that apart one Mathematica function at a time. Look each of those up in the help system. Understand what the inputs are and what the result is. Then think about what this means as you assemble the pieces together. Test copies of this and make changes, like NormalDistribution versus NormalDistribution, with and without the same mean and variance, or more data points or fewer or more quantiles or less.

You are trying to understand Q Q plots and see whether this does what you need, and possibly learn a little bit about Mathematica and programming in the process. If you think you have found a misunderstanding or error you might be right.

URL: ,

Subject (listing for 'Q-Q Plots')
Author Date Posted
Q-Q Plots Kevin Osenton 10/08/12 9:07pm
Re: Q-Q Plots Bill Simpson 10/09/12 10:46pm
< Previous CommentHelp | Reply To Comment | Reply To Topic