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

"undefined columns selected" when using function "condPlot" and "intsPlot" #1

Open
wsj1998 opened this issue Oct 18, 2023 · 0 comments

Comments

@wsj1998
Copy link

wsj1998 commented Oct 18, 2023

Hello, Dr. Swanson
Thank you for making the 'modnets' package, it's a very useful network analysis tool. However, I've encountered some occasional issues with the 'condPlot' and 'intsPlot' functions.
I'm trying to assess the impact of family support (FS) on the relationship between depression (CES-D) and anxiety (SAS) among patients. My code looks like this:

vars_patient2 <- varSelect(data_patient2,
                          m = "FS",
                          criterion = "bic",
                          method = "glinternet")

mnet_patient2 <- fitNetwork(data_patient2,
                           moderators = "FS",
                           type = vars_patient2,
                           rule = "OR")

condPlot(mnet_patient2, to = "CESD19", from = "SAS2")

In the interaction matrix, the coefficient of SAS2*FS on CESD19 is not zero. However, I'm encountering this error:

Error in `[.data.frame`(mods[[1]]$model, modname): undefined columns selected

I also run traceback, which shows this:

5: stop("undefined columns selected")
4: `[.data.frame`(mods[[1]]$model, modname)
3: mods[[1]]$model[modname]
2: margCIs(mods = mods, alpha = alpha, nsims = nsims, compare = compare)
1: condPlot(out = mnet_patient2, to = "CESD19", from = "SAS2")

The bug in question appears inconsistently, sometimes it occurs, and sometimes it doesn't. In the code I provided, when I remove the variable selection step, the bug disappears. I'm truly perplexed by this. I would greatly appreciate it if you could help me resolve this issue.

Thank you

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