title: simultaneous null band for uniform QQ plot in R
body: <p>This question is about convenient way of plotting simultaneous null band based on pointwise quantile estimates in R. Suppose I obtain a vector of p-values, and I want to see, by using uniform QQ plot, if its distribution is close to a uniform distribution (...and if not, which points "stand out", i.e. fall outside the band). Here is an example (where <code>u_obs</code> denotes p-values not necessarily from a uniform distribution -- for illustration purpose only):</p>
  
  <pre><code>library(gap)
  u_obs = qqrunif(1000)
  qqunif(u_obs,pch=21,bg="blue",bty="n")
  </code></pre>
  
  <p>According to the nonparametric approach discussed on page 5, Figure 1 (bottom left panel) of this paper: <a href="http://stat.wharton.upenn.edu/~buja/PAPERS/paper-sim.pdf" rel="nofollow">http://stat.wharton.upenn.edu/~buja/PAPERS/paper-sim.pdf</a>, we can do 10,000 simulations and get the lower and upper 5% quantiles if a 90% simultaneous bound is desired.</p>
  
  <p>My questions are:</p>
  
  <ol>
  <li><p>Is there an R package/code snippets that are able to perform this task efficiently? I think this belongs to the "functional data analysis" realm, but I am not quite sure.</p></li>
  <li><p>What inference can we make from the simultaneous null bound of a uniform QQ plot? Examining those points that fall outside the bands? How many points do I expect to be reasonably outside the band if the true distribution of the p-values is uniform (i.e. coming from the null)?</p></li>
  </ol>