@@ -15,7 +15,7 @@ robs.test <- function() {
15
15
hbeta <- as.numeric(coef(las ,x = X ,y = y ,s = lambda / n ,exact = TRUE ,intercept = T ))
16
16
17
17
18
- return (fixedLassoInf(X ,y ,hbeta [- 1 ],lambda ,family = " gaussian" ,type = " partial" ,intercept = T ,sigma = sigma )$ pv )
18
+ return (fixedLassoInf(X ,y ,hbeta [- 1 ],lambda ,family = " gaussian" ,type = " partial" ,intercept = T ,sigma = sigma ))
19
19
}
20
20
21
21
@@ -134,39 +134,4 @@ power.partial.pval.dist <- function(n,p,intercept=T,lambda=1) {
134
134
}
135
135
qqplot(x = runif(length(pvs )),y = pvs ,xlab = " Expected" ,ylab = " Observed" ,main = " Partial Coef. 10 Corr. X" )
136
136
abline(0 ,1 )
137
- }
138
-
139
-
140
-
141
-
142
- # # Tests pop inf for X and y randomly generated
143
- nullPopTest <- function (n ,p ,intercept = T ,lambda = 1 ) {
144
- y <- matrix (rnorm(n ),ncol = 1 ) # rand N(0,1) response
145
- X <- matrix (rnorm(p * n ),ncol = p ) # p rand N(0,1) predictors
146
-
147
- # lambda <- 1
148
- X = scale(X ,T ,T )/ sqrt(n - 1 )
149
-
150
- # lambda <- 1
151
- las <- glmnet(X ,y ,family = " gaussian" ,alpha = 1 ,standardize = F ,intercept = intercept )
152
- hbeta <- as.numeric(coef(las ,x = X ,y = y ,s = lambda / n ,exact = TRUE ,intercept = intercept ))
153
-
154
- # ## perform post selection inference
155
-
156
- sigma = estimateSigma(X ,y )$ sigmahat
157
-
158
- if (intercept ) return (fixedLassoInf(X ,y ,hbeta ,lambda ,family = " gaussian" ,type = " full" ,intercept = intercept ,sigma = sigma ))
159
- else return (fixedLassoInf(X ,y ,hbeta [- 1 ],lambda ,family = " gaussian" ,type = " full" ,intercept = intercept ,sigma = sigma ))
160
- }
161
-
162
- # # QQ plot of p-values for all null data now that bug fix is implemented
163
- null.pop.pval.dist <- function (n ,p ,intercept = T ,lambda = 1 ) {
164
- pvs <- c()
165
- for (i in 1 : 10 ) {
166
- a <- nullPopTest(n ,p ,intercept ,lambda )
167
- ps <- a $ pv
168
- pvs <- c(pvs ,ps ,recursive = T )
169
- }
170
- qqplot(x = runif(length(pvs )),y = pvs ,xlab = " Expected" ,ylab = " Observed" ,main = " Pop Coef. Null X" )
171
- abline(0 ,1 )
172
137
}
0 commit comments