Changes

From Genome Analysis Wiki
Jump to: navigation, search

Code Sample: Generating QQ Plots in R

185 bytes added, 16:38, 3 November 2011
Sample Usage
</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 === Under the <tt>conf.pointsHood: Multiple P-value Lists =</tt> 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 If you are comparing two-test or want to show data by rounding the observer before and expected -log10 after it has been corrected for genomic control, you can pass multiple sets of 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. The function should also accept any other lattice graphing parameters should you want to change the plot title (<tt>main=</tt>), plotting character (<tt>pch=</tt>), or plot colors (<tt>col=</tt> for points, <tt>conf.col=</tt> for confidence interval). By default the <tt>aspect="iso"</tt> parameter is set which ensures that the reference line lies on via a 45-degree angle. If you have very significant results, this may make your plot taller than you would like. You can set the parameter to <tt>aspect="fill"</tt> to use the standard layout which stretches the values on each axis to take up as much room as possiblelist.
If you are comparing two-test or want to show data before and after it has been corrected for genomic control, you can pass multiple sets of p-values to the function via a list.
<syntaxhighlight lang="rsplus">
my.pvalue.list<-list("Study 1"=runif(10000), "Study 2"=runif(10000,0,.90))
</syntaxhighlight>
Internally the different groups are drawn using the lattice superpose settings, so if you want more control over the color and shapes, you can use the <tt>par.settings=list(superpose.symbol=)</tt> settings. Furthermore, you can use any of the lattice methods of adding a legend to your plot. The names used in the legend correspond to the names of the elements in the list you pass in. === Under the Hood: Confidence Intervals === 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 <tt>conf.points=</tt> 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>. Note that the confidence interval drawn depends on the total number of p-values given. When you pass in a list, the number of tests the confidence interval uses is determined by the vector with the '''least number of p-values''' - this gives the widest, most conservative confidence bands. Internally  === Under the Hood: Thinning the Data === 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 different groups are drawn using <tt>should.thin=</tt>, <tt>thin.obs.places=</tt>, and <tt>thin.exp.places=</tt> parameters. === Under the Hood: Customizing Graphics === The function should also accept any other lattice superpose settings, so if graphing parameters should you want more control over to change the color and shapesplot title (<tt>main=</tt>), you can use the plotting character (<tt>par.settingspch=list</tt>), or plot colors (superpose<tt>col=</tt> for points, <tt>conf.symbolcol=</tt> for confidence interval). By default the <tt>aspect="iso"</tt> settingsparameter is set which ensures that the reference line lies on a 45-degree angle. FurthermoreIf you have very significant results, this may make your plot taller than you would like. You can use any of set the lattice methods of adding a legend parameter to your plot. The names used in the legend correspond <tt>aspect="fill"</tt> to use the names of the elements in standard layout which stretches the list you pass invalues on each axis to take up as much room as possible.
== R Base Graphics ==

Navigation menu