diff --git a/main/coverage-report/index.html b/main/coverage-report/index.html index 38f8ba32..948292eb 100644 --- a/main/coverage-report/index.html +++ b/main/coverage-report/index.html @@ -107,8 +107,8 @@

cardx coverage - 97.91%

-
- +
+
@@ -18117,7 +18117,7 @@

cardx coverage - 97.91%

32 - 23x + 28x
  set_cli_abort_call()
@@ -18138,42 +18138,42 @@

cardx coverage - 97.91%

35 - 23x + 28x
  check_not_missing(x)
36 - 23x + 28x
  check_binary(x)
37 - 23x + 28x
  check_range(conf.level, range = c(0, 1), include_bounds = c(FALSE, FALSE))
38 - 23x + 28x
  check_scalar(conf.level)
39 - 23x + 28x
  check_class(x = correct, "logical")
40 - 23x + 28x
  check_scalar(correct)
@@ -18187,7 +18187,7 @@

cardx coverage - 97.91%

42 - 23x + 28x
  x <- stats::na.omit(x)
@@ -18201,35 +18201,35 @@

cardx coverage - 97.91%

44 - 23x + 28x
  n <- length(x)
45 - 23x + 28x
  p_hat <- mean(x)
46 - 23x + 28x
  z <- stats::qnorm((1 + conf.level) / 2)
47 - 23x + 28x
  q_hat <- 1 - p_hat
48 - 23x + 28x
  correction_factor <- ifelse(correct, 1 / (2 * n), 0)
@@ -18243,21 +18243,21 @@

cardx coverage - 97.91%

50 - 23x + 28x
  err <- z * sqrt(p_hat * q_hat) / sqrt(n) + correction_factor
51 - 23x + 28x
  l_ci <- max(0, p_hat - err)
52 - 23x + 28x
  u_ci <- min(1, p_hat + err)
@@ -18271,56 +18271,56 @@

cardx coverage - 97.91%

