Answers.Body: <p><code>p.adjust</code> can calculate adjusted p-values with different methods. I think you can choose Bonferroni correction and BH correction, for instance. BH correction gives you False Discovery Rate (FDR), which is one of the most commonly used I guess.</p>
  
  <p>Q-value is different and cannot be calculated by <code>p.adjust</code>. The idea is that when you have many p-values to adjust, they form a distribution. If all p-values come from the null hypothesis, the p-value distribution is going to be uniform on [0, 1]. But usually, our p-values are a mixture of the null distribution and alternative distribution. The parameter <span class="math-container">$\pi_0$</span> describes the proportion of p-values (or tests) that comes from the null hypothesis. To calculated q-values, the algorithm first estimates <span class="math-container">$\pi_0$</span>, then calculates the q-value.</p>
  
  <p>Note that if you set <span class="math-container">$\pi_0=1$</span>, which means that you believe all the p-values come from the null distribution, then q-value is equal to FDR.</p>
  
  <p>I think most people do not know about the meaning and details of q-values and it might be sufficient to use BH procedure in most cases.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-11-14T08:11:51.720Z
Answers.Text: If I understood it correctly, the π0 is set by the researcher? Should it be set a priori? But according to which criteria you set this? I would say 0.5 or 0.2? But
Answers.UserDisplayName: Javier Hernando
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-11-16T02:05:55.830Z
Answers.Text: pi0 is estimated by the q-value method. You can access it like this `qvalue(your_pval)$pi0`
Answers.UserDisplayName: Phoenix Mu
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-02T02:43:59.273Z
Answers.LastActivityDate: 2020-04-02T02:43:59.273Z
Answers.UserDisplayName: Phoenix Mu
Body: <p>Between the <a href="https://www.bioconductor.org/packages/release/bioc/vignettes/qvalue/inst/doc/qvalue.pdf" rel="nofollow noreferrer">qvalue</a> package and the <a href="https://stat.ethz.ch/R-manual/R-patched/library/stats/html/p.adjust.html" rel="nofollow noreferrer">p.adjust</a> function, which is more appropriate to use when trying to calculate the q-values of a dataset? According to the manual for the q-value package, the q-value calculated is not an adjusted p-value which is what the p.adjust function would return. There seems to be an equal amount of people that use one or the other, but I wanted to see other opinions that could help clarify what would be most appropriate to use. </p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-10-13T09:33:47.297Z
Comments.Text: "then q-value is equal to FDR" Does it mean if I use the parameter"pi0=1" in qvalue(), the outcome will be equal to adjust.P(pvalues,"BH")?
  Could you explain it by citing an example?
  Any answer is appreciated!Thanks a lot!
Comments.UserDisplayName: Yang
Tags: <r><bioconductor>
Title: qvalue and p.adjust functions
ThreadText: # qvalue and p.adjust functions
  
  (Asked by: username_0 on 2020-04-02)
  
  Between the [qvalue](https://www.bioconductor.org/packages/release/bioc/vignettes/qvalue/inst/doc/qvalue.pdf) package and the [p.adjust](https://stat.ethz.ch/R-manual/R-patched/library/stats/html/p.adjust.html) function, which is more appropriate to use when trying to calculate the q-values of a dataset? According to the manual for the q-value package, the q-value calculated is not an adjusted p-value which is what the p.adjust function would return. There seems to be an equal amount of people that use one or the other, but I wanted to see other opinions that could help clarify what would be most appropriate to use.
  
  **Tags:** r, bioconductor
  
  > **Comments:**
  > **username_1**: "then q-value is equal to FDR" Does it mean if I use the parameter"pi0=1" in qvalue(), the outcome will be equal to adjust.P(pvalues,"BH")? Could you explain it by citing an example? Any answer is appreciated!Thanks a lot!  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2020-04-02. Score: 1
  
  `p.adjust` can calculate adjusted p-values with different methods. I think you can choose Bonferroni correction and BH correction, for instance. BH correction gives you False Discovery Rate (FDR), which is one of the most commonly used I guess.
  
  Q-value is different and cannot be calculated by `p.adjust`. The idea is that when you have many p-values to adjust, they form a distribution. If all p-values come from the null hypothesis, the p-value distribution is going to be uniform on [0, 1]. But usually, our p-values are a mixture of the null distribution and alternative distribution. The parameter $\pi\_0$ describes the proportion of p-values (or tests) that comes from the null hypothesis. To calculated q-values, the algorithm first estimates $\pi\_0$, then calculates the q-value.
  
  Note that if you set $\pi\_0=1$, which means that you believe all the p-values come from the null distribution, then q-value is equal to FDR.
  
  I think most people do not know about the meaning and details of q-values and it might be sufficient to use BH procedure in most cases.
  
  > **Comments:**
  > **username_3**: If I understood it correctly, the π0 is set by the researcher? Should it be set a priori? But according to which criteria you set this? I would say 0.5 or 0.2? But  
  > **username_2**: pi0 is estimated by the q-value method. You can access it like this `qvalue(your_pval)$pi0`  
  
  ---
  
  