Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: cicalc
Title: Calculate Confidence Intervals
Version: 0.2.1
Version: 0.2.2
Authors@R: c(
person("Christina", "Fillmore", , "christina.e.fillmore@gsk.com", role = c("aut", "cre"),
comment = c(ORCID = "0000-0003-0595-2302")),
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# cicalc 0.2.2
* Fix issue with factor conversion in Miettinen-Nurminen CI calculation #20
* Fix issue with ci_prop_diff_mh_strata() for z statistic calculation
* Fix issue with ci_prop_wilson_strata() when datasets are provided [#22](https://github.com/GSK-Biostatistics/cicalc/issues/22)
* Fix non-logical [#23](https://github.com/GSK-Biostatistics/cicalc/issues/23) and dataset issue [#24](https://github.com/GSK-Biostatistics/cicalc/issues/24) for ci_prop_diff_nc_strata()

# cicalc 0.2.1
* Fix bug in Miettinen-Nurminen CI calculation when non-rootable conditions occur

Expand Down
2 changes: 1 addition & 1 deletion R/prop_ci.R
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ ci_prop_wilson_strata <- function(x,
# if data was passed, evaluate in the context of the data frame
if (is.data.frame(data)) {
return(
ci_prop_jeffreys(
ci_prop_wilson_strata(
x = x ,
conf.level = conf.level
) |>
Expand Down
10 changes: 6 additions & 4 deletions R/prop_ci_common_risk.R
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ ci_prop_diff_mh_strata <- function(x, by, strata, conf.level = 0.95, sato_var =
lower_ci <- d_mh - z_alpha*sqrt(est_var)
upper_ci <- d_mh + z_alpha*sqrt(est_var)

z_stat <- d_mh/sqrt(sato_var)
z_stat <- d_mh/sqrt(est_var)

p.value <- 2 * (1 - stats::pnorm(abs(z_stat)))

Expand Down Expand Up @@ -334,9 +334,11 @@ ci_prop_diff_nc_strata <- function(x,
# if data was passed, evaluate in the context of the data frame
if (is.data.frame(data)) {
return(
ci_prop_diff_nc(
ci_prop_diff_nc_strata(
x = x,
by = by,
strata = strata,
weights_method = weights_method,
conf.level = conf.level,
correct = correct
) |>
Expand All @@ -353,7 +355,7 @@ ci_prop_diff_nc_strata <- function(x,
check_scalar(correct)
check_range(conf.level, range = c(0, 1), include_bounds = c(FALSE, FALSE))
check_scalar(conf.level)

x<- as.logical(x)

if (any(tapply(x, strata, length) < 5)) {
cli::cli_warn("Less than 5 observations in some strata.")
Expand Down Expand Up @@ -439,6 +441,6 @@ ci_prop_diff_nc_strata <- function(x,
method =
glue::glue("Stratified Newcombe Confidence Interval {ifelse(correct, 'with', 'without')} continuity correction, {weights_method}")
),
class = c("stratified_newcombe", "stratified_wilson", "cicada")
class = c("ci_prop_diff_nc_strata", "stratified_wilson", "cicalc")
)
}
2 changes: 1 addition & 1 deletion R/prop_ci_mn.R
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ ci_prop_diff_mn_strata <- function(x, by, strata, method = c("score", "summary s

estimate_df <- dplyr::tibble(
x = x,
by = as.numeric(as.factor(by)),
by = as.numeric(forcats::as_factor(by)),
strata = strata
) |>
dplyr::group_by(strata) |>
Expand Down
12 changes: 6 additions & 6 deletions tests/testthat/_snaps/prop_ci_common_risk.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@
* 50 responses out of 80
* Weights: a.x = 0.211, b.x = 0.189, a.y = 0.118, b.y = 0.154, a.z = 0.174, b.z
= 0.153
* Estimate: 0
* Estimate: 0.259
* 95% Confidence Interval:
(0, 0)
(0.0392, 0.4502)

---

Expand All @@ -124,9 +124,9 @@
* 50 responses out of 80
* Weights: a.x = 0.195, b.x = 0.163, a.y = 0.135, b.y = 0.138, a.z = 0.202, b.z
= 0.167
* Estimate: 0
* Estimate: 0.254
* 95% Confidence Interval:
(0, 0)
(0.0347, 0.4454)

---

Expand All @@ -138,9 +138,9 @@
* 50 responses out of 80
* Weights: a.x = 0.211, b.x = 0.189, a.y = 0.118, b.y = 0.154, a.z = 0.174, b.z
= 0.153
* Estimate: 0
* Estimate: 0.259
* 95% Confidence Interval:
(0, 0)
(0.0392, 0.4502)

---

Expand Down
Loading