Package 'RNOmni'

Title: Rank Normal Transformation Omnibus Test
Description: Inverse normal transformation (INT) based genetic association testing. These tests are recommended for continuous traits with non-normally distributed residuals. INT-based tests robustly control the type I error in settings where standard linear regression does not, as when the residual distribution exhibits excess skew or kurtosis. Moreover, INT-based tests outperform standard linear regression in terms of power. These tests may be classified into two types. In direct INT (D-INT), the phenotype is itself transformed. In indirect INT (I-INT), phenotypic residuals are transformed. The omnibus test (O-INT) adaptively combines D-INT and I-INT into a single robust and statistically powerful approach. See McCaw ZR, Lane JM, Saxena R, Redline S, Lin X. "Operating characteristics of the rank-based inverse normal transformation for quantitative trait analysis in genome-wide association studies" <doi:10.1111/biom.13214>.
Authors: Zachary R. McCaw [aut, cre]
Maintainer: Zachary R. McCaw <[email protected]>
License: GPL-3
Version: 1.0.1.4
Built: 2026-05-26 09:07:52 UTC
Source: https://github.com/zrmacc/rnomni

Help Index


RNOmni: Rank normal transformation omnibus association test

Description

INT-based tests control type I error when standard linear regression does not (e.g. skewed or kurtotic residuals) and typically outperform linear regression in power. The package provides:

  • BAT: Basic association test (no transformation).

  • DINT: Direct INT (phenotype is rank-normalized).

  • IINT: Indirect INT (phenotypic residuals are rank-normalized).

  • OINT: Omnibus test combining D-INT and I-INT via Cauchy combination (OmniP).

Helper functions include RankNorm (rank-based INT) and FitOLS (OLS fit).

Details

Genetic association tests based on the rank-based inverse normal transformation (INT). Recommended for continuous traits with non-normally distributed residuals.

Use OINT for a single robust test that adapts to the trait distribution. Use DINT when the trait may be a rank-preserving transform of a normal trait, and IINT when the trait is linear in covariates but has non-normal residuals.

Author(s)

Maintainer: Zachary McCaw [email protected] (ORCID)

References

McCaw ZR, Lane JM, Saxena R, Redline S, Lin X (2020). Operating characteristics of the rank-based inverse normal transformation for quantitative trait analysis in genome-wide association studies. Biometrics, doi:10.1111/biom.13214.

See Also

OINT, DINT, IINT, BAT, RankNorm, OmniP


Basic Input Checks

Description

Stops evaluation if inputs are improperly formatted.

Usage

BasicInputChecks(y, G, X)

Arguments

y

Numeric phenotype vector.

G

Genotype matrix with observations as rows, SNPs as columns.

X

Covariate matrix.

Value

None; called for side effects (stops on invalid input).


Basic Association Test

Description

Conducts tests of association between the loci in G and the untransformed phenotype y, adjusting for the model matrix X.

Usage

BAT(y, G, X = NULL, test = "Score", simple = FALSE)

Arguments

y

Numeric phenotype vector.

G

Genotype matrix with observations as rows, SNPs as columns.

X

Model matrix of covariates and structure adjustments. Should include an intercept. Omit or set to NULL for marginal tests of association.

test

Character: "Score" or "Wald".

simple

If TRUE, return only the p-values; if FALSE, return the full matrix of statistic, SE, Z, and p-value.

Value

If simple = TRUE, returns a vector of p-values, one for each column of G. If simple = FALSE, returns a numeric matrix, including the Wald or Score statistic, its standard error, the Z-score, and the p-value.

See Also

Examples

set.seed(100)
# Design matrix
X <- cbind(1, stats::rnorm(1e3))
# Genotypes
G <- replicate(1e3, stats::rbinom(n = 1e3, size = 2, prob = 0.25))
storage.mode(G) <- "numeric"
# Phenotype
y <- as.numeric(X %*% c(1, 1)) + stats::rnorm(1e3)
# Association test
p <- BAT(y = y, G = G, X = X)

Convert Cauchy Random Variable to P

Description

Convert Cauchy Random Variable to P

