Skip to content

Commit

Permalink
Implement hurdle model in Bayes eval
Browse files Browse the repository at this point in the history
  • Loading branch information
koenderks committed Jan 13, 2025
1 parent 11d7975 commit 77fd241
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
8 changes: 7 additions & 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"
"stratum", "pooling", "hurdle"
))

jaspResults[["evaluationContainer"]] <- container
Expand Down Expand Up @@ -2704,6 +2704,9 @@
if (options[["method"]] == "stringer.binomial" && options[["lta"]]) {
method <- "stringer.lta"
}
if (options[["bayesian"]] && options[["hurdle"]] && options[["method"]] == "binomial") {
method <- "hurdle.beta"
}

if (options[["separateMisstatement"]] && options[["values"]] != "" && options[["values.audit"]] != "") {
result <- .jfaSeparatedMisstatementEvaluationState(options, sample, prior, planningOptions, evaluationContainer)
Expand Down Expand Up @@ -2807,6 +2810,9 @@
"poisson" = gettext("The results are computed using the gamma distribution."),
"hypergeometric" = gettext("The results are computed using the beta-binomial distribution.")
)
if (options[["hurdle"]] && options[["method"]] == "binomial") {
message <- gettext("The results are computed using the hurdle beta model")
}
}

# Custom message for stringer bound with LTA
Expand Down
2 changes: 2 additions & 0 deletions inst/qml/auditBayesianEvaluation.qml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ Form
enable: !data.use_stats
enable_pooling: variables.use_strata
enable_partial: !variables.use_strata && variables.use_id && variables.use_book && variables.use_real && ((population.n_items > 0 && population.n_units > 0) || data.use_population) && likelihood.use_binomial
hide_hurdle: false
enable_hurdle: !algorithm.use_partial && !variables.use_strata && variables.use_id && variables.use_book && variables.use_real && likelihood.use_binomial
}
Evaluation.IntervalType { bayesian: true; test: objectives.use_materiality }
}
Expand Down
25 changes: 25 additions & 0 deletions inst/qml/common/planning/Algorithm.qml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@ Group
{
readonly property bool use_pooling: pooling.checked
readonly property bool use_partial: partial.checked
readonly property bool use_hurdle: hurdle.checked
property bool enable: true
property bool hide_pooling: true
property bool hide_hurdle: true
property bool enable_pooling: true
property bool enable_partial: true
property bool enable_hurdle: true

title: qsTr("Algorithm")
enabled: enable
Expand Down Expand Up @@ -75,4 +78,26 @@ Group
helpPage: "Audit/pooling"
}
}

Row
{
spacing: 5 * preferencesModel.uiScale
enabled: enable_hurdle
visible: !hide_hurdle

CheckBox
{
id: hurdle
text: qsTr("Hurdle model")
name: "hurdle"
enabled: !partial.checked
info: qsTr("This algoritm enables you to consider the individal taints.")
}

HelpButton
{
toolTip: qsTr("Click to learn more about this algorithm")
helpPage: "Audit/hurdle"
}
}
}

0 comments on commit 77fd241

Please sign in to comment.