Skip to content

Commit

Permalink
added more prior options and fixed the issue with not reading in some…
Browse files Browse the repository at this point in the history
… of the prior options properly.
  • Loading branch information
sekulovskin committed Nov 7, 2024
1 parent f72b9ae commit 46133a3
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 6 deletions.
11 changes: 9 additions & 2 deletions R/bayesiannetworkanalysis.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ BayesianNetworkAnalysis <- function(jaspResults, dataset, options) {
mainContainer <- jaspResults[["mainContainer"]]
if (is.null(mainContainer)) {
mainContainer <- createJaspContainer(dependencies = c("variables", "groupingVariable", "model",
"burnin", "iter", "gprior", "dfprior"))
"burnin", "iter", "gprior", "dfprior", "initialConfiguration",
"edgePrior", "interactionScale", "beta_alpha", "beta_beta",
"dirichlet_alpha", "threshold_alpha", "threshold_beta"))
jaspResults[["mainContainer"]] <- mainContainer
}
.bayesianNetworkAnalysisMainTableMeta(mainContainer, dataset, options)
Expand Down Expand Up @@ -303,7 +305,12 @@ BayesianNetworkAnalysis <- function(jaspResults, dataset, options) {
burnin = as.numeric(options[["burnin"]]),
inclusion_probability = as.numeric(options[["gprior"]]),
interaction_scale = as.numeric(options[["interactionScale"]]),
edge_prior = as.character(options[["edgePrior"]])))
edge_prior = as.character(options[["edgePrior"]]),
threshold_alpha = as.numeric(options[["threshold_alpha"]]),
threshold_beta = as.numeric(options[["threshold_beta"]]),
beta_bernoulli_alpha = as.numeric(options[["beta_alpha"]]),
beta_bernoulli_beta = as.numeric(options[["beta_beta"]]),
dirichlet_alpha = as.numeric(options[["dirichlet_alpha"]])))

}
}
Expand Down
72 changes: 68 additions & 4 deletions inst/qml/BayesianNetworkAnalysis.qml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Section {
anchors.fill: parent

Group {
title: qsTr("Network/Edge Priors")
title: qsTr("Network Structure (Edge) Priors")
Layout.fillWidth: true

Column {
Expand Down Expand Up @@ -138,6 +138,33 @@ Section {
]
}

FormulaField {
name: "beta_alpha"
label: qsTr("Shape parameter 1:")
value: "1"
min: 0.001
Layout.fillWidth: true
preferredWidth: 300
}

FormulaField {
name: "beta_beta"
label: qsTr("Shape parameter 2:")
value: "1"
min: 0.001
Layout.fillWidth: true
preferredWidth: 300
}

FormulaField {
name: "dirichlet_alpha"
label: qsTr("Concentration parameter:")
value: "1"
min: 0.001
Layout.fillWidth: true
preferredWidth: 300
}

DropDown {
id: initialConfiguration
name: "initialConfiguration"
Expand All @@ -149,11 +176,30 @@ Section {
{ value: "full", label: "full" }
]
}


FormulaField {
name: "beta_bernoulli_alpha"
label: qsTr("Shape parameter 1:")
value: "1"
min: 0.001
Layout.fillWidth: true
preferredWidth: 300
}

FormulaField {
name: "beta_bernoulli_beta"
label: qsTr("Shape parameter 2:")
value: "1"
min: 0.001
Layout.fillWidth: true
preferredWidth: 300
}
}
}

Group {
title: qsTr("Edge Weight Priors")
title: qsTr("Parameter Priors")
Layout.fillWidth: true

Column {
Expand All @@ -171,10 +217,28 @@ Section {

FormulaField {
name: "interactionScale"
label: qsTr("Scale of the Cauchy distribution (for omrf):")
label: qsTr("Scale of the Cauchy distribution for the edge weights (for omrf):")
value: "2.5"
min: 0.1
max: 10
Layout.fillWidth: true
preferredWidth: 300
}


FormulaField {
name: "threshold_alpha"
label: qsTr("Threshold Shape parameter 1:")
value: "1"
min: 0.001
Layout.fillWidth: true
preferredWidth: 300
}

FormulaField {
name: "threshold_beta"
label: qsTr("Threshold shape parameter 2:")
value: "1"
min: 0.001
Layout.fillWidth: true
preferredWidth: 300
}
Expand Down

0 comments on commit 46133a3

Please sign in to comment.