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

easybgm in jasp #124

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Conversation

sekulovskin
Copy link

Implemented the easybgm package in JASP, which now works in place of BDgraph and can handle: ggms and gcgms (using BDgraph in the background) as well as the omrf (using bgms in the background).

There are also some other cosmetic changes like added footnotes and prior options.

For now, I only allow the software to compute credible intervals for the centrality measures when model == omrf.

The B-C model is not included yet, I will probably do that next week.

@sekulovskin sekulovskin marked this pull request as draft November 12, 2024 10:56
@sekulovskin sekulovskin marked this pull request as ready for review November 12, 2024 10:58
@sekulovskin sekulovskin marked this pull request as draft November 12, 2024 10:59
@sekulovskin sekulovskin marked this pull request as ready for review November 12, 2024 11:01
@EJWagenmakers
Copy link

hurray, well done!

Copy link
Contributor

@vandenman vandenman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really good! I left some feedback below, just re-request a review once it's ready again.

inst/qml/BayesianNetworkAnalysis.qml Outdated Show resolved Hide resolved
inst/qml/BayesianNetworkAnalysis.qml Show resolved Hide resolved
export(BayesianNetworkAnalysis)
export(NetworkAnalysis)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did roxygen2 do this automatically? if yes all good, otherwise please revert the change.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was changed automatically.

R/bayesiannetworkanalysis.R Outdated Show resolved Hide resolved
R/bayesiannetworkanalysis.R Outdated Show resolved Hide resolved
Comment on lines 214 to 223
easybgmFit <- try(easybgm::easybgm(data = as.data.frame(apply(dataset[[nw]], 2, as.numeric)),
type = "continuous",
package = "BDgraph" ,
iter = as.numeric(options[["iter"]]),
save = TRUE,
centrality = FALSE,
burnin = as.numeric(options[["burnin"]]),
g.start = options[["initialConfiguration"]],
df.prior = as.numeric(options[["dfprior"]]),
g.prior = as.numeric(options[["gprior"]])))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
easybgmFit <- try(easybgm::easybgm(data = as.data.frame(apply(dataset[[nw]], 2, as.numeric)),
type = "continuous",
package = "BDgraph" ,
iter = as.numeric(options[["iter"]]),
save = TRUE,
centrality = FALSE,
burnin = as.numeric(options[["burnin"]]),
g.start = options[["initialConfiguration"]],
df.prior = as.numeric(options[["dfprior"]]),
g.prior = as.numeric(options[["gprior"]])))
easybgmFit <- try(easybgm::easybgm(data = dataset[[nw]],
type = "continuous",
package = "BDgraph" ,
iter = options[["iter"]],
save = TRUE,
centrality = FALSE,
burnin = options[["burnin"]],
g.start = options[["initialConfiguration"]],
df.prior = options[["dfprior"]],
g.prior = options[["gprior"]]))

so in principle, the data should already be in the right format at this point (e.g., a data.frame with only numeric values). In addition, the values from the options should also be actual values already. So the removed lines should be redundant. If these lines are somehow not redundant, then this should probably be fixed when reading the data.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed most of the arguments. Except for transforming the variables to numeric when model == "ggm" || "gcgm". This is because if you pass non-numeric variables to easybgm when using BDgraph, an error occurs internally in the get_S_n_p function. I did not want to alter the .networkAnalysisReadData function, which is used for all network analyses. However, I am open to suggestions if you think this needs to be handled differently.

R/bayesiannetworkanalysis.R Outdated Show resolved Hide resolved
R/bayesiannetworkanalysis.R Outdated Show resolved Hide resolved
…orkAnalysisNetworkPlot function to handle estimator/model based on the selected method; (2) corrected the silly loop when estimating the omrf; (3) deleted somestimating the omrf; (3) deleted some redundant comments; (4) changed the footnote under the table. Round 2 with the rest of the changes will follow soon.
@boutinb
Copy link
Contributor

boutinb commented Nov 15, 2024

Should be this in 0.19.2, or can it wait until the release afterwards?

…, adjusted the arguments in functions, and some other small fixes.
Merge branch 'master' into easybgminJASP

# Conflicts:
#	R/bayesiannetworkanalysis.R
#	inst/qml/BayesianNetworkAnalysis.qml
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

Successfully merging this pull request may close these issues.

4 participants