Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variable selection with M > 100 fails #9

Open
lang-benjamin opened this issue Jul 29, 2024 · 0 comments
Open

Variable selection with M > 100 fails #9

lang-benjamin opened this issue Jul 29, 2024 · 0 comments

Comments

@lang-benjamin
Copy link

lang-benjamin commented Jul 29, 2024

The variable selection algorithm does not work in case of M > 100 knockoff generations.

I am using the current development version of knockofftools.

options(clustermq.scheduler = "slurm")
library(clustermq)
#> * Worker disconnect monitor is disabled
#> --- see: https://mschubert.github.io/clustermq/articles/userguide.html#installation
if (!require(knockofftools)) 
  devtools::install_github("Novartis/knockofftools@26010240dac32809570e537829172f4544928499")
#> Loading required package: knockofftools

# Simulate some data (example from predictive variables vignette)
X <- generate_X(n=500, p=10, p_b=0, cov_type="cov_diag", rho=0.2)
lp <- generate_lp(X, p_nn = 5, a=1)
trt = sample(c(1,0), nrow(X), replace=TRUE)
lp.pred = lp + 1*trt*( as.integer(X[,6]>0) + as.integer(X[,7]>0))
y <- lp.pred + rnorm(nrow(X))

# Create knockoffs and apply variable selection algorithm
W <- knockoff.statistics(y=y, X=X, type="regression", statistic = "stat_predictive_causal_forest", trt=trt, M=101)
#> Submitting 101 worker jobs (ID: cmq6451) ...
#> Running 101 calculations (6 objs/70.2 Kb common; 1 calls/chunk) ...
#> Master: [8.7 secs 1.3% CPU]; Worker: [avg 93.9% CPU, max 360.9 Mb]
S = variable.selections(W, level = 1, error.type="pfer") # Does not work (the problem seems to be the find_ratio() function which does not return anything)
#> Warning in rbinom(1, 1, v0 - floor(v0)): NAs produced
#> Error in if (v > 0) {: argument is of length zero

# sessionInfo()
sessionInfo()
#> R version 4.3.2 (2023-10-31)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Ubuntu 22.04.1 LTS
#> 
#> Matrix products: default
#> BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 
#> LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so;  LAPACK version 3.10.0
#> 
#> locale:
#>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
#>  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
#>  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
#>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
#> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
#> 
#> time zone: Europe/Dublin
#> tzcode source: system (glibc)
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] knockofftools_1.0.0 clustermq_0.9.4    
#> 
#> loaded via a namespace (and not attached):
#>  [1] crayon_1.5.3      vctrs_0.6.5       cli_3.6.3         knitr_1.48       
#>  [5] rlang_1.1.4       xfun_0.46         generics_0.1.3    glue_1.7.0       
#>  [9] prettyunits_1.2.0 htmltools_0.5.8.1 hms_1.1.3         fansi_1.0.6      
#> [13] rmarkdown_2.27    evaluate_0.24.0   tibble_3.2.1      fastmap_1.2.0    
#> [17] progress_1.2.3    yaml_2.3.9        lifecycle_1.0.4   compiler_4.3.2   
#> [21] dplyr_1.1.4       codetools_0.2-19  fs_1.6.4          pkgconfig_2.0.3  
#> [25] Rcpp_1.0.13       rstudioapi_0.16.0 digest_0.6.36     R6_2.5.1         
#> [29] tidyselect_1.2.1  reprex_2.1.0      utf8_1.2.4        pillar_1.9.0     
#> [33] magrittr_2.0.3    tools_4.3.2       withr_3.0.0

Created on 2024-07-29 with reprex v2.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant