@@ -32,7 +32,7 @@ fixedLogitLassoInf=function(x,y,beta,lambda,alpha=.1, type=c("partial"), tol.bet
32
32
m = beta [- 1 ]!= 0 # active set
33
33
34
34
bhat = c(beta [1 ],beta [- 1 ][beta [- 1 ]!= 0 ]) # intcpt plus active vars
35
- s2 = sign(bhat )
35
+ sign_bhat = sign(bhat )
36
36
lam2m = diag(c(0 ,rep(lambda ,sum(m ))))
37
37
38
38
@@ -66,14 +66,14 @@ fixedLogitLassoInf=function(x,y,beta,lambda,alpha=.1, type=c("partial"), tol.bet
66
66
# MM=solve(t(xxm)%*%w%*%xxm)
67
67
MM = solve(scale(t(xxm ),F ,1 / ww )%*% xxm )
68
68
gm = c(0 ,- g [vars ]* lambda ) # gradient at LASSO solution, first entry is 0 because intercept is unpenalized
69
- # at exact LASSO solution it should be s2 [-1]
69
+ # at exact LASSO solution it should be sign_bhat [-1]
70
70
dbeta = MM %*% gm
71
71
72
- # bbar=(bhat+lam2m%*%MM%*%s2 ) # JT: this is wrong, shouldn't use sign of intercept anywhere...
72
+ # bbar=(bhat+lam2m%*%MM%*%sign_bhat ) # JT: this is wrong, shouldn't use sign of intercept anywhere...
73
73
bbar = bhat - dbeta
74
74
75
- A1 = - (mydiag(s2 ))[- 1 ,]
76
- b1 = (s2 * dbeta )[- 1 ]
75
+ A1 = - (mydiag(sign_bhat ))[- 1 ,]
76
+ b1 = (sign_bhat * dbeta )[- 1 ]
77
77
78
78
tol.poly = 0.01
79
79
if (max((A1 %*% bbar ) - b1 ) > tol.poly )
@@ -87,7 +87,7 @@ fixedLogitLassoInf=function(x,y,beta,lambda,alpha=.1, type=c("partial"), tol.bet
87
87
88
88
89
89
for (jj in 1 : sum(m )){
90
- vj = c(rep(0 ,sum(m )+ 1 ));vj [jj + 1 ]= s2 [jj + 1 ]
90
+ vj = c(rep(0 ,sum(m )+ 1 ));vj [jj + 1 ]= sign_bhat [jj + 1 ]
91
91
# compute p-values
92
92
junk = TG.pvalue(bbar , A1 , b1 , vj , MM )
93
93
pv [jj ] = junk $ pv
0 commit comments