The R package HDNRA provides inverse-free high-dimensional location tests for two-sample and general linear hypothesis testing (GLHT) problems under equal or unequal covariance structures. It implements classical normal-approximation-based procedures, normal-reference tests based on covariance-matched Gaussian companions, and F-type normal-reference calibrations for heteroscedastic Behrens–Fisher and GLHT settings. Computationally intensive components are implemented in C++ through Rcpp and RcppArmadillo.
Version 2.1.0 contains 24 public testing routines and two real data sets.
Implemented data sets and testing routines
Two real data sets in HDNRA:
Seven normal-reference tests for the two-sample problem:
- ZGZC2020.TS.2cNRT
- ZZ2022.TS.3cNRT
- ZZZ2020.TS.2cNRT
- ZWZ2023.TSBF.2cNRT
- ZZ2022.TSBF.3cNRT
- ZZGZ2021.TSBF.2cNRT
- ZZZ2023.TSBF.2cNRT
Seven normal-reference tests for the GLHT/GLHTBF problem:
- ZGZ2017.GLHT.2cNRT
- ZZ2022.GLHT.3cNRT
- ZZZ2022.GLHT.2cNRT
- ZZ2022.GLHTBF.3cNRT
- ZZG2022.GLHTBF.2cNRT
- WZ2026.GLHTBF.2cNRT
- CCXH2024.GLHTBF.2cNRT
Four normal-approximation-based tests for the two-sample problem:
Six normal-approximation-based and benchmark tests for the GLHT/GLHTBF problem:
Installation
Install the CRAN release with:
install.packages("HDNRA")You can also install the development version from GitHub:
# Installing from GitHub requires devtools or remotes.
install.packages("devtools")
# Or:
install.packages("remotes")
# Install the development version from GitHub.
devtools::install_github("nie23wp8738/HDNRA")
# Or:
remotes::install_github("nie23wp8738/HDNRA")Usage
Example data
Package HDNRA comes with two real data sets:
# A COVID-19 transcriptomic data set for the two-sample problem.
?COVID19
data(COVID19)
dim(COVID19)
group1 <- as.matrix(COVID19[c(2:19, 82:87), ]) # healthy controls
group2 <- as.matrix(COVID19[-c(1:19, 82:87), ]) # COVID-19 patients
dim(group1)
dim(group2)
# A corneal topography data set for the GLHT problem.
?corneal
data(corneal)
dim(corneal)
group1 <- as.matrix(corneal[1:43, ]) # normal group
group2 <- as.matrix(corneal[44:57, ]) # unilateral suspect group
group3 <- as.matrix(corneal[58:78, ]) # suspect map group
group4 <- as.matrix(corneal[79:150, ]) # clinical keratoconus group
dim(group1)
dim(group2)
dim(group3)
dim(group4)Example for the two-sample problem
A simple example using the F-type normal-reference Behrens–Fisher test ZWZ2023.TSBF.2cNRT() with the COVID19 data set:
Example for the GLHT problem
A simple example using the F-type normal-reference GLHTBF test WZ2026.GLHTBF.2cNRT() with the corneal data set:
data("corneal")
group1 <- as.matrix(corneal[1:43, ])
group2 <- as.matrix(corneal[44:57, ])
group3 <- as.matrix(corneal[58:78, ])
group4 <- as.matrix(corneal[79:150, ])
Y <- list(group1, group2, group3, group4)
k <- length(Y)
n <- vapply(Y, nrow, integer(1))
p <- ncol(Y[[1]])
# Omnibus one-way contrast against the last group.
G <- cbind(diag(k - 1), rep(-1, k - 1))
WZ2026.GLHTBF.2cNRT(Y, G, n, p)A rank-one heteroscedastic GLHTBF example can be run with CCXH2024.GLHTBF.2cNRT():
B <- c(-2, 1, 2, -1)
CCXH2024.GLHTBF.2cNRT(Y, B, n, p, alpha = 0.05)The random-integration normal-approximation GLHTBF routine LHNB2025.GLHTBF.NABT() uses a rank-one coefficient vector and tuning vectors O and A:
B <- c(-2, 1, 2, -1)
A <- rep(sqrt(5) * p^(-3 / 8), p)
eps <- 2
O <- sqrt(eps * (1 + 2 * (1:p) / (3 * p)))
LHNB2025.GLHTBF.NABT(Y, B, O, A, n, p)Code of Conduct
Please note that the HDNRA project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.