Changes

From Genome Analysis Wiki
Jump to: navigation, search

Code Sample: Generating QQ Plots in R

66 bytes added, 16:34, 3 November 2011
R Lattice Graphics
);
</syntaxhighlight>
 
== A Fancier QQ Plot by Matthew Flickinger ==
Unfortunately the simple way of doing it leaves out many of the things that are nice to have on the plot such as a reference line and a confidence interval plus if your data set is large it plots a lot of points that aren't very interesting in the lower left. Here is a more complex example that adds a few more niceties and thins the data to only plot meaningful points
}
</syntaxhighlight>
 
=== Sample Usage ===
A sample call to this function would be
 
<syntaxhighlight lang="rsplus">
qqunif.plot(my.pvalues) #these are the raw p-values, not log-transformed
</syntaxhighlight>
The confidence intervals are calculated using the fact that the standard uniform order statistics follow a beta distribution. The default settings will draw confidence intervals around the 1000 more significant points. You can change that with the <codett>conf.points=</codett> parameter and you can change the alpha level from the default .05 using the <tt>conf.alpha=</tt> parameter. If you wish to disable the confidence interval, use <tt>draw.conf=F</tt> in your call to <tt>qqunif.plot()</tt>.
This function does thin the data by rounding the observer and expected -log10 p-values to two places by default. You can control the thinning with the <tt>should.thin=</tt>, <tt>thin.obs.places=</tt>, and <tt>thin.exp.places=</tt> parameters.

Navigation menu