@@ -257,29 +257,54 @@ set.seed(43)
257
257
out = fixedLassoInf(x , tim , beta_hat , lambda , status = status , family = " cox" )
258
258
out
259
259
260
- # Debiased lasso or "full"
260
+ # Debiased lasso or "full"
261
261
262
- n = 50
263
- p = 100
264
- sigma = 1
262
+ n = 50
263
+ p = 100
264
+ sigma = 1
265
265
266
- x = matrix (rnorm(n * p ),n ,p )
267
- x = scale(x ,TRUE ,TRUE )
266
+ x = matrix (rnorm(n * p ),n ,p )
267
+ x = scale(x ,TRUE ,TRUE )
268
268
269
- beta = c(3 ,2 ,rep(0 ,p - 2 ))
270
- y = x \%* \%beta + sigma * rnorm(n )
269
+ beta = c(3 ,2 ,rep(0 ,p - 2 ))
270
+ y = x \%* \%beta + sigma * rnorm(n )
271
271
272
- # first run glmnet
273
- gfit = glmnet(x , y , standardize = FALSE , intercept = FALSE )
272
+ # first run glmnet
273
+ gfit = glmnet(x , y , standardize = FALSE , intercept = FALSE )
274
274
275
- # extract coef for a given lambda; note the 1/n factor!
276
- # (and we don't save the intercept term)
277
- lambda = 2.8
278
- beta = coef(gfit , x = x , y = y , s = lambda / n , exact = TRUE )[- 1 ]
275
+ # extract coef for a given lambda; note the 1/n factor!
276
+ # (and we don't save the intercept term)
277
+ lambda = 2.8
278
+ beta = coef(gfit , x = x , y = y , s = lambda / n , exact = TRUE )[- 1 ]
279
279
280
- # compute fixed lambda p-values and selection intervals
281
- out = fixedLassoInf(x , y , beta , lambda , sigma = sigma , type = ' full' , intercept = FALSE )
282
- out
280
+ # compute fixed lambda p-values and selection intervals
281
+ out = fixedLassoInf(x , y , beta , lambda , sigma = sigma , type = ' full' , intercept = FALSE )
282
+ out
283
+
284
+ # When n > p and "full" we use the full inverse
285
+ # instead of Javanmard and Montanari's approximate inverse
286
+
287
+ n = 200
288
+ p = 50
289
+ sigma = 1
290
+
291
+ x = matrix (rnorm(n * p ),n ,p )
292
+ x = scale(x ,TRUE ,TRUE )
293
+
294
+ beta = c(3 ,2 ,rep(0 ,p - 2 ))
295
+ y = x \%* \%beta + sigma * rnorm(n )
296
+
297
+ # first run glmnet
298
+ gfit = glmnet(x , y , standardize = FALSE , intercept = FALSE )
299
+
300
+ # extract coef for a given lambda; note the 1/n factor!
301
+ # (and we don't save the intercept term)
302
+ lambda = 2.8
303
+ beta = coef(gfit , x = x , y = y , s = lambda / n , exact = TRUE )[- 1 ]
304
+
305
+ # compute fixed lambda p-values and selection intervals
306
+ out = fixedLassoInf(x , y , beta , lambda , sigma = sigma , type = ' full' , intercept = FALSE )
307
+ out
283
308
284
309
}
285
310
0 commit comments