File tree Expand file tree Collapse file tree 1 file changed +1
-44
lines changed Expand file tree Collapse file tree 1 file changed +1
-44
lines changed Original file line number Diff line number Diff line change @@ -127,49 +127,6 @@ library(selectiveInference)
127
127
library(glmnet )
128
128
set.seed(43 )
129
129
130
- n = 200
131
- p = 100
132
- s = 2
133
- sigma = 1
134
-
135
- x = matrix (rnorm(n * p ),n ,p )
136
- x = scale(x ,TRUE ,TRUE )
137
-
138
- beta = c(rep(10 , s ), rep(0 ,p - s )) / sqrt(n )
139
- y = x \%* \% beta + sigma * rnorm(n )
140
-
141
- # first run glmnet
142
- gfit = glmnet(x ,y ,standardize = FALSE )
143
-
144
- # extract coef for a given lambda; note the 1/n factor!
145
- # (and we don't save the intercept term)
146
- lambda = 4 * sqrt(n )
147
- lambda_glmnet = 4 / sqrt(n )
148
- beta = selectiveInference ::: solve_problem_glmnet(x ,
149
- y ,
150
- lambda_glmnet ,
151
- penalty_factor = rep(1 ,p ),
152
- family = " gaussian" )
153
- # compute fixed lambda p-values and selection intervals
154
- out = ROSI(x ,
155
- y ,
156
- beta ,
157
- lambda ,
158
- dispersion = sigma ^ 2 )
159
- out
160
-
161
- # an alternate approximate inverse from Boot and Nibbering
162
-
163
- out = ROSI(x ,
164
- y ,
165
- beta ,
166
- lambda ,
167
- dispersion = sigma ^ 2 ,
168
- debiasing_method = " BN" )
169
- out
170
-
171
- # wide matrices work too
172
-
173
130
n = 100
174
131
p = 200
175
132
s = 2
@@ -201,7 +158,7 @@ out = ROSI(x,
201
158
dispersion = sigma ^ 2 )
202
159
out
203
160
204
- # an alternate approximate inverse
161
+ # an alternate approximate inverse from Boot and Nibbering
205
162
206
163
out = ROSI(x ,
207
164
y ,
You can’t perform that action at this time.
0 commit comments