Skip to content

Commit e01d8f1

Browse files
removing the offset_correction which was just for the comparison
1 parent ce15b68 commit e01d8f1

File tree

3 files changed

+7
-24
lines changed

3 files changed

+7
-24
lines changed

selectiveInference/R/funs.fixed.R

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ fixedLassoInf <- function(x, y, beta,
88
sigma=NULL, alpha=0.1,
99
type=c("partial", "full"), tol.beta=1e-5, tol.kkt=0.1,
1010
gridrange=c(-100,100), bits=NULL, verbose=FALSE,
11-
linesearch.try=10, offset_correction=TRUE) {
11+
linesearch.try=10) {
1212

1313
family = match.arg(family)
1414
this.call = match.call()
@@ -197,9 +197,6 @@ fixedLassoInf <- function(x, y, beta,
197197
M = M[-1,] # remove intercept row
198198
null_value = null_value[-1] # remove intercept element
199199
}
200-
if (!offset_correction) {
201-
null_value = 0 * null_value
202-
}
203200
} else if (type=="partial" || p > n) {
204201
xa = x[,vars,drop=F]
205202
M = pinv(crossprod(xa)) %*% t(xa)

tests/debiased_lasso/comparison_scaled.R

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@ p=200
1919

2020
sigma=.5
2121

22-
theor_lambda = sigma * sqrt(2 * log(p))
23-
lambda=c(0.25, 0.5, 1, 0.8 * theor_lambda, theor_lambda)
22+
lambda=c(0.25, 0.5, 1)
2423

25-
for (j in c(3,4,5,1,2)) {
24+
for (j in c(3,2,1)) {
2625

2726
thresh = 1e-10
2827

@@ -54,12 +53,8 @@ for (i in 1:nsim) {
5453

5554
aa = fixedLassoInf(x,y,bhat,lambda[j]*sqrt(n) / scaling,intercept=F,sigma=sigma,type=type)
5655
bb = oldFixedLassoInf(x,y,bhat,lambda[j]*sqrt(n) / scaling,intercept=F,sigma=sigma,type=type)
57-
cc = fixedLassoInf(x,y,bhat,lambda[j]*sqrt(n) / scaling,intercept=F,sigma=sigma,type=type, offset_correction=FALSE)
58-
dd = oldFixedLassoInf(x,y,bhat,lambda[j]*sqrt(n) / scaling,intercept=F,sigma=sigma,type=type, offset_correction=FALSE)
5956
pvs_new <- c(pvs_new, aa$pv, recursive=TRUE)
6057
pvs_old <- c(pvs_old, bb$pv,recursive=TRUE)
61-
pvs_new_0 <- c(pvs_new_0, cc$pv, recursive=TRUE)
62-
pvs_old_0 <- c(pvs_old_0, dd$pv, recursive=TRUE)
6358

6459
cat()
6560
}
@@ -70,9 +65,7 @@ for (i in 1:nsim) {
7065
png(paste('comparison_scaled', j, '.png', sep=''))
7166
plot(ecdf(pvs_old), pch=23, col='green', xlim=c(0,1), ylim=c(0,1), main='ECDF of p-values')
7267
plot(ecdf(pvs_new), pch=24, col='purple', add=TRUE)
73-
plot(ecdf(pvs_old_0), pch=23, col='red', add=TRUE)
74-
plot(ecdf(pvs_new_0), pch=24, col='black', add=TRUE)
7568
abline(0,1)
76-
legend("bottomright", legend=c("Old","New", "Old 0", "New 0"), pch=c(23,24,23,24), pt.bg=c("green","purple","red","black"))
69+
legend("bottomright", legend=c("Old", "New"), pch=c(23,24), pt.bg=c("green","purple"))
7770
dev.off()
7871
}

tests/debiased_lasso/comparison_unscaled.R

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@ p=200
1919

2020
sigma=.5
2121

22-
theor_lambda = sigma * sqrt(2 * log(p))
23-
lambda=c(0.25, 0.5, 1, 0.8 * theor_lambda, theor_lambda)
22+
lambda=c(0.25, 0.5, 1)
2423

25-
for (j in c(3,4,5,1,2)) {
24+
for (j in c(3,2,1)) {
2625

2726
thresh = 1e-10
2827

@@ -54,12 +53,8 @@ for (i in 1:nsim) {
5453

5554
aa = fixedLassoInf(x,y,bhat,lambda[j]*sqrt(n) / scaling,intercept=F,sigma=sigma,type=type)
5655
bb = oldFixedLassoInf(x,y,bhat,lambda[j]*sqrt(n) / scaling,intercept=F,sigma=sigma,type=type)
57-
cc = fixedLassoInf(x,y,bhat,lambda[j]*sqrt(n) / scaling,intercept=F,sigma=sigma,type=type, offset_correction=FALSE)
58-
dd = oldFixedLassoInf(x,y,bhat,lambda[j]*sqrt(n) / scaling,intercept=F,sigma=sigma,type=type, offset_correction=FALSE)
5956
pvs_new <- c(pvs_new, aa$pv, recursive=TRUE)
6057
pvs_old <- c(pvs_old, bb$pv,recursive=TRUE)
61-
pvs_new_0 <- c(pvs_new_0, cc$pv, recursive=TRUE)
62-
pvs_old_0 <- c(pvs_old_0, dd$pv, recursive=TRUE)
6358

6459
cat()
6560
}
@@ -70,9 +65,7 @@ for (i in 1:nsim) {
7065
png(paste('comparison_unscaled', j, '.png', sep=''))
7166
plot(ecdf(pvs_old), pch=23, col='green', xlim=c(0,1), ylim=c(0,1), main='ECDF of p-values')
7267
plot(ecdf(pvs_new), pch=24, col='purple', add=TRUE)
73-
plot(ecdf(pvs_old_0), pch=23, col='red', add=TRUE)
74-
plot(ecdf(pvs_new_0), pch=24, col='black', add=TRUE)
7568
abline(0,1)
76-
legend("bottomright", legend=c("Old","New", "Old 0", "New 0"), pch=c(23,24,23,24), pt.bg=c("green","purple","red","black"))
69+
legend("bottomright", legend=c("Old", "New"), pch=c(23,24), pt.bg=c("green","purple"))
7770
dev.off()
7871
}

0 commit comments

Comments
 (0)