Combine P values using Fisher's method or Stouffer's method
combinePvalVector.Rd
This function is used to calculate the combined P value and Z score from multiple P values. it can also be used to convert P value to Z score.
Arguments
- pvals
A vector of numeric, P values to be combined or converted to Z scores
- method
Character, method used to combine P values: "
Stouffer
" (the default) or "Fisher
".- signed
Logical, whether the input P values are signed or not. Usually they are signed by folder change. Default:
TRUE
.- twosided
Logical, whether the input P values are two-sided. If FALSE, the input P values will be treated as one-tailed. Default:
TRUE
.
Examples
## 1. combine P values from a vector
combinePvalVector(c(0.1,1e-3,1e-5), method = 'Stouffer')
#> Z-statistics P.Value
#> 5.399699e+00 6.675264e-08
if (FALSE) { # \dontrun{
## 2. combine P values from a table
df_Pcombined <- sapply(df$Pval*sign(df$log2FC), function(x) {combinePvalVector(x, twosided = TRUE)[2]})
df_Zscore <- sapply(df$Pval*sign(df$log2FC), function(x) {combinePvalVector(x, twosided = TRUE)[1]})
} # }