From 6f595f8896b150f0ca76bdaece2796daef3484a5 Mon Sep 17 00:00:00 2001 From: bruno boutin Date: Wed, 22 Nov 2023 17:10:54 +0100 Subject: [PATCH] Update wrappers (#177) --- NAMESPACE | 2 + R/InformedBinomialTestBayesianWrapper.R | 58 ++++++++++++++++++++++ R/InformedMultinomialTestBayesianWrapper.R | 57 +++++++++++++++++++++ R/abtestbayesianWrapper.R | 2 +- R/binomialtestWrapper.R | 4 +- R/binomialtestbayesianWrapper.R | 2 +- R/contingencytablesWrapper.R | 2 +- R/contingencytablesbayesianWrapper.R | 2 +- R/multinomialtestWrapper.R | 2 +- R/multinomialtestbayesianWrapper.R | 2 +- R/regressionloglinearWrapper.R | 2 +- R/regressionloglinearbayesianWrapper.R | 2 +- 12 files changed, 127 insertions(+), 10 deletions(-) create mode 100644 R/InformedBinomialTestBayesianWrapper.R create mode 100644 R/InformedMultinomialTestBayesianWrapper.R diff --git a/NAMESPACE b/NAMESPACE index 92adbc0b..33f27187 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -19,6 +19,8 @@ export(ContingencyTablesInternal) export(ContingencyTablesBayesianInternal) export(RegressionLogLinearInternal) export(RegressionLogLinearBayesianInternal) +export(InformedMultinomialTestBayesian) +export(InformedBinomialTestBayesian) export(.bayesBinomialTest) export(.dfPointsPP) export(.dfLinesPP) diff --git a/R/InformedBinomialTestBayesianWrapper.R b/R/InformedBinomialTestBayesianWrapper.R new file mode 100644 index 00000000..c896c9c8 --- /dev/null +++ b/R/InformedBinomialTestBayesianWrapper.R @@ -0,0 +1,58 @@ +# +# Copyright (C) 2013-2022 University of Amsterdam +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +# This is a generated file. Don't change it + +InformedBinomialTestBayesian <- function( + data = NULL, + version = "0.18.2", + bayesFactorType = "BF10", + bfComparison = "encompassing", + bfVsHypothesis = "", + bridgeSamples = 1000, + descriptivesDisplay = "counts", + descriptivesPlot = FALSE, + descriptivesTable = FALSE, + factor = "", + mcmcBurnin = 500, + mcmcSamples = 5000, + models = list(list(modelName = "Model 1", syntax = "")), + plotHeight = 320, + plotWidth = 480, + posteriorPlot = FALSE, + posteriorPlotCiCoverage = 0.95, + priorCounts = list(list(levels = list(), name = "data 1", values = list()), list(levels = list(), name = "data 2", values = list())), + sampleSize = "", + seed = 1, + setSeed = FALSE, + successes = "") { + + defaultArgCalls <- formals(jaspFrequencies::InformedBinomialTestBayesian) + defaultArgs <- lapply(defaultArgCalls, eval) + options <- as.list(match.call())[-1L] + options <- lapply(options, eval) + defaults <- setdiff(names(defaultArgs), names(options)) + options[defaults] <- defaultArgs[defaults] + options[["data"]] <- NULL + options[["version"]] <- NULL + + optionsWithFormula <- c("bfVsHypothesis", "factor", "models", "priorCounts", "sampleSize", "successes") + for (name in optionsWithFormula) { + if ((name %in% optionsWithFormula) && inherits(options[[name]], "formula")) options[[name]] = jaspBase::jaspFormula(options[[name]], data) } + + return(jaspBase::runWrappedAnalysis("jaspFrequencies::InformedBinomialTestBayesian", data, options, version)) +} \ No newline at end of file diff --git a/R/InformedMultinomialTestBayesianWrapper.R b/R/InformedMultinomialTestBayesianWrapper.R new file mode 100644 index 00000000..6caba834 --- /dev/null +++ b/R/InformedMultinomialTestBayesianWrapper.R @@ -0,0 +1,57 @@ +# +# Copyright (C) 2013-2022 University of Amsterdam +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +# This is a generated file. Don't change it + +InformedMultinomialTestBayesian <- function( + data = NULL, + version = "0.18.2", + bayesFactorType = "BF10", + bfComparison = "encompassing", + bfVsHypothesis = "", + bridgeSamples = 1000, + count = "", + descriptivesDisplay = "counts", + descriptivesPlot = FALSE, + descriptivesTable = FALSE, + factor = "", + mcmcBurnin = 500, + mcmcSamples = 5000, + models = list(list(modelName = "Model 1", syntax = "")), + plotHeight = 320, + plotWidth = 480, + posteriorPlot = FALSE, + posteriorPlotCiCoverage = 0.95, + priorCounts = list(list(levels = list(), name = "data 1", values = list())), + seed = 1, + setSeed = FALSE) { + + defaultArgCalls <- formals(jaspFrequencies::InformedMultinomialTestBayesian) + defaultArgs <- lapply(defaultArgCalls, eval) + options <- as.list(match.call())[-1L] + options <- lapply(options, eval) + defaults <- setdiff(names(defaultArgs), names(options)) + options[defaults] <- defaultArgs[defaults] + options[["data"]] <- NULL + options[["version"]] <- NULL + + optionsWithFormula <- c("bfVsHypothesis", "count", "factor", "models", "priorCounts") + for (name in optionsWithFormula) { + if ((name %in% optionsWithFormula) && inherits(options[[name]], "formula")) options[[name]] = jaspBase::jaspFormula(options[[name]], data) } + + return(jaspBase::runWrappedAnalysis("jaspFrequencies::InformedMultinomialTestBayesian", data, options, version)) +} \ No newline at end of file diff --git a/R/abtestbayesianWrapper.R b/R/abtestbayesianWrapper.R index 0c5de45d..abf40e50 100644 --- a/R/abtestbayesianWrapper.R +++ b/R/abtestbayesianWrapper.R @@ -19,7 +19,7 @@ ABTestBayesian <- function( data = NULL, - version = "0.17.1", + version = "0.18.2", bayesFactorOrder = "bestModelTop", bayesFactorType = "BF10", bfRobustnessPlot = FALSE, diff --git a/R/binomialtestWrapper.R b/R/binomialtestWrapper.R index 98055964..d1e6ffab 100644 --- a/R/binomialtestWrapper.R +++ b/R/binomialtestWrapper.R @@ -19,7 +19,7 @@ BinomialTest <- function( data = NULL, - version = "0.17.1", + version = "0.18.2", formula = NULL, alternative = "twoSided", ci = FALSE, @@ -53,4 +53,4 @@ BinomialTest <- function( if ((name %in% optionsWithFormula) && inherits(options[[name]], "formula")) options[[name]] = jaspBase::jaspFormula(options[[name]], data) } return(jaspBase::runWrappedAnalysis("jaspFrequencies::BinomialTest", data, options, version)) -} +} \ No newline at end of file diff --git a/R/binomialtestbayesianWrapper.R b/R/binomialtestbayesianWrapper.R index 19ccbad4..e4916420 100644 --- a/R/binomialtestbayesianWrapper.R +++ b/R/binomialtestbayesianWrapper.R @@ -19,7 +19,7 @@ BinomialTestBayesian <- function( data = NULL, - version = "0.17.1", + version = "0.18.2", formula = NULL, alternative = "twoSided", bayesFactorType = "BF10", diff --git a/R/contingencytablesWrapper.R b/R/contingencytablesWrapper.R index f0830d6e..1b82bcea 100644 --- a/R/contingencytablesWrapper.R +++ b/R/contingencytablesWrapper.R @@ -19,7 +19,7 @@ ContingencyTables <- function( data = NULL, - version = "0.17.1", + version = "0.18.2", formula = NULL, byIntervalEta = FALSE, chiSquared = TRUE, diff --git a/R/contingencytablesbayesianWrapper.R b/R/contingencytablesbayesianWrapper.R index 022753d2..4aa991d5 100644 --- a/R/contingencytablesbayesianWrapper.R +++ b/R/contingencytablesbayesianWrapper.R @@ -19,7 +19,7 @@ ContingencyTablesBayesian <- function( data = NULL, - version = "0.17.1", + version = "0.18.2", formula = NULL, alternative = "twoSided", bayesFactorType = "BF10", diff --git a/R/multinomialtestWrapper.R b/R/multinomialtestWrapper.R index 66a0bb2c..4888d67a 100644 --- a/R/multinomialtestWrapper.R +++ b/R/multinomialtestWrapper.R @@ -19,7 +19,7 @@ MultinomialTest <- function( data = NULL, - version = "0.17.1", + version = "0.18.2", count = "", descriptivesPlot = FALSE, descriptivesPlotCiLevel = 0.95, diff --git a/R/multinomialtestbayesianWrapper.R b/R/multinomialtestbayesianWrapper.R index 9ea156c9..efdeefce 100644 --- a/R/multinomialtestbayesianWrapper.R +++ b/R/multinomialtestbayesianWrapper.R @@ -19,7 +19,7 @@ MultinomialTestBayesian <- function( data = NULL, - version = "0.17.1", + version = "0.18.2", bayesFactorType = "BF10", count = "", descriptivesPlot = FALSE, diff --git a/R/regressionloglinearWrapper.R b/R/regressionloglinearWrapper.R index e1b70c02..3535ec15 100644 --- a/R/regressionloglinearWrapper.R +++ b/R/regressionloglinearWrapper.R @@ -19,7 +19,7 @@ RegressionLogLinear <- function( data = NULL, - version = "0.17.1", + version = "0.18.2", formula = NULL, count = "", factors = list(), diff --git a/R/regressionloglinearbayesianWrapper.R b/R/regressionloglinearbayesianWrapper.R index 632502f9..5fc25e7f 100644 --- a/R/regressionloglinearbayesianWrapper.R +++ b/R/regressionloglinearbayesianWrapper.R @@ -19,7 +19,7 @@ RegressionLogLinearBayesian <- function( data = NULL, - version = "0.17.1", + version = "0.18.2", formula = NULL, bayesFactorType = "BF10", count = "",