The p.adjust () function in R calculates a variety of different approaches for multiplicity adjustments given a vector of p-values. These include the Bonferroni procedure (where the alpha is divided by the number of tests or equivalently the p-value is multiplied by that number, and truncated back to 1 if the result is not a probability).
p.adjust(p, method = p.adjust.methods, n = length(p)) p.adjust.methods # c(holm, hochberg, hommel, bonferroni, BH, BY, # fdr, none), This function is a wrapper around the standard p.adjust function from the stats package. It takes the p.value metadata column from the AssocTestResultRanges object p, applies the multiple testing correction method specified as method argument.
This is the simple function to get adjusted p-value: getAdjustPval <- function(df, pAdjustMethod=BH, ...) { if(is.null(df$p.value)) { stop(p-value is required) } else { p <- df$p.value df$adjust.pvalue <- p.adjust(p, method = pAdjustMethod) df } } you'll get this:, p.adjust (p, method = p.adjust.methods, n = length (p)) p.adjust.methods # c(holm, hochberg, hommel, bonferroni, BH, BY, # fdr, none), The set of methods are contained in the p.adjust.methods vector for the benefit of methods that need to have the method as an option and pass it on to p.adjust. Value A vector of corrected p values.?p.adjust In your specific case, you need to select the values from your data frame and pass them to the function, so something like: p.adjust(pvalues$p.values, fdr) if the column name was p.values. You could then add the adjusted p-values to your data frame via: pvalues$adjust = p.adjust(pvalues$p.values, fdr), p.adjust(p, method, n = length(p)) where n could be changed. but the default is length of p as stated in the documentation. So in my understanding, if I didn't include the n parameter is the same as I list n to be the length of p in that function .Between the qvalue package and the p.adjust 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.8/3/2016 · The ' p.adjust ( ) ' command in R calculates adjusted p-values from a set of un-adjusted p-values, using a number of adjustment procedures. Adjustment procedures that give strong control of the family-wise error rate are the Bonferroni, Holm, Hochberg, and Hommel procedures.I see some papers used the following function . p.adjust(p.value,method = fdr,n=length(p.value)) But I think FDR is used to control the numbers of false positive. Thus, the adjustment object is the p value less than 0.05? There is no need to adjust the negative (p>0.05)? May I adjust the p.value like the following function ?