Usage

CauchyToP(z)

Arguments

z

Numeric Cauchy random variable.

Value

Numeric p-value.


Direct-INT

Description

Applies the rank-based inverse normal transformation (RankNorm) to the phenotype y. Conducts tests of association between the loci in G and transformed phenotype, adjusting for the model matrix X.

Usage

DINT(
  y,
  G,
  X = NULL,
  k = 0.375,
  test = "Score",
  ties.method = "average",
  simple = FALSE
)

Arguments

y

Numeric phenotype vector.

G

Genotype matrix with observations as rows, SNPs as columns.

X

Model matrix of covariates and structure adjustments. Should include an intercept. Omit or set to NULL for marginal tests of association.

k

Offset for rank-normalization; see RankNorm.

test

Character: "Score" or "Wald".

ties.method

Method for breaking ties, passed to rank.

simple

If TRUE, return only p-values; if FALSE, return the full matrix of statistic, SE, Z, and p-value.

Value

If simple = TRUE, returns a vector of p-values, one for each column of G. If simple = FALSE, returns a numeric matrix, including the Wald or Score statistic, its standard error, the Z-score, and the p-value.

See Also

  • Basic association test BAT.

  • Indirect INT test IINT.

  • Omnibus INT test OINT.

Examples

set.seed(100)
# Design matrix
X <- cbind(1, stats::rnorm(1e3))
# Genotypes
G <- replicate(1e3, stats::rbinom(n = 1e3, size = 2, prob = 0.25))
storage.mode(G) <- "numeric"
# Phenotype
y <- exp(as.numeric(X %*% c(1, 1)) + stats::rnorm(1e3))
# Association test
p <- DINT(y = y, G = G, X = X)

Ordinary least squares

Description

Fits the linear model y=Xβ+ϵy = X \beta + \epsilon by OLS.

Usage

FitOLS(y, X)

Arguments

y

Numeric response vector (length nn).

X

Numeric design matrix (n×pn \times p); typically includes an intercept column.

Value

A list:

Beta

Estimated coefficient vector β^\hat{\beta}.

V

Residual variance σ^2\hat{\sigma}^2 (residual sum of squares divided by npn - p).

Ibb

