Skip to contents

This tutorial builds a small table in code and runs the full workflow.

Build the data table

assay_table <- data.frame(
  group = c(rep("vehicle", 10), rep("compound", 10)),
  signal = c(10.1, 9.8, 10.5, 10.0, 9.9, 10.2, 10.4, 10.1, 9.7, 10.3,
             11.0, 10.9, 11.1, 11.3, 10.8, 11.2, 11.4, 11.0, 10.9, 11.1)
)

assay_table
#>       group signal
#> 1   vehicle   10.1
#> 2   vehicle    9.8
#> 3   vehicle   10.5
#> 4   vehicle   10.0
#> 5   vehicle    9.9
#> 6   vehicle   10.2
#> 7   vehicle   10.4
#> 8   vehicle   10.1
#> 9   vehicle    9.7
#> 10  vehicle   10.3
#> 11 compound   11.0
#> 12 compound   10.9
#> 13 compound   11.1
#> 14 compound   11.3
#> 15 compound   10.8
#> 16 compound   11.2
#> 17 compound   11.4
#> 18 compound   11.0
#> 19 compound   10.9
#> 20 compound   11.1

Check the design

check_design(
  data = assay_table,
  outcome = "signal",
  group = "group",
  goal = "difference",
  outcome_type = "continuous",
  paired = "no",
  repeated = "no",
  adjust = "no"
)
#> $ok
#> [1] TRUE
#> 
#> $issues
#> character(0)
#> 
#> $warnings
#> character(0)
#> 
#> $inputs
#> $inputs$goal
#> [1] "difference"
#> 
#> $inputs$outcome_type
#> [1] "continuous"
#> 
#> $inputs$group_count
#> [1] "2"
#> 
#> $inputs$paired
#> [1] "no"
#> 
#> $inputs$repeated
#> [1] "no"
#> 
#> $inputs$adjust
#> [1] "no"

Get a recommendation

recommend_test(
  data = assay_table,
  outcome = "signal",
  group = "group",
  goal = "difference",
  outcome_type = "continuous",
  paired = "no",
  repeated = "no",
  adjust = "no",
  normality = "auto"
)
#> statsguider decision
#> - action: recommend
#> - method: Welch t-test
#> - alternative: Mann-Whitney U test
#> - reason: The design is an independent two-group continuous comparison with acceptable normality.
#> - next step: Run the Welch t-test.
#> - notes:
#>   * Normality was checked automatically and classified as `yes`.

Run the test

run_test(
  data = assay_table,
  outcome = "signal",
  group = "group",
  goal = "difference",
  outcome_type = "continuous",
  paired = "no",
  repeated = "no",
  adjust = "no",
  normality = "auto"
)
#> statsguider result
#> - method: Welch t-test
#> - reason: The design is an independent two-group continuous comparison with acceptable normality.
#> - summary: Welch t-test was selected for a continuous outcome with 2 groups.
#> 
#> 
#>  Welch Two Sample t-test
#> 
#> data:  signal by group
#> t = 9.5888, df = 16.487, p-value = 3.76e-08
#> alternative hypothesis: true difference in means between group compound and group vehicle is not equal to 0
#> 95 percent confidence interval:
#>  0.7560642 1.1839358
#> sample estimates:
#> mean in group compound  mean in group vehicle 
#>                  11.07                  10.10