Skip to content

Commit 739de67

Browse files
committed
2 parents 05347b6 + 1a77703 commit 739de67

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

selectiveInference/R/funs.fixedCox.R

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ if(sum(m)>0){
2929

3030
#check KKT
3131

32-
aaa=coxph(Surv(y,status)~x[,m],init=bhat,iter.max=0)
32+
aaa=coxph(Surv(y,status)~x[,m],init=bhat,iter.max=0) # this gives the Cox model at exactly bhat
33+
# so when we compute gradient and score
34+
# we are evaluating at the LASSO solution
35+
# naming of variables could be improved...
3336
res=residuals(aaa,type="score")
3437
if(!is.matrix(res)) res=matrix(res,ncol=1)
3538
scor=colSums(res)
@@ -39,11 +42,11 @@ scor=colSums(res)
3942
warning(paste("Solution beta does not satisfy the KKT conditions",
4043
"(to within specified tolerances)"))
4144

42-
45+
# Hessian of partial likelihood at the LASSO solution
4346
MM=vcov(aaa)
4447

45-
bbar=(bhat+lambda*MM%*%s2)
46-
A1=-(mydiag(s2))
48+
bbar=(bhat+lambda*MM%*%s2)
49+
A1=-(mydiag(s2))
4750
b1= -(mydiag(s2)%*%MM)%*%s2*lambda
4851

4952
temp=max(A1%*%bbar-b1)

0 commit comments

Comments
 (0)