mlog10p: Negative log10 P values

Description Usage Arguments Details Value Author(s) Examples

View source: R/transform.R

Description

Compute minus log10 P values from effect sizes and standard errors.

Usage

1

Arguments

beta

a vector of effect sizes

se

a vector of standard errors

Details

The results are the same as -log10(pnorm(-abs(beta)/se)*2), but are calculated to machine precision even when the P values are very small (such that the intermediate step of calculating the P values would give zero to machine precision).

Value

The vector of minus log10 P values.

Author(s)

Toby Johnson Toby.x.Johnson@gsk.com

Examples

1
2
3
4
5
beta <- c(1:4, (1:10)*5) * rep(c(-1, 1), 7)
se <- rep(1, length(beta))
pval1 <- pnorm(-abs(beta)/se)*2
pval2 <- pchisq(beta^2/se^2, df = 1, lower.tail = FALSE)
cbind(z = beta/se, pval = pval1, -log10(pval1), -log10(pval2), mlog10p(beta, se))

tobyjohnson/gtx documentation built on Aug. 30, 2019, 8:07 p.m.