Skip to content

Commit

Permalink
Add mcmc options
Browse files Browse the repository at this point in the history
  • Loading branch information
koenderks committed Jan 19, 2025
1 parent cfde9fb commit 9f7194f
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 1 deletion.
5 changes: 5 additions & 0 deletions R/auditBayesianEvaluation.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
# reviewer in the pull Request.

auditBayesianEvaluation <- function(jaspResults, dataset, options, ...) {
set.seed(options[["mcmc.seed"]])
options(mc.iterations = options[["iter"]],
mc.warmup = options[["warmup"]],
mc.chains = options[["chains"]],
jfa.iterations = options[["iter"]])
# For the evaluation constituents, see auditCommonFunctions.R
.jfaEvaluationStage(options, jaspResults, workflow = FALSE)
.jfaCreatedByText(jaspResults)
Expand Down
2 changes: 1 addition & 1 deletion R/auditCommonFunctions.R
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@
"min_precision_test", "min_precision_rel_val",
"by", "prior_method", "prior_n", "prior_x", "alpha", "beta",
"critical_items", "critical_negative", "critical_action",
"stratum", "pooling", "hurdle"
"stratum", "pooling", "hurdle", "mcmc.seed", "iter", "warmup", "chains"
))

jaspResults[["evaluationContainer"]] <- container
Expand Down
61 changes: 61 additions & 0 deletions inst/qml/common/planning/Algorithm.qml
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,65 @@ Group
helpPage: "Audit/hurdle"
}
}

Section
{
title: qsTr("MCMC Options")
enabled: hurdle.checked || enable_pooling
info: qsTr("Options to customize the MCMC sampling process.")
visible: !(hide_hurdle && hide_pooling)

Group
{
IntegerField
{
id: warmup
name: "warmup"
text: qsTr("Warmup")
defaultValue: 1000
min: 100
max: iter.value
fieldWidth: 60 * preferencesModel.uiScale
Layout.leftMargin: 15 * preferencesModel.uiScale
info: qsTr("Sets the number of warmup MCMC iterations.")
}

IntegerField
{
id: iter
name: "iter"
text: qsTr("Iterations")
defaultValue: 2000
min: warmup.value
max: 10000
fieldWidth: 60 * preferencesModel.uiScale
Layout.leftMargin: 15 * preferencesModel.uiScale
info: qsTr("Sets the total number of MCMC iterations.")
}

IntegerField
{
name: "chains"
text: qsTr("Chains")
defaultValue: 4
min: 1
max: 10
fieldWidth: 60 * preferencesModel.uiScale
Layout.leftMargin: 15 * preferencesModel.uiScale
info: qsTr("Sets the number of MCMC chains.")
}

IntegerField
{
name: "mcmc.seed"
text: qsTr("Seed")
defaultValue: Math.floor(Math.random() * 1000) // Init with random integer in [1,...,999]
min: -999
max: 999
fieldWidth: 60 * preferencesModel.uiScale
Layout.leftMargin: 15 * preferencesModel.uiScale
info: qsTr("Selects the seed for the random number generator in order to reproduce results.")
}
}
}
}

0 comments on commit 9f7194f

Please sign in to comment.