Skip to content

Commit

Permalink
change default values and add all_evals in output of findn
Browse files Browse the repository at this point in the history
  • Loading branch information
lbau7 committed Aug 9, 2023
1 parent 86393e2 commit 1ba7b80
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion R/findn.R
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
#'
#' res_ttest <- findn(fun = ttest, targ = 0.8, k = 25, start = 100,
#' init_evals = 100, r = 4, stop = "evals", max_evals = 2000,
#' level = 0.05, var_alpha = 0.05, var_beta = 1, alpha = 0.025,
#' level = 0.05, var_alpha = 1, var_beta = 0.1, alpha = 0.025,
#' alternative = "one.sided", verbose = FALSE)
findn <- function(fun, targ, start, k = 25, init_evals = 100, r = 4,
stop = c("evals", "power_ci", "abs_unc", "rel_unc"),
Expand Down Expand Up @@ -218,6 +218,7 @@ findn <- function(fun, targ, start, k = 25, init_evals = 100, r = 4,
out <- list(
sample_size = root,
fit = fit,
all_evals = x,
targ = targ,
level = level,
exit.mes = exit.mes
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-findn.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ test_that("findn finds approximately the correct sample size", {
n_true2 <- ceiling(power.t.test(delta = 5, sd = 10, type = "one.sample",
power = 0.9)$n)

expect_equal(length(res_bll1$all_evals) * 24, 2000)
expect_equal(res_bll1$sample_size, n_true1, tol = 2)
expect_equal(res_bll2$sample_size, n_true2, tol = 2)
})
Expand Down

0 comments on commit 1ba7b80

Please sign in to comment.