54 - 23x + 28x
  list(
55 - 23x + 28x
    N = n,
56 - 23x + 28x
    estimate = p_hat,
57 - 23x + 28x
    conf.low = l_ci,
58 - 23x + 28x
    conf.high = u_ci,
59 - 23x + 28x
    conf.level = conf.level,
60 - 23x + 28x
    method =
61 - 23x + 28x
      glue::glue("Wald Confidence Interval {ifelse(correct, 'with', 'without')} continuity correction")
@@ -18418,7 +18418,7 @@

cardx coverage - 97.91%

75 - 14x + 18x
  set_cli_abort_call()
@@ -18439,7 +18439,7 @@

cardx coverage - 97.91%

78 - 14x + 18x
  check_pkg_installed(pkg = "broom")
@@ -18460,42 +18460,42 @@

cardx coverage - 97.91%

81 - 14x + 18x
  check_not_missing(x)
82 - 14x + 18x
  check_binary(x)
83 - 13x + 17x
  check_class(x = correct, "logical")
84 - 13x + 17x
  check_scalar(correct)
85 - 13x + 17x
  check_range(conf.level, range = c(0, 1), include_bounds = c(FALSE, FALSE))
86 - 13x + 17x
  check_scalar(conf.level)
@@ -18509,7 +18509,7 @@

cardx coverage - 97.91%

88 - 12x + 16x
  x <- stats::na.omit(x)
@@ -18523,14 +18523,14 @@

cardx coverage - 97.91%

90 - 12x + 16x
  n <- length(x)
91 - 12x + 16x
  y <- stats::prop.test(x = sum(x), n = n, correct = correct, conf.level = conf.level)
@@ -18544,42 +18544,42 @@

cardx coverage - 97.91%

93 - 12x + 16x
  list(N = n, conf.level = conf.level) |>
94 - 12x + 16x
    utils::modifyList(val = broom::tidy(y) |> as.list()) |>
95 - 12x + 16x
    utils::modifyList(
96 - 12x + 16x
      list(
97 - 12x + 16x
        method =
98 - 12x + 16x
          glue::glue("Wilson Confidence Interval {ifelse(correct, 'with', 'without')} continuity correction")
@@ -18684,7 +18684,7 @@

cardx coverage - 97.91%

113 - 5x + 7x
  set_cli_abort_call()
@@ -18705,7 +18705,7 @@

cardx coverage - 97.91%

116 - 5x + 7x
  check_pkg_installed(pkg = "broom")
@@ -18726,28 +18726,28 @@

cardx coverage - 97.91%

119 - 5x + 7x
  check_not_missing(x)
120 - 5x + 7x
  check_binary(x)
121 - 5x + 7x
  check_range(conf.level, range = c(0, 1), include_bounds = c(FALSE, FALSE))
122 - 5x + 7x
  check_scalar(conf.level)
@@ -18761,14 +18761,14 @@

cardx coverage - 97.91%

124 - 5x + 7x
  x <- stats::na.omit(x)
125 - 5x + 7x
  n <- length(x)
@@ -18782,7 +18782,7 @@

cardx coverage - 97.91%

127 - 5x + 7x
  y <- stats::binom.test(x = sum(x), n = n, conf.level = conf.level)
@@ -18796,21 +18796,21 @@

cardx coverage - 97.91%

129 - 5x + 7x
  list(N = n, conf.level = conf.level) |>
130 - 5x + 7x
    utils::modifyList(val = broom::tidy(y) |> as.list()) |>
131 - 5x + 7x
    utils::modifyList(list(method = "Clopper-Pearson Confidence Interval"))
@@ -18901,7 +18901,7 @@

cardx coverage - 97.91%

144 - 7x + 9x
  set_cli_abort_call()
@@ -18922,28 +18922,28 @@

cardx coverage - 97.91%

147 - 7x + 9x
  check_not_missing(x)
148 - 7x + 9x
  check_binary(x)
149 - 7x + 9x
  check_range(conf.level, range = c(0, 1), include_bounds = c(FALSE, FALSE))
150 - 7x + 9x
  check_scalar(conf.level)
@@ -18957,7 +18957,7 @@

cardx coverage - 97.91%

152 - 7x + 9x
  x <- stats::na.omit(x)
@@ -18971,21 +18971,21 @@

cardx coverage - 97.91%

154 - 7x + 9x
  n <- length(x)
155 - 7x + 9x
  x_sum <- sum(x)
156 - 7x + 9x
  z <- stats::qnorm((1 + conf.level) / 2)
@@ -19006,14 +19006,14 @@

cardx coverage - 97.91%

159 - 7x + 9x
  x_sum_tilde <- x_sum + z^2 / 2
160 - 7x + 9x
  n_tilde <- n + z^2
@@ -19034,35 +19034,35 @@

cardx coverage - 97.91%

163 - 7x + 9x
  p_tilde <- x_sum_tilde / n_tilde
164 - 7x + 9x
  q_tilde <- 1 - p_tilde
165 - 7x + 9x
  err <- z * sqrt(p_tilde * q_tilde) / sqrt(n_tilde)
166 - 7x + 9x
  l_ci <- max(0, p_tilde - err)
167 - 7x + 9x
  u_ci <- min(1, p_tilde + err)
@@ -19076,49 +19076,49 @@

cardx coverage - 97.91%

169 - 7x + 9x
  list(
170 - 7x + 9x
    N = n,
171 - 7x + 9x
    estimate = mean(x),
172 - 7x + 9x
    conf.low = l_ci,
173 - 7x + 9x
    conf.high = u_ci,
174 - 7x + 9x
    conf.level = conf.level,
175 - 7x + 9x
    method = "Agresti-Coull Confidence Interval"
@@ -19202,7 +19202,7 @@

cardx coverage - 97.91%

187 - 8x + 10x
  set_cli_abort_call()
@@ -19223,35 +19223,35 @@

cardx coverage - 97.91%

190 - 8x + 10x
  check_not_missing(x)
191 - 8x + 10x
  check_binary(x)
192 - 8x + 10x
  check_range(conf.level, range = c(0, 1), include_bounds = c(FALSE, FALSE))
193 - 8x + 10x
  check_scalar(conf.level)
194 - 8x + 10x
  x <- stats::na.omit(x)
@@ -19265,14 +19265,14 @@

cardx coverage - 97.91%

196 - 8x + 10x
  n <- length(x)
197 - 8x + 10x
  x_sum <- sum(x)
@@ -19286,35 +19286,35 @@

cardx coverage - 97.91%

199 - 8x + 10x
  alpha <- 1 - conf.level
200 - 8x + 10x
  l_ci <- ifelse(
201 - 8x + 10x
    x_sum == 0,
202 - 8x + 10x
    0,
203 - 8x + 10x
    stats::qbeta(alpha / 2, x_sum + 0.5, n - x_sum + 0.5)
@@ -19335,28 +19335,28 @@

cardx coverage - 97.91%

206 - 8x + 10x
  u_ci <- ifelse(
207 - 8x + 10x
    x_sum == n,
208 - 8x + 10x
    1,
209 - 8x + 10x
    stats::qbeta(1 - alpha / 2, x_sum + 0.5, n - x_sum + 0.5)
@@ -19377,49 +19377,49 @@

cardx coverage - 97.91%

212 - 8x + 10x
  list(
213 - 8x + 10x
    N = n,
214 - 8x + 10x
    estimate = mean(x),
215 - 8x + 10x
    conf.low = l_ci,
216 - 8x + 10x
    conf.high = u_ci,
217 - 8x + 10x
    conf.level = conf.level,
218 - 8x + 10x
    method = glue::glue("Jeffreys Interval")
@@ -19811,7 +19811,7 @@

cardx coverage - 97.91%

274 - 12x + 16x
  set_cli_abort_call()
@@ -19832,56 +19832,56 @@

cardx coverage - 97.91%

277 - 12x + 16x
  check_not_missing(x)
278 - 12x + 16x
  check_not_missing(strata)
279 - 12x + 16x
  check_binary(x)
280 - 12x + 16x
  check_class(correct, "logical")
281 - 12x + 16x
  check_scalar(correct)
282 - 12x + 16x
  check_class(strata, "factor")
283 - 12x + 16x
  check_range(conf.level, range = c(0, 1), include_bounds = c(FALSE, FALSE))
284 - 12x + 16x
  check_scalar(conf.level)
@@ -19902,28 +19902,28 @@

cardx coverage - 97.91%

287 - 12x + 16x
  is_na <- is.na(x) | is.na(strata)
288 - 12x + 16x
  x <- x[!is_na]
289 - 12x + 16x
  strata <- strata[!is_na]
290 - 6x + 8x
  if (!inherits(x, "logical")) x <- as.logical(x)
@@ -19937,7 +19937,7 @@

cardx coverage - 97.91%

292 - 12x + 16x
  if (all(x) || all(!x)) {
@@ -19965,14 +19965,14 @@

cardx coverage - 97.91%

296 - 10x + 14x
  tbl <- table(factor(x, levels = c(FALSE, TRUE)), strata, useNA = "no")
297 - 10x + 14x
  n_strata <- length(unique(strata))
@@ -19993,28 +19993,28 @@

cardx coverage - 97.91%

300 - 10x + 14x
  do_iter <- FALSE
301 - 10x + 14x
  if (is.null(weights)) {
302 - 3x + 7x
    weights <- rep(1 / n_strata, n_strata) # Initialization for iterative procedure
303 - 3x + 7x
    do_iter <- TRUE
@@ -20035,7 +20035,7 @@

cardx coverage - 97.91%

306 - 3x + 7x
    if (!is_scalar_integerish(max.iterations) || max.iterations < 1) {
@@ -20063,35 +20063,35 @@

cardx coverage - 97.91%

310 - 8x + 12x
  check_range(weights, range = c(0, 1), include_bounds = c(TRUE, TRUE))
311 - 7x + 11x
  sum_weights <- sum(weights) |>
312 - 7x + 11x
    round() |>
313 - 7x + 11x
    as.integer()
314 - 7x + 11x
  if (sum_weights != 1L || abs(sum_weights - sum(weights)) > sqrt(.Machine$double.eps)) {
@@ -20119,49 +20119,49 @@

cardx coverage - 97.91%

318 - 6x + 10x
  xs <- tbl["TRUE", ]
319 - 6x + 10x
  ns <- colSums(tbl)
320 - 6x + 10x
  use_stratum <- (ns > 0)
321 - 6x + 10x
  ns <- ns[use_stratum]
322 - 6x + 10x
  xs <- xs[use_stratum]
323 - 6x + 10x
  ests <- xs / ns
324 - 6x + 10x
  vars <- ests * (1 - ests) / ns
@@ -20175,7 +20175,7 @@

cardx coverage - 97.91%

326 - 6x + 10x
  strata_qnorm <- .strata_normal_quantile(vars, weights, conf.level)
@@ -20196,14 +20196,14 @@

cardx coverage - 97.91%

329 - 6x + 10x
  weights_new <- if (do_iter) {
330 - 1x + 5x
    .update_weights_strat_wilson(vars, strata_qnorm, weights, ns, max.iterations, conf.level)$weights
@@ -20238,7 +20238,7 @@

cardx coverage - 97.91%

335 - 6x + 10x
  strata_conf.level <- 2 * stats::pnorm(strata_qnorm) - 1
@@ -20252,14 +20252,14 @@

cardx coverage - 97.91%

337 - 6x + 10x
  ci_by_strata <- Map(
338 - 6x + 10x
    function(x, n) {
@@ -20273,7 +20273,7 @@

cardx coverage - 97.91%

340 - 36x + 48x
      suppressWarnings(stats::prop.test(x, n, correct = correct, conf.level = strata_conf.level)$conf.int)
@@ -20287,14 +20287,14 @@

cardx coverage - 97.91%

342 - 6x + 10x
    x = xs,
343 - 6x + 10x
    n = ns
@@ -20308,14 +20308,14 @@

cardx coverage - 97.91%

345 - 6x + 10x
  lower_by_strata <- sapply(ci_by_strata, "[", 1L)
346 - 6x + 10x
  upper_by_strata <- sapply(ci_by_strata, "[", 2L)
@@ -20329,14 +20329,14 @@

cardx coverage - 97.91%

348 - 6x + 10x
  lower <- sum(weights_new * lower_by_strata)
349 - 6x + 10x
  upper <- sum(weights_new * upper_by_strata)
@@ -20357,63 +20357,63 @@

cardx coverage - 97.91%

352 - 6x + 10x
  list(
353 - 6x + 10x
    N = length(x),
354 - 6x + 10x
    estimate = mean(x),
355 - 6x + 10x
    conf.low = lower,
356 - 6x + 10x
    conf.high = upper,
357 - 6x + 10x
    conf.level = conf.level,
358 - 6x + 10x
    weights = if (do_iter) weights_new else NULL,
359 - 6x + 10x
    method =
360 - 6x + 10x
      glue::glue("Stratified Wilson Confidence Interval {ifelse(correct, 'with', 'without')} continuity correction")
@@ -20427,7 +20427,7 @@

cardx coverage - 97.91%

362 - 6x + 10x
    compact()
@@ -20476,7 +20476,7 @@

cardx coverage - 97.91%

369 - 526x + 536x
  is.logical(x) || (is_integerish(x) && is_empty(setdiff(x, c(0, 1, NA))))
@@ -20686,7 +20686,7 @@

cardx coverage - 97.91%

399 - 8x + 20x
  summands <- weights^2 * vars
@@ -20700,7 +20700,7 @@

cardx coverage - 97.91%

401 - 8x + 20x
  sqrt(sum(summands)) / sum(sqrt(summands)) * stats::qnorm((1 + conf.level) / 2)
@@ -20959,14 +20959,14 @@

cardx coverage - 97.91%

438 - 1x + 5x
  it <- 0
439 - 1x + 5x
  diff_v <- NULL
@@ -20980,70 +20980,70 @@

cardx coverage - 97.91%

441 - 1x + 5x
  while (it < max.iterations) {
442 - 2x + 10x
    it <- it + 1
443 - 2x + 10x
    weights_new_t <- (1 + strata_qnorm^2 / n_per_strata)^2
444 - 2x + 10x
    weights_new_b <- (vars + strata_qnorm^2 / (4 * n_per_strata^2))
445 - 2x + 10x
    weights_new <- weights_new_t / weights_new_b
446 - 2x + 10x
    weights_new <- weights_new / sum(weights_new)
447 - 2x + 10x
    strata_qnorm <- .strata_normal_quantile(vars, weights_new, conf.level)
448 - 2x + 10x
    diff_v <- c(diff_v, sum(abs(weights_new - initial_weights)))
449 - 1x + 5x
    if (diff_v[length(diff_v)] < tol) break
450 - 1x + 5x
    initial_weights <- weights_new
@@ -21064,7 +21064,7 @@

cardx coverage - 97.91%

453 - 1x + 5x
  if (it == max.iterations) {
@@ -21092,28 +21092,28 @@

cardx coverage - 97.91%

457 - 1x + 5x
  list(
458 - 1x + 5x
    "n_it" = it,
459 - 1x + 5x
    "weights" = weights_new,
460 - 1x + 5x
    "diff_v" = diff_v
@@ -39245,14 +39245,14 @@

cardx coverage - 97.91%

41 - 25x + 35x
  check_not_missing(data)
42 - 25x + 35x
  UseMethod("ard_categorical_ci")
@@ -39392,14 +39392,14 @@

cardx coverage - 97.91%

62 - 12x + 22x
  set_cli_abort_call()
63 - 12x + 22x
  check_dots_empty()
@@ -39420,7 +39420,7 @@

cardx coverage - 97.91%

66 - 12x + 22x
  check_pkg_installed(pkg = "broom")
@@ -39441,35 +39441,35 @@

cardx coverage - 97.91%

69 - 12x + 22x
  cards::process_selectors(data, variables = {{ variables }}, by = {{ by }})
70 - 12x + 22x
  method <- arg_match(method)
71 - 12x + 22x
  if (method %in% c("strat_wilson", "strat_wilsoncc")) {
72 - 2x + 4x
    cards::process_selectors(data, strata = strata)
73 - 2x + 4x
    check_scalar(strata)
@@ -39483,21 +39483,21 @@

cardx coverage - 97.91%

75 - 12x + 22x
  cards::process_formula_selectors(
76 - 12x + 22x
    data[variables],
77 - 12x + 22x
    value = value
@@ -39511,7 +39511,7 @@

cardx coverage - 97.91%

79 - 12x + 22x
  check_not_missing(variables)
@@ -39532,7 +39532,7 @@

cardx coverage - 97.91%

82 - 12x + 22x
  if (is_empty(variables)) {
@@ -39567,28 +39567,28 @@

cardx coverage - 97.91%

87 - 12x + 22x
  map(
88 - 12x + 22x
    variables,
89 - 12x + 22x
    function(variable) {
90 - 20x + 30x
      levels <- .unique_values_sort(data, variable = variable, value = value[[variable]])
@@ -39602,63 +39602,63 @@

cardx coverage - 97.91%

92 - 20x + 30x
      .calculate_ard_proportion(
93 - 20x + 30x
        data = .as_dummy(data, variable = variable, levels = levels, by = by, strata = strata),
94 - 20x + 30x
        variables = c(everything(), -all_of(c(by, strata))),
95 - 20x + 30x
        by = all_of(by),
96 - 20x + 30x
        method = method,
97 - 20x + 30x
        conf.level = conf.level,
98 - 20x + 30x
        strata = strata,
99 - 20x + 30x
        weights = weights,
100 - 20x + 30x
        max.iterations = max.iterations
@@ -39679,35 +39679,35 @@

cardx coverage - 97.91%

103 - 20x + 30x
        dplyr::left_join(
104 - 20x + 30x
          dplyr::select(., "variable") |>
105 - 20x + 30x
            dplyr::distinct() |>
106 - 20x + 30x
            dplyr::mutate(variable_level = as.list(.env$levels)),
107 - 20x + 30x
          by = "variable"
@@ -39728,14 +39728,14 @@

cardx coverage - 97.91%

110 - 20x + 30x
        dplyr::mutate(variable = .env$variable) |>
111 - 20x + 30x
        dplyr::relocate("variable_level", .after = "variable")
@@ -39756,7 +39756,7 @@

cardx coverage - 97.91%

114 - 12x + 22x
    dplyr::bind_rows()
@@ -39784,140 +39784,140 @@

cardx coverage - 97.91%

118 - 20x + 30x
  cards::ard_complex(
119 - 20x + 30x
    data = data,
120 - 20x + 30x
    variables = {{ variables }},
121 - 20x + 30x
    by = {{ by }},
122 - 20x + 30x
    statistic =
123 - 20x + 30x
      ~ list(
124 - 20x + 30x
        prop_ci =
125 - 20x + 30x
          switch(method,
126 - 20x + 30x
            "waldcc" = \(x, ...) proportion_ci_wald(x, conf.level = conf.level, correct = TRUE),
127 - 20x + 30x
            "wald" = \(x, ...) proportion_ci_wald(x, conf.level = conf.level, correct = FALSE),
128 - 20x + 30x
            "wilsoncc" = \(x, ...) proportion_ci_wilson(x, conf.level = conf.level, correct = TRUE),
129 - 20x + 30x
            "wilson" = \(x, ...) proportion_ci_wilson(x, conf.level = conf.level, correct = FALSE),
130 - 20x + 30x
            "clopper-pearson" = \(x, ...) proportion_ci_clopper_pearson(x, conf.level = conf.level),
131 - 20x + 30x
            "agresti-coull" = \(x, ...) proportion_ci_agresti_coull(x, conf.level = conf.level),
132 - 20x + 30x
            "jeffreys" = \(x, ...) proportion_ci_jeffreys(x, conf.level = conf.level),
133 - 20x + 30x
            "strat_wilsoncc" = \(x, data, ...) {
134 - 1x + 2x
              proportion_ci_strat_wilson(x,
135 - 1x + 2x
                strata = data[[strata]], weights = weights,
136 - 1x + 2x
                max.iterations = max.iterations,
137 - 1x + 2x
                conf.level = conf.level, correct = TRUE
@@ -39938,35 +39938,35 @@

cardx coverage - 97.91%

140 - 20x + 30x
            "strat_wilson" = \(x, data, ...) {
141 - 1x + 2x
              proportion_ci_strat_wilson(x,
142 - 1x + 2x
                strata = data[[strata]], weights = weights,
143 - 1x + 2x
                max.iterations = max.iterations,
144 - 1x + 2x
                conf.level = conf.level, correct = FALSE
@@ -40008,14 +40008,14 @@

cardx coverage - 97.91%

150 - 20x + 30x
    dplyr::mutate(
151 - 20x + 30x
      context = "proportion_ci"
@@ -40050,7 +40050,7 @@

cardx coverage - 97.91%

156 - 250x + 260x
  unique_levels <-
@@ -40064,21 +40064,21 @@

cardx coverage - 97.91%

158 - 250x + 260x
    if (is.logical(data[[variable]])) c(TRUE, FALSE)
159 - 250x + 260x
  else if (is.factor(data[[variable]])) factor(levels(data[[variable]]), levels = levels(data[[variable]]))
160 - 250x + 260x
  else unique(data[[variable]]) |> sort()
@@ -40099,7 +40099,7 @@

cardx coverage - 97.91%

163 - 250x + 260x
  if (!is_empty(value) && !value %in% unique_levels) {
@@ -40162,14 +40162,14 @@

cardx coverage - 97.91%

172 - 250x + 260x
  if (!is_empty(value)) {
173 - 19x + 29x
    unique_levels <- value
@@ -40190,7 +40190,7 @@

cardx coverage - 97.91%

176 - 250x + 260x
  unique_levels
@@ -40225,28 +40225,28 @@

cardx coverage - 97.91%

181 - 20x + 30x
  map(levels, ~ data[[variable]] == .x) |>
182 - 20x + 30x
    set_names(paste0("this_is_not_a_column_name_anyone_would_choose_", variable, "_", levels, "...")) %>%
183 - 20x + 30x
    {dplyr::tibble(!!!.)} |> # styler: off
184 - 20x + 30x
    dplyr::bind_cols(data[c(by, strata)])