Information matrix for β\beta (scaled XXX'X).

Resid

Residual vector yXβ^y - X \hat{\beta}.


Indirect-INT

Description

Two-stage association testing procedure. In the first stage, phenotype y and genotype G are each regressed on the model matrix X to obtain residuals. The phenotypic residuals are transformed using RankNorm. In the next stage, the INT-transformed residuals are regressed on the genotypic residuals.

Usage

IINT(y, G, X = NULL, k = 0.375, ties.method = "average", simple = FALSE)

Arguments

y

Numeric phenotype vector.

G

Genotype matrix with observations as rows, SNPs as columns.

X

Model matrix of covariates and structure adjustments. Should include an intercept. Omit or set to NULL for marginal tests of association.

k

Offset for rank-normalization; see RankNorm.

ties.method

Method for breaking ties, passed to rank.

simple

If TRUE, return only p-values; if FALSE, return the full matrix of Score statistic, SE, Z, and p-value.

Value

If simple = TRUE, returns a vector of p-values, one for each column of G. If simple = FALSE, returns a numeric matrix, including the Wald or Score statistic, its standard error, the Z-score, and the p-value.

See Also

  • Basic association test BAT.

  • Direct INT test DINT.

  • Omnibus INT test OINT.

Examples

set.seed(100)
# Design matrix
X <- cbind(1, stats::rnorm(1e3))
# Genotypes
G <- replicate(1e3, stats::rbinom(n = 1e3, size = 2, prob = 0.25))
storage.mode(G) <- "numeric"
# Phenotype
y <- exp(as.numeric(X %*% c(1,1)) + stats::rnorm(1e3))
# Association test
p <- IINT(y = y, G = G, X = X)

Omnibus-INT

Description

Association test that synthesizes the DINT and IINT tests. The first approach is most powerful for traits that could have arisen from a rank-preserving transformation of a latent normal trait. The second approach is most powerful for traits that are linear in covariates, yet have skewed or kurtotic residual distributions. During the omnibus test, the direct and indirect tests are separately applied, then the p-values are combined via the Cauchy combination method.

Usage

OINT(
  y,
  G,
  X = NULL,
  k = 0.375,
  ties.method = "average",
  weights = c(1, 1),
  simple = FALSE
)

Arguments

y

Numeric phenotype vector.

G

Genotype matrix with observations as rows, SNPs as columns.

X

Model matrix of covariates and structure adjustments. Should include an intercept. Omit to perform marginal tests of association.

k

Offset applied during rank-normalization. See RankNorm.

ties.method

Method of breaking ties, passed to base::rank.

weights

Numeric length-2 vector of weights for the D-INT and I-INT p-values in the Cauchy combination. Default c(1, 1) gives equal weight.

simple

If TRUE, return only the omnibus p-values; if FALSE, return a matrix with D-INT, I-INT, and OINT p-values.

Value

If simple = TRUE, a named numeric vector of omnibus p-values (one per column of G). If simple = FALSE, a numeric matrix with columns DINT-p, IINT-p, OINT-p and one row per SNP.

See Also

  • Basic association test BAT.

  • Direct INT test DINT.

  • Indirect INT test IINT.

Examples

set.seed(100)
# Design matrix
X <- cbind(1, rnorm(1e3))
# Genotypes
G <- replicate(1e3, rbinom(n = 1e3, size = 2, prob = 0.25))
storage.mode(G) <- "numeric"
# Phenotype
y <- exp(as.numeric(X %*% c(1, 1)) + rnorm(1e3))
# Omnibus
p <- OINT(y = y, G = G, X = X, simple = TRUE)

Omnibus P-value (Cauchy combination)

Description

Combines a vector of potentially dependent p-values into a single p-value using the Cauchy combination method: p-values are converted to Cauchy random deviates, then weighted and summed; the sum is again Cauchy, and is converted back to a p-value.

Usage

OmniP(p, w = NULL)

Arguments

p

Numeric vector of p-values (each in [0, 1]; cannot mix 0 and 1).

w

Optional numeric weight vector of the same length as p. If NULL, equal weights are used.

Value

A single numeric p-value.

References

Liu Y, Xie J (2020). Cauchy combination test: a powerful test with bimodal distributions. J Am Stat Assoc, doi:10.1080/01621459.2018.1554485.

See Also

OINT, which uses OmniP to combine D-INT and I-INT p-values.


Partition Data

Description

Partition y and X according to the missingness pattern of g.

Usage

PartitionData(e, g, X)

Arguments

e

Numeric residual vector.

g

Genotype vector.

X

Model matrix of covariates.

Value

List containing:

  • "g_obs", observed genotype vector.

  • "X_obs", covariates for subjects with observed genotypes.

  • "X_mis", covariates for subjects with missing genotypes.

  • "e_obs", residuals for subjects with observed genotypes.


Convert P-value to Cauchy Random

Description

Convert P-value to Cauchy Random

Usage

PtoCauchy(p)

Arguments

p

Numeric p-value.

Value

Numeric Cauchy random variable.


Rank-Normalize

Description

Applies the rank-based inverse normal transform (INT) to a numeric vector. Observations are first mapped to the (0, 1) scale via the empirical cumulative distribution function (ECDF), then to the real line via the probit (inverse normal CDF).

Usage

RankNorm(u, k = 0.375, ties.method = "average")

Arguments

u

Numeric vector. Must not contain NA.

k

Offset in the probability scale; must be in (0, 0.5). Default 0.375 corresponds to the Blom transform.

ties.method

Method for breaking ties, passed to rank.

Value

Numeric vector of rank-normalized values (same length as u).

See Also

  • Direct INT test DINT.

  • Indirect INT test IINT.

  • Omnibus INT test OINT.

Examples

# Draw from chi-1 distribution
y <- stats::rchisq(n = 1e3, df = 1)
# Rank normalize
z <- RankNorm(y)
# Plot density of transformed measurement
plot(stats::density(z))