Skip to content

Commit

Permalink
rename multi to multi_ci
Browse files Browse the repository at this point in the history
  • Loading branch information
joethorley committed Jan 8, 2024
1 parent f74ca10 commit bbe1b1a
Show file tree
Hide file tree
Showing 23 changed files with 113 additions and 110 deletions.
4 changes: 2 additions & 2 deletions R/hc.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ ssd_hc.fitdists <- function(
delta = 7,
min_pboot = 0.99,
parametric = TRUE,
multi = TRUE,
multi_ci = TRUE,
weighted = TRUE,
control = NULL,
samples = FALSE,
Expand All @@ -106,7 +106,7 @@ ssd_hc.fitdists <- function(
delta = delta,
min_pboot = min_pboot,
parametric = parametric,
multi = multi,
multi = multi_ci,
fix_weights = weighted,
control = control,
samples = samples,
Expand Down
4 changes: 2 additions & 2 deletions R/hp.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ ssd_hp.fitdists <- function(
average = TRUE,
multi_est = TRUE,
delta = 7, min_pboot = 0.99,
parametric = TRUE, multi = TRUE, control = NULL,
parametric = TRUE, multi_ci = TRUE, control = NULL,
samples = FALSE,
save_to = NULL, weighted = TRUE, ...
) {
Expand All @@ -49,7 +49,7 @@ ssd_hp.fitdists <- function(
hcp <- ssd_hcp_fitdists(
x = x, value = conc, ci = ci, level = level, nboot = nboot,
average = average, multi_est = multi_est, delta = delta, min_pboot = min_pboot,
parametric = parametric, multi = multi, control = control,
parametric = parametric, multi = multi_ci, control = control,
save_to = save_to, samples = samples, hc = FALSE, fix_weights = weighted,
)
hcp <- dplyr::rename(hcp, conc = "value")
Expand Down
5 changes: 3 additions & 2 deletions R/params.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@
#' @param min_pboot A number of the minimum proportion of bootstrap samples that must successfully
#' fit in the sense of returning a likelihood.
#' @param min_pmix A number between 0 and 0.5 specifying the minimum proportion in mixture models.
#' @param multi_est A flag specifying whether to calculate model averaged estimates using the multi as opposed to the mean method.
#' @param multi A flag specifying whether to calculate estimates for all implemented distributions.
#' @param multi_ci A flag specifying whether to treat the distributions as constituting a single distribution for generating model averaged confidence intervals.
#' @param multi_est A flag specifying whether to treat the distributions as constituting a single distribution for calculating the model averaged estimates.
#' @param na.rm A flag specifying whether to silently remove missing values or
#' remove them with a warning.
#' @param n positive number of observations.
Expand All @@ -78,7 +80,6 @@
#' @param rescale A flag specifying whether to rescale concentration values by dividing by the geometric mean of the minimum and maximum positive finite values.
#' @param ribbon A flag indicating whether to plot the confidence interval as a grey ribbon as opposed to green solid lines.
#' @param right A string of the column in data with the right concentration values.
#' @param multi A flag specifying whether to treat the distributions as constituting a single distribution.
#' @param save_to A string specifying a directory to save the bootstrap datasets and parameter estimates to or NULL.
#' @param samples A flag specfying whether to include the bootstrap samples in the output.
#' @param scale scale parameter.
Expand Down
4 changes: 2 additions & 2 deletions R/plot-cdf.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ ssd_plot_cdf <- function(x, ...) {
#' @examples
#' fits <- ssd_fit_dists(ssddata::ccme_boron)
#' ssd_plot_cdf(fits)
ssd_plot_cdf.fitdists <- function(x, average = FALSE, delta = 7, multi = TRUE, ...) {
pred <- ssd_hc(x, percent = 1:99, average = average, delta = delta, multi = multi)
ssd_plot_cdf.fitdists <- function(x, average = FALSE, delta = 7, multi_ci = TRUE, ...) {
pred <- ssd_hc(x, percent = 1:99, average = average, delta = delta, multi_ci = multi_ci)
data <- ssd_data(x)
cols <- .cols_fitdists(x)

Expand Down
4 changes: 2 additions & 2 deletions R/predict.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ predict.fitdists <- function(object, percent = 1:99, ci = FALSE,
average = TRUE, delta = 7,
min_pboot = 0.99,
parametric = TRUE,
multi = TRUE,
multi_ci = TRUE,
weighted = TRUE,
control = NULL,
...) {
Expand All @@ -42,7 +42,7 @@ predict.fitdists <- function(object, percent = 1:99, ci = FALSE,
percent = percent, ci = ci, level = level,
nboot = nboot, min_pboot = min_pboot,
average = average, delta = delta, parametric = parametric,
multi = multi, weighted = weighted, control = control
multi_ci = multi_ci, weighted = weighted, control = control
)
}

Expand Down
2 changes: 1 addition & 1 deletion man/estimates.fitdists.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions man/params.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/predict.fitdists.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/ssd_hc.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/ssd_hp.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/ssd_plot_cdf.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions tests/testthat/test-burrIII3.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ test_that("burrIII3 gives cis with ccme_chloride", {
fit <- ssd_fit_dists(ssddata::ccme_chloride, dists = "burrIII3")
expect_s3_class(fit, "fitdists")
set.seed(99)
hc <- ssd_hc(fit, nboot = 10, ci = TRUE, multi = FALSE, samples = TRUE, weighted = FALSE)
hc <- ssd_hc(fit, nboot = 10, ci = TRUE, multi_ci = FALSE, samples = TRUE, weighted = FALSE)
expect_snapshot_data(hc, "hc_chloride")
})

test_that("burrIII3 gives cis with ccme_uranium", {
fit <- ssd_fit_dists(ssddata::ccme_uranium, dists = "burrIII3")
expect_s3_class(fit, "fitdists")
set.seed(99)
hc <- ssd_hc(fit, nboot = 10, ci = TRUE, multi = FALSE, samples = TRUE, weighted = FALSE)
hc <- ssd_hc(fit, nboot = 10, ci = TRUE, multi_ci = FALSE, samples = TRUE, weighted = FALSE)
expect_snapshot_data(hc, "hc_uranium")
})

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-gompertz.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ test_that("bootstrap gompertz with problem data", {
data <- data.frame(Conc = ssd_rgompertz(6, location = 0.6, shape = 0.07))
fit <- ssdtools::ssd_fit_dists(data, dists = "gompertz")
set.seed(99)
hc <- ssd_hc(fit, ci = TRUE, nboot = 100, min_pboot = 0.8, multi = FALSE,
hc <- ssd_hc(fit, ci = TRUE, nboot = 100, min_pboot = 0.8, multi_ci = FALSE,
samples = TRUE, weighted = FALSE)
expect_snapshot_data(hc, "hc_prob")
})
24 changes: 12 additions & 12 deletions tests/testthat/test-hc-root.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
test_that("hc multi lnorm", {
fits <- ssd_fit_dists(ssddata::ccme_boron, dists = "lnorm")
set.seed(102)
hc_dist <- ssd_hc(fits, average = FALSE, multi = FALSE, weighted = FALSE)
hc_average <- ssd_hc(fits, average = TRUE, multi = FALSE, weighted = FALSE)
hc_multi <- ssd_hc(fits, average = TRUE, multi = TRUE)
hc_dist <- ssd_hc(fits, average = FALSE, multi_ci = FALSE, weighted = FALSE)
hc_average <- ssd_hc(fits, average = TRUE, multi_ci = FALSE, weighted = FALSE)
hc_multi <- ssd_hc(fits, average = TRUE, multi_ci = TRUE)
expect_identical(hc_dist$est, hc_average$est)
expect_equal(hc_multi, hc_average)

Expand All @@ -30,8 +30,8 @@ test_that("hc multi lnorm", {
test_that("hc multi all", {
fits <- ssd_fit_dists(ssddata::ccme_boron)
set.seed(102)
hc_average <- ssd_hc(fits, average = TRUE, multi = FALSE)
hc_multi <- ssd_hc(fits, average = TRUE, multi = TRUE)
hc_average <- ssd_hc(fits, average = TRUE, multi_ci = FALSE)
hc_multi <- ssd_hc(fits, average = TRUE, multi_ci = TRUE)
expect_equal(hc_average$est, 1.24151700389853)
expect_equal(hc_multi$est, 1.25677449265554)
testthat::expect_snapshot({
Expand All @@ -42,8 +42,8 @@ test_that("hc multi all", {
test_that("hc multi all multiple hcs", {
fits <- ssd_fit_dists(ssddata::ccme_boron)
set.seed(102)
hc_average <- ssd_hc(fits, percent = c(5,10), average = TRUE, multi = FALSE, weighted = FALSE)
hc_multi <- ssd_hc(fits, percent = c(5,10), average = TRUE, multi = TRUE)
hc_average <- ssd_hc(fits, percent = c(5,10), average = TRUE, multi_ci = FALSE, weighted = FALSE)
hc_multi <- ssd_hc(fits, percent = c(5,10), average = TRUE, multi_ci = TRUE)
expect_equal(hc_average$est, c(1.24151700389853, 2.37337471483992))
expect_equal(hc_multi$est, c(1.25677449265554, 2.38164905743083))
testthat::expect_snapshot({
Expand All @@ -54,9 +54,9 @@ test_that("hc multi all multiple hcs", {
test_that("hc multi all multiple hcs cis", {
fits <- ssd_fit_dists(ssddata::ccme_boron)
set.seed(102)
hc_average <- ssd_hc(fits, percent = c(5,10), average = TRUE, multi = FALSE, nboot = 10, ci = TRUE, weighted = FALSE)
hc_average <- ssd_hc(fits, percent = c(5,10), average = TRUE, multi_ci = FALSE, nboot = 10, ci = TRUE, weighted = FALSE)
set.seed(105)
hc_multi <- ssd_hc(fits, percent = c(5,10), average = TRUE, multi = TRUE, nboot = 10, ci = TRUE)
hc_multi <- ssd_hc(fits, percent = c(5,10), average = TRUE, multi_ci = TRUE, nboot = 10, ci = TRUE)
expect_equal(hc_average$est, c(1.24151700389853, 2.37337471483992))
expect_equal(hc_multi$est, c(1.25677449265554, 2.38164905743083))
testthat::expect_snapshot({
Expand All @@ -67,11 +67,11 @@ test_that("hc multi all multiple hcs cis", {
test_that("hc multi lnorm ci", {
fits <- ssd_fit_dists(ssddata::ccme_boron, dists = "lnorm")
set.seed(102)
hc_dist <- ssd_hc(fits, average = FALSE, ci = TRUE, nboot = 100, multi = FALSE, weighted = FALSE)
hc_dist <- ssd_hc(fits, average = FALSE, ci = TRUE, nboot = 100, multi_ci = FALSE, weighted = FALSE)
set.seed(102)
hc_average <- ssd_hc(fits, average = TRUE, ci = TRUE, nboot = 100, multi = FALSE, weighted = FALSE)
hc_average <- ssd_hc(fits, average = TRUE, ci = TRUE, nboot = 100, multi_ci = FALSE, weighted = FALSE)
set.seed(102)
hc_multi <- ssd_hc(fits, average = TRUE, multi = TRUE, ci = TRUE, nboot = 100)
hc_multi <- ssd_hc(fits, average = TRUE, multi_ci = TRUE, ci = TRUE, nboot = 100)

testthat::expect_snapshot({
hc_average
Expand Down
Loading

0 comments on commit bbe1b1a

Please sign in to comment.