Implements conditional inference on normal variates as described in Lee, Sun, Sun and Taylor, “Exact Post Selection Inference, with Application to the Lasso.”
– Steven E. Pav, shabbychef@gmail.com
This package may be installed from CRAN; the latest version may be found on github via devtools, or installed via drat:
# CRAN
install.packages(c("epsiwal"))
# devtools
if (require(devtools)) {
# latest greatest
install_github("shabbychef/epsiwal")
}# via drat:
if (require(drat)) {
:::add("shabbychef")
dratinstall.packages("epsiwal")
}
First we perform some simulations under the null to show that the p-values are uniform. We draw a normal vector with identity covariance and zero mean, then flip the sign of each element to make them positive. We then perform inference on the sum of the mean values.
library(epsiwal)
<- 20
p <- rep(0, p)
mu <- diag(p)
Sigma <- -diag(p)
A <- rep(0, p)
b <- rep(1, p)
eta <- diag(Sigma)
Sigma_eta <- as.numeric(t(eta) %*% mu)
eta_mu set.seed(1234)
<- replicate(1000, {
pvals <- rnorm(p, mean = mu, sd = sqrt(diag(Sigma)))
y <- abs(y)
ay pconnorm(y = ay, A = A, b = b, eta = eta, Sigma_eta = Sigma_eta,
eta_mu = eta_mu)
})qqplot(pvals, qunif(ppoints(length(pvals))), main = "p-values under procedure",
ylab = "theoretical", xlab = "empirical")
library(epsiwal)
<- 20
p <- rep(0, p)
mu <- diag(p)
Sigma <- -diag(p)
A <- rep(0, p)
b <- rep(1, p)
eta <- diag(Sigma)
Sigma_eta <- as.numeric(t(eta) %*% mu)
eta_mu <- 0.05
type_I set.seed(1234)
<- replicate(5000, {
civals <- rnorm(p, mean = mu, sd = sqrt(diag(Sigma)))
y <- abs(y)
ay <- ci_connorm(y = ay, A = A, b = b, p = type_I,
ci eta = eta, Sigma_eta = Sigma_eta)
})cat("Empirical coverage of the", type_I, "confidence bound is around",
mean(civals < eta_mu), ".\n")
## Empirical coverage of the 0.05 confidence bound is around 0.052 .
PSAT
package, which supports similar procedures, but is not yet on
CRAN.SelectiveInference
package, which implements similar inferential procedures under
quadratic constraints, as detailed in Tibshirani, R. J., Taylor, J.,
Lockhart, R. and Tibshirani, R. Exact Post-Selection Inference
for Sequential Regression Procedures.