Skip to contents

Compare Rates Between Groups

Usage

compare_rates_between_groups(
  data,
  group,
  event,
  test,
  input = "long",
  output = "console"
)

Arguments

data

data

group

column in dataframe : group

event

column in dataframe : event

test

Type of test (fisher, n-1 two prop)

input

Defaults to "long"

output

"console" prints output to console; "tibble" returns tibble

Value

results

Examples

design = c("A","B")
complete = c(34, 24)
incomplete = c(317, 301)
data <- data.frame(design, complete, incomplete)
data <- data |> tidyr::pivot_longer(!design, names_to = "rate", values_to = "n") |>
  tidyr::uncount(n)
compare_rates_between_groups(data, group = design, event = rate)
#> 
#> ── Compare Rates Between Groups ────────────────────────────────────────────────
#> → N-1 Two Proportions test
#>   term         value  
#>   a            0.023  
#>   b            0.999  
#>   c           0.0784  
#>   d          0.00593  
#>   den         0.0216  
#>   num          0.023  
#>   z             1.07  
#>   p_value      0.286  
#>   n              676  
#>   lower_ci   -0.0197  
#>   upper_ci    0.0651