Learn R Programming

ribiosUtils (version 1.7.7)

pScore: Transform p-values to continuous scores

Description

The function wraps other functions to map p values ranging on \((0,1]\) to continuous scores ranging on \(R\) in a number of ways.

Usage

pScore(p, sign = 1, method = c("qnorm", "absLog10"), replaceZero = TRUE)

Value

A numeric vector of transformed p-values using the specified method.

Arguments

p

p-value between (0,1]

sign

Sign of the score, either positive (in case of positive numbers), negative (in case of negative numbers), or zero. In case a logical vector, TRUE is interpreted as positive and FALSE is interpreted as negative.

method

Currently available methods include qnorm and absLog10.

replaceZero

Logical, whether to replace zero p-values with the minimal double value specified by the machine. Default is TRUE. If set to FALSE, results will contain infinite values.

See Also

pAbsLog10Score, pQnormScore

Examples

Run this code

testPvals <- c(0.001, 0.01, 0.05, 0.1, 0.5, 1)
pScore(testPvals, method="absLog10")
pScore(testPvals, method="qnorm")
testPvalSign <- rep(c(-1,1), 3)
pScore(testPvals, sign=testPvalSign, method="absLog10")
pScore(testPvals, sign=testPvalSign, method="qnorm")
testLog <- rep(c(TRUE, FALSE),3)
pScore(testPvals, testLog, method="absLog10")
pScore(testPvals, testLog, method="qnorm")

testPvals <- 10^seq(-5, 0, 0.05)
plot(pScore(testPvals, method="qnorm"),
     pScore(testPvals, method="absLog10"),
     xlab="pQnormScore", ylab="pAbsLog10Score"); abline(0,1, col="red", lty=2)

Run the code above in your browser using DataLab