Skip to content

Commit c0dab8c

Browse files
committed
rob fixed type=full option
1 parent 726b917 commit c0dab8c

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

selectiveInference/R/funs.fixed.R

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,11 @@ fixedLassoInf <- function(x, y, beta,
8282

8383
tol.coef = tol.beta * sqrt(n^2 / colSums(x^2))
8484
# print(tol.coef)
85-
vars = which(abs(beta) > tol.coef)
85+
# vars = which(abs(beta) > tol.coef)
86+
vars = abs(beta) > tol.coef
8687
# print(beta)
8788
# print(vars)
88-
if(length(vars)==0){
89+
if(sum(vars)==0){
8990
cat("Empty model",fill=T)
9091
return()
9192
}
@@ -96,10 +97,17 @@ fixedLassoInf <- function(x, y, beta,
9697
"'thresh' parameter, for a more accurate convergence."))
9798

9899
# Get lasso polyhedral region, of form Gy >= u
100+
<<<<<<< HEAD
101+
if (type == 'full') out = fixedLasso.poly(x,y,beta,lambda,vars,inactive=TRUE)
102+
else out = fixedLasso.poly(x,y,beta,lambda,vars)
103+
G = out$G
104+
u = out$u
105+
=======
99106
if (type == 'full' & p > n) out = fixedLassoPoly(x,y,lambda,beta,vars,inactive=TRUE)
100107
else out = fixedLassoPoly(x,y,lambda,beta,vars)
101108
A = out$A
102109
b = out$b
110+
>>>>>>> 726b917649c7aaabd030b2cab062836ca774ef57
103111

104112
# Check polyhedral region
105113
tol.poly = 0.01
@@ -127,7 +135,8 @@ fixedLassoInf <- function(x, y, beta,
127135
# add additional targets for inference if provided
128136
if (!is.null(add.targets)) vars = sort(unique(c(vars,add.targets,recursive=T)))
129137

130-
k = length(vars)
138+
k = length(vars)
139+
k=sum(vars)
131140
pv = vlo = vup = numeric(k)
132141
vmat = matrix(0,k,n)
133142
ci = tailarea = matrix(0,k,2)

0 commit comments

Comments
 (0)