Skip to content

Improve messaging for paired tests with imbalanced data #242

@ddsjoberg

Description

@ddsjoberg
  • paired_cohens_d
  • paired_hedges_g
  • mcnemar.test
  • paired.t.test
  • paired.wilcox.test
tmax <- data.frame(Subject = c(1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 5, 5, 5, 5), 
                   Treatment = c("T", "R", "T", "R", "R", "T", "R", "T", "T", "R", "T", "R", "R", "T", "R", "T"), 
                   TMAX = c(1.333, 1.667, 0.667, 1.667, 2, 0.667, 2, 2, 1, 1, 2, 1, 0.667, 1, 2, 1))

cardx::ard_stats_paired_t_test(
  data = tmax,
  variable = "TMAX",
  by = "Treatment",
  id = "Subject"
) |> 
  cards::print_ard_conditions()
#> The following errors were returned during `print_ard_conditions()`:
#> ✖ For variable `TMAX` (`Treatment`) and "estimate", "estimate1", "estimate2",
#>   "statistic", "p.value", "parameter", "conf.low", "conf.high", "method",
#>   "alternative", "mu", "paired", "var.equal", and "conf.level" statistics:
#>   non-numeric argument to binary operator
#> The following warnings were returned during `print_ard_conditions()`:
#> ! For variable `TMAX` (`Treatment`) and "estimate", "estimate1", "estimate2",
#>   "statistic", "p.value", "parameter", "conf.low", "conf.high", "method",
#>   "alternative", "mu", "paired", "var.equal", and "conf.level" statistics:
#>   Values from `TMAX` are not uniquely identified; output will contain
#>   list-cols. • Use `values_fn = list` to suppress this warning. • Use
#>   `values_fn = {summary_fun}` to summarise duplicates. • Use the following
#>   dplyr code to identify duplicates.  {data} |> dplyr::summarise(n =
#>   dplyr::n(), .by = c(Subject, Treatment)) |> dplyr::filter(n > 1L)

Created on 2024-11-21 with reprex v2.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions