Skip to content

Syntax to always include variable in enet model?  #1

Description

@jlhanson5

Hello all,

I was writing to see if there was any way to always include a variable of interest in eNetXplorer models? By that, I mean to force a penalty to be 0 all the time. My hope was to have a "control" variable in all models, but allow others to be penalized, etc.

I thought I could simply add "penalty.factor" (from glmnet) in my eNetXplorer call, something like this:
fit01 = eNetXplorer(x=data, y=mtcars$disp,family="gaussian", penalty.factor=penalty,n_run=20, n_perm_null=10, seed=111)
(Per this webpage How can I force cv.glmnet not to drop one specific variable?)

But that didn't seem to work. I keep getting this error
Error in glmnet.control(...) : unused argument (penalty.factor = c(0, 1, 1))

Here's my R sessionInfo()
R version 4.1.3 (2022-03-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Monterey 12.1

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] eNetXplorer_1.1.3

loaded via a namespace (and not attached):
[1] Rcpp_1.0.8.3 survcomp_1.44.1 compiler_4.1.3 RColorBrewer_1.1-3
[5] bitops_1.0-7 pec_2022.03.06 prettyunits_1.1.1 iterators_1.0.14
[9] tools_4.1.3 progress_1.2.2 digest_0.6.29 lifecycle_1.0.1
[13] lattice_0.20-45 pkgconfig_2.0.3 rlang_1.0.2 Matrix_1.4-0
[17] foreach_1.5.2 cli_3.2.0 parallel_4.1.3 expm_0.999-6
[21] mvtnorm_1.1-3 prodlim_2019.11.13 bootstrap_2019.6 caTools_1.18.2
[25] gtools_3.9.2 vctrs_0.4.1 SuppDists_1.1-9.7 globals_0.14.0
[29] hms_1.1.1 glmnet_4.1-4 grid_4.1.3 calibrate_1.7.7
[33] listenv_0.8.0 R6_2.5.1 timereg_2.0.2 future.apply_1.8.1
[37] parallelly_1.31.0 survival_3.2-13 lava_1.6.10 rmeta_3.0
[41] gplots_3.1.1 timeROC_0.4 survivalROC_1.0.3 codetools_0.2-18
[45] ellipsis_0.3.2 MASS_7.3-55 splines_4.1.3 future_1.24.0
[49] shape_1.4.6 numDeriv_2016.8-1.1 KernSmooth_2.23-20 crayon_1.5.1

And I should say I was trying some test data, so I just specified the penalty before the enet call with this syntax:
penalty<-c(0, rep(1, ncol(data) - 1))

Any thoughts or suggestions are much appreciated!

Thanks,
Jamie.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions