Skip to content

Commit

Permalink
Update wrappers (#203)
Browse files Browse the repository at this point in the history
  • Loading branch information
boutinb authored May 23, 2024
1 parent c0f6821 commit 651db0b
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 29 deletions.
14 changes: 10 additions & 4 deletions R/InformedBinomialTestBayesianWrapper.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,17 @@

InformedBinomialTestBayesian <- function(
data = NULL,
version = "0.18.2",
version = "0.19",
bayesFactorType = "BF10",
bfComparison = "encompassing",
bfVsHypothesis = "",
bfVsHypothesis = "Model 1",
bridgeSamples = 1000,
descriptivesDisplay = "counts",
descriptivesPlot = FALSE,
descriptivesTable = FALSE,
factor = "",
includeEncompassingModel = TRUE,
includeNullModel = TRUE,
mcmcBurnin = 500,
mcmcSamples = 5000,
models = list(list(modelName = "Model 1", syntax = "")),
Expand All @@ -36,8 +38,12 @@ InformedBinomialTestBayesian <- function(
posteriorPlot = FALSE,
posteriorPlotCiCoverage = 0.95,
priorCounts = list(list(levels = list(), name = "data 1", values = list()), list(levels = list(), name = "data 2", values = list())),
priorModelProbability = list(list(levels = list("Model 1", "Encompassing", "Null"), name = "data 1", values = list(1, 1, 1))),
sampleSize = "",
seed = 1,
sequentialAnalysisNumberOfSteps = 10,
sequentialAnalysisPlot = FALSE,
sequentialAnalysisPlotType = "bayesFactor",
setSeed = FALSE,
successes = "") {

Expand All @@ -50,9 +56,9 @@ InformedBinomialTestBayesian <- function(
options[["data"]] <- NULL
options[["version"]] <- NULL

optionsWithFormula <- c("bfVsHypothesis", "factor", "models", "priorCounts", "sampleSize", "successes")
optionsWithFormula <- c("bfVsHypothesis", "factor", "models", "priorCounts", "priorModelProbability", "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))
}
}
20 changes: 13 additions & 7 deletions R/InformedMultinomialTestBayesianWrapper.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,31 @@

InformedMultinomialTestBayesian <- function(
data = NULL,
version = "0.18.2",
version = "0.19",
bayesFactorType = "BF10",
bfComparison = "encompassing",
bfVsHypothesis = "",
bridgeSamples = 1000,
bfComparison = "null",
bfVsHypothesis = "Model 1",
bridgeSamples = 10000,
count = "",
descriptivesDisplay = "counts",
descriptivesPlot = FALSE,
descriptivesTable = FALSE,
factor = "",
includeEncompassingModel = TRUE,
includeNullModel = TRUE,
mcmcBurnin = 500,
mcmcSamples = 5000,
mcmcSamples = 10000,
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())),
priorModelProbability = list(list(levels = list("Null", "Encompassing", "Model 1"), name = "data 1", values = list("1", "1", "1"))),
seed = 1,
sequentialAnalysisNumberOfSteps = 10,
sequentialAnalysisPlot = FALSE,
sequentialAnalysisPlotType = "bayesFactor",
setSeed = FALSE) {

defaultArgCalls <- formals(jaspFrequencies::InformedMultinomialTestBayesian)
Expand All @@ -49,9 +55,9 @@ InformedMultinomialTestBayesian <- function(
options[["data"]] <- NULL
options[["version"]] <- NULL

optionsWithFormula <- c("bfVsHypothesis", "count", "factor", "models", "priorCounts")
optionsWithFormula <- c("bfVsHypothesis", "count", "factor", "models", "priorCounts", "priorModelProbability")
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))
}
}
4 changes: 2 additions & 2 deletions R/abtestbayesianWrapper.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

ABTestBayesian <- function(
data = NULL,
version = "0.18.2",
version = "0.19",
bayesFactorOrder = "bestModelTop",
bayesFactorType = "BF10",
bfRobustnessPlot = FALSE,
Expand Down Expand Up @@ -66,4 +66,4 @@ ABTestBayesian <- function(
if ((name %in% optionsWithFormula) && inherits(options[[name]], "formula")) options[[name]] = jaspBase::jaspFormula(options[[name]], data) }

return(jaspBase::runWrappedAnalysis("jaspFrequencies::ABTestBayesian", data, options, version))
}
}
4 changes: 2 additions & 2 deletions R/binomialtestWrapper.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

BinomialTest <- function(
data = NULL,
version = "0.18.2",
version = "0.19",
formula = NULL,
alternative = "twoSided",
ci = FALSE,
Expand Down Expand Up @@ -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))
}
}
4 changes: 2 additions & 2 deletions R/binomialtestbayesianWrapper.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

