Software
- Randomized Multiarm Bandits (rMAB) – R code for improved adaptive data collection in multi-arm bandits.
-
Rgpt: R Interface to ChatGPT
– R package providing an API for interacting with ChatGPT from R.
Show installation & example
Setup: obtain an
OPENAI_API_KEYfrom OpenAI and put it in.RenvironasOPENAI_API_KEY=<your key>.library(devtools) install_github("zhaozhg81/Rgpt")library(Rgpt) Rgpt("Using R, write a sample code for linear model.") x = matrix(rnorm(12), nrow = 3, ncol = 4) LatexTable(3, 4, t(round(x, digits = 3))) -
gSNR: Generalized Signal-to-Noise Ratio
– R package for generalized signal-to-noise ratio and associated tests.
Show installation & example
library(devtools) install_github("zhaozhg81/gSNR")library(gSNR) n <- 1000 H <- 20 m <- n / H sigma <- 1 p <- 20 set.seed(2) D <- 1 beta <- array(0, c(p, D)) beta <- rnorm(p, 0, 1) X <- matrix(rnorm(p * n), c(n, p)) Z <- X %*% beta Y <- sin(Z[, 1]) * exp(Z[, 1]) * 0.2 + sigma * rnorm(n, 0, 1) res <- gSNR(X, Y, discrete = FALSE, pvalue = TRUE) res$stat res$pvalue ORD <- order(Y) Y2 <- array(0, n) Y2[ORD[1:floor(n / 3)]] <- 1 Y2[ORD[(floor(n / 3) + 1):floor(2 * n / 3)]] <- 2 Y2[ORD[(floor(2 * n / 3) + 1):n]] <- 3 res.2 <- gSNR(X, Y2, discrete = TRUE, pvalue = TRUE) res.2$stat res.2$pvalue - BET: Binary Expansion Test – R package for binary expansion–based independence testing.
- LassoSIR – R package for sparse sliced inverse regression via Lasso.
- GroupTest – R package for multiple testing procedures with grouped hypotheses.
-
CLAT: CDF and locfdr Assisted Testing
– R package for CDF- and locfdr-assisted multiple testing.
Show installation & example
library(devtools) install_github("zhaozhg81/CLAT")library(CLAT) p <- 1000 X <- c(rnorm(100, -2, 1), rnorm(100, 2, 1), rnorm(800, 0, 1)) q <- 0.05 ## One-sided test p.right <- pnorm(X, lower.tail = FALSE) clat.right <- CLAT(p.right, q) rejind <- which(clat.right$SigInd != 0) ## Two-sided test p.right <- pnorm(X, lower.tail = FALSE) clat.right <- CLAT(p.right, q) p.left <- pnorm(X, lower.tail = TRUE) clat.left <- CLAT(p.left, q) rejind <- c(which(clat.left$SigInd != 0), which(clat.right$SigInd != 0)) - Bayesian LASSO with Zero Inflated Mixture Prior.
- EBVariant: An empirical Bayes testing procedure for detecting variants in analysis of next generation sequencing data.