Skip to contents

With cs_get_n() one can extract the number of participants used in a clinical significance analysis from a cs_analysisobject. This may depend on the clinical significance approach and if missing values were present in the dataset. For all individual analyses, missing values are handled by list-wise deletion. Consequently, individuals with a missing pre or post intervention score will be omitted from the analyses.

Usage

cs_get_n(x, which = "all")

Arguments

x

A cs_analysis object

which

Which n should be returned? Available options are

  • "all", (the default) returns the number of participants in both, the original and used data set

  • "original", number of participants in the original dataset

  • "used", number of participants in the used data set, so after conversion to wide format and omitting cases with missing values

Value

A tibble with number of participants

Examples

# n can be extracted for every approach
cs_results_anchor <- claus_2020 |>
  cs_anchor(
    id,
    time,
    bdi,
    pre = 1,
    post = 4,
    mid_improvement = 9
  )

cs_results_distribution <- claus_2020 |>
  cs_distribution(
    id,
    time,
    bdi,
    pre = 1,
    post = 4,
    reliability = 0.80
  )

cs_results_statistical <- claus_2020 |>
  cs_statistical(
    id,
    time,
    bdi,
    pre = 1,
    post = 4,
    m_functional = 8,
    sd_functional = 8,
    cutoff_type = "c"
  )

cs_results_combined <- claus_2020 |>
  cs_combined(
    id,
    time,
    bdi,
    pre = 1,
    post = 4,
    reliability = 0.80,
    m_functional = 8,
    sd_functional = 8,
    cutoff_type = "c"
  )

cs_results_percentage <- claus_2020 |>
  cs_percentage(
    id,
    time,
    bdi,
    pre = 1,
    post = 4,
    pct_improvement = 0.3
  )


cs_get_n(cs_results_anchor)
#> # A tibble: 1 × 3
#>   n_original n_used percent_used
#>        <int>  <int>        <dbl>
#> 1         43     40        0.930
cs_get_n(cs_results_distribution)
#> # A tibble: 1 × 3
#>   n_original n_used percent_used
#>        <int>  <int>        <dbl>
#> 1         43     40        0.930
cs_get_n(cs_results_statistical)
#> # A tibble: 1 × 3
#>   n_original n_used percent_used
#>        <int>  <int>        <dbl>
#> 1         43     40        0.930
cs_get_n(cs_results_combined)
#> # A tibble: 1 × 3
#>   n_original n_used percent_used
#>        <int>  <int>        <dbl>
#> 1         43     40        0.930
cs_get_n(cs_results_percentage)
#> # A tibble: 1 × 3
#>   n_original n_used percent_used
#>        <int>  <int>        <dbl>
#> 1         43     40        0.930


# Get your desired n
cs_get_n(cs_results_anchor, which = "all")
#> # A tibble: 1 × 3
#>   n_original n_used percent_used
#>        <int>  <int>        <dbl>
#> 1         43     40        0.930
cs_get_n(cs_results_anchor, which = "original")
#> # A tibble: 1 × 1
#>   n_original
#>        <int>
#> 1         43
cs_get_n(cs_results_anchor, which = "used")
#> # A tibble: 1 × 1
#>   n_used
#>    <int>
#> 1     40