BinomialTestBayesian <- function(
data = NULL,
version = "0.18.2",
version = "0.19",
formula = NULL,
alternative = "twoSided",
bayesFactorType = "BF10",
Expand Down Expand Up @@ -56,4 +56,4 @@ BinomialTestBayesian <- function(
if ((name %in% optionsWithFormula) && inherits(options[[name]], "formula")) options[[name]] = jaspBase::jaspFormula(options[[name]], data) }

return(jaspBase::runWrappedAnalysis("jaspFrequencies::BinomialTestBayesian", data, options, version))
}
}
4 changes: 2 additions & 2 deletions R/contingencytablesWrapper.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

ContingencyTables <- function(
data = NULL,
version = "0.18.2",
version = "0.19",
formula = NULL,
byIntervalEta = FALSE,
chiSquared = TRUE,
Expand Down Expand Up @@ -81,4 +81,4 @@ ContingencyTables <- function(
if ((name %in% optionsWithFormula) && inherits(options[[name]], "formula")) options[[name]] = jaspBase::jaspFormula(options[[name]], data) }

return(jaspBase::runWrappedAnalysis("jaspFrequencies::ContingencyTables", data, options, version))
}
}
4 changes: 2 additions & 2 deletions R/contingencytablesbayesianWrapper.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

ContingencyTablesBayesian <- function(
data = NULL,
version = "0.18.2",
version = "0.19",
formula = NULL,
alternative = "twoSided",
bayesFactorType = "BF10",
Expand Down Expand Up @@ -71,4 +71,4 @@ ContingencyTablesBayesian <- function(
if ((name %in% optionsWithFormula) && inherits(options[[name]], "formula")) options[[name]] = jaspBase::jaspFormula(options[[name]], data) }

return(jaspBase::runWrappedAnalysis("jaspFrequencies::ContingencyTablesBayesian", data, options, version))
}
}
4 changes: 2 additions & 2 deletions R/multinomialtestWrapper.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

MultinomialTest <- function(
data = NULL,
version = "0.18.2",
version = "0.19",
count = "",
descriptivesPlot = FALSE,
descriptivesPlotCiLevel = 0.95,
Expand Down Expand Up @@ -49,4 +49,4 @@ MultinomialTest <- function(
if ((name %in% optionsWithFormula) && inherits(options[[name]], "formula")) options[[name]] = jaspBase::jaspFormula(options[[name]], data) }

return(jaspBase::runWrappedAnalysis("jaspFrequencies::MultinomialTest", data, options, version))
}
}
4 changes: 2 additions & 2 deletions R/multinomialtestbayesianWrapper.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

MultinomialTestBayesian <- function(
data = NULL,
version = "0.18.2",
version = "0.19",
bayesFactorType = "BF10",
count = "",
descriptivesPlot = FALSE,
Expand Down Expand Up @@ -50,4 +50,4 @@ MultinomialTestBayesian <- function(
if ((name %in% optionsWithFormula) && inherits(options[[name]], "formula")) options[[name]] = jaspBase::jaspFormula(options[[name]], data) }

return(jaspBase::runWrappedAnalysis("jaspFrequencies::MultinomialTestBayesian", data, options, version))
}
}
4 changes: 2 additions & 2 deletions R/regressionloglinearWrapper.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

RegressionLogLinear <- function(
data = NULL,
version = "0.18.2",
version = "0.19",
formula = NULL,
count = "",
factors = list(),
Expand Down Expand Up @@ -52,4 +52,4 @@ RegressionLogLinear <- function(
if ((name %in% optionsWithFormula) && inherits(options[[name]], "formula")) options[[name]] = jaspBase::jaspFormula(options[[name]], data) }

return(jaspBase::runWrappedAnalysis("jaspFrequencies::RegressionLogLinear", data, options, version))
}
}
4 changes: 2 additions & 2 deletions R/regressionloglinearbayesianWrapper.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

RegressionLogLinearBayesian <- function(
data = NULL,
version = "0.18.2",
version = "0.19",
formula = NULL,
bayesFactorType = "BF10",
count = "",
Expand Down Expand Up @@ -64,4 +64,4 @@ RegressionLogLinearBayesian <- function(
if ((name %in% optionsWithFormula) && inherits(options[[name]], "formula")) options[[name]] = jaspBase::jaspFormula(options[[name]], data) }

return(jaspBase::runWrappedAnalysis("jaspFrequencies::RegressionLogLinearBayesian", data, options, version))
}
}

0 comments on commit 651db0b

Please sign in to comment.