Skip to content

Commit

Permalink
changes for new variablesList/ data reading
Browse files Browse the repository at this point in the history
  • Loading branch information
vandenman committed Jun 18, 2024
1 parent 4c25046 commit 4a1c677
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 22 deletions.
11 changes: 7 additions & 4 deletions R/networkanalysis.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,13 @@ NetworkAnalysis <- function(jaspResults, dataset, options) {
groupingVariable <- options[["groupingVariable"]]
vars2read <- c(variables, groupingVariable)
vars2read <- vars2read[vars2read != ""]
exclude <- c()
if (options[["missingValues"]] == "listwise")
exclude <- vars2read
dataset <- .readDataSetToEnd(columns.as.numeric = vars2read, exclude.na.listwise = exclude)

exclude <- if (options[["missingValues"]] == "listwise")
c(vars2read, groupingVariable)
else if (groupingVariable != "")
exclude <- groupingVariable

dataset <- .readDataSetToEnd(columns.as.numeric = variables, columns.as.factor = if (groupingVariable != "") groupingVariable else NULL, exclude.na.listwise = exclude)
# dataset <- .readDataSetToEnd(columns = vars2read, exclude.na.listwise = exclude) # jaspTools need this, JASP the line above

if (options[["groupingVariable"]] == "") { # one network
Expand Down
32 changes: 16 additions & 16 deletions inst/qml/BayesianNetworkAnalysis.qml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ Form
VariablesForm
{
AvailableVariablesList { name: "allVariablesList" }
AssignedVariablesList { name: "variables"; title: qsTr("Dependent Variables"); suggestedColumns: ["scale"]; id: networkVariables}
AssignedVariablesList { name: "groupingVariable"; title: qsTr("Split"); singleVariable: true; suggestedColumns: ["ordinal", "nominal"] }
AssignedVariablesList { name: "variables"; title: qsTr("Dependent Variables"); allowedColumns: ["scale"]; minNumericLevels: 2; id: networkVariables}
AssignedVariablesList { name: "groupingVariable"; title: qsTr("Split"); singleVariable: true; allowedColumns: ["nominal"]; minLevels: 2 }
}

DropDown
{
id: estimator
Expand All @@ -47,8 +47,8 @@ Form
{
title: qsTr("Plots")
CheckBox { name: "networkPlot"; label: qsTr("Network plot") }
CheckBox {
name: "evidencePlot";
CheckBox {
name: "evidencePlot";
label: qsTr("Edge evidence plot")
IntegerField {
name: "edgeInclusionCriteria";
Expand All @@ -61,12 +61,12 @@ Form
CheckBox { name: "edgeExclusion"; label: qsTr("Evidence for exclusion"); checked: true }
CheckBox { name: "edgeAbsence"; label: qsTr("Absence of evidence"); checked: true }
}
CheckBox {
name: "centralityPlot"; label: qsTr("Centrality plot")
CheckBox {
CheckBox {
name: "centralityPlot"; label: qsTr("Centrality plot")
CheckBox {
name: "credibilityInterval";
label: qsTr("Credibility interval 95%");
checked: false
checked: false
}
}
}
Expand All @@ -75,7 +75,7 @@ Form
{
title: qsTr("Tables")
CheckBox { name: "weightsMatrixTable"; label: qsTr("Weights matrix") }
CheckBox {
CheckBox {
name: "edgeEvidenceTable"; label: qsTr("Edge evidence probability table")
RadioButtonGroup {
name: "evidenceType";
Expand All @@ -87,14 +87,14 @@ Form
}
CheckBox { name: "centralityTable"; label: qsTr("Centrality table") }
}
Section

Section
{
title: qsTr("Sampling Options")
Layout.columnSpan: 2
IntegerField { name: "burnin"; label: qsTr("Burn in: "); value: "5000" ; min: 0; max: iter.value / 2; fieldWidth: 100; id: burnin }
IntegerField { name: "iter"; label: qsTr("Iterations: "); value: "10000" ; min: burnin.value * 2; fieldWidth: 100; id: iter }

SetSeed{}
}

Expand All @@ -103,7 +103,7 @@ Form
title: qsTr("Prior")

FormulaField { name: "gprior"; label: qsTr("Prior edge inclusion (g prior): "); value: "0.5" ; min: 0.001; max: 1; Layout.columnSpan: 2 }

DropDown
{
id: initialConfiguration
Expand Down Expand Up @@ -245,7 +245,7 @@ Form
RadioButton { value: "inNodes"; label: qsTr("In plot"); checked: true }
RadioButton { value: "inLegend"; label: qsTr("In legend") }
}

RadioButtonGroup
{
name: "legend"
Expand Down Expand Up @@ -291,7 +291,7 @@ Form
CheckBox { name: "expectedInfluence"; label: qsTr("Expected influence"); checked: true }
}
}

Section
{
title: qsTr("Network structure selection")
Expand Down
4 changes: 2 additions & 2 deletions inst/qml/NetworkAnalysis.qml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ Form
VariablesForm
{
AvailableVariablesList { name: "allVariablesList" }
AssignedVariablesList { name: "variables"; title: qsTr("Dependent Variables"); suggestedColumns: ["ordinal", "scale"]; id: networkVariables}
AssignedVariablesList { name: "groupingVariable"; title: qsTr("Split"); singleVariable: true; suggestedColumns: ["ordinal", "nominal"] }
AssignedVariablesList { name: "variables"; title: qsTr("Dependent Variables"); allowedColumns: ["scale"]; minNumericLevels: 2; id: networkVariables}
AssignedVariablesList { name: "groupingVariable"; title: qsTr("Split"); singleVariable: true; allowedColumns: ["nominal"]; minLevels: 2 }
}

DropDown
Expand Down

0 comments on commit 4a1c677

Please sign in to comment.