Skip to content

Validation of Cadence Bands #13

@muschellij2

Description

@muschellij2

Hey @ang-zhao - can you provide some clarification on the cadence bands calculation?
I believe we were using https://bjsm.bmj.com/content/52/12/776.abstract to calculate these bands, correct?

FoImage

It seems like the cutoffs are different and some are misclassified (e.g. 1 is classified as zero). I believe this may be due to the behavior of cut when right = TRUE (default) in

breaks = c(0, 1, 19, 29, 49, 59, 79, 89, 99, 119, Inf),

library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
library(cadence)
df = data.frame(
  steps = c(
    rep(0, 2),
    rep(1, 3),
    rep(15, 4),
    rep(19, 5),
    rep(20, 5),
    rep(25, 6),
    rep(29, 7),
    rep(30, 5),
    rep(35, 8),    
    rep(49, 9),
    rep(50, 5),
    rep(55, 10),
    rep(59, 11),
    rep(60, 5),
    rep(75, 12),
    rep(79, 13),
    rep(80, 5),
    rep(85, 14),
    rep(89, 15),
    rep(90, 5),
    rep(95, 16),
    rep(99, 17),
    rep(100, 5),
    rep(105, 18),
    rep(119, 19),
    rep(125, 20)
  )
)
bands = df %>% 
  compute_cadence_bands()
bands %>% count(steps, cadence_band)
#>    steps   cadence_band  n
#> 1      0           zero  2
#> 2      1           zero  3
#> 3     15     incidental  4
#> 4     19     incidental  5
#> 5     20       sporadic  5
#> 6     25       sporadic  6
#> 7     29       sporadic  7
#> 8     30     purposeful  5
#> 9     35     purposeful  8
#> 10    49     purposeful  9
#> 11    50      slow_walk  5
#> 12    55      slow_walk 10
#> 13    59      slow_walk 11
#> 14    60    medium_walk  5
#> 15    75    medium_walk 12
#> 16    79    medium_walk 13
#> 17    80     brisk_walk  5
#> 18    85     brisk_walk 14
#> 19    89     brisk_walk 15
#> 20    90      fast_walk  5
#> 21    95      fast_walk 16
#> 22    99      fast_walk 17
#> 23   100 very_fast_walk  5
#> 24   105 very_fast_walk 18
#> 25   119 very_fast_walk 19
#> 26   125        all_out 20

Created on 2026-01-19 with reprex v2.1.1

Session info

sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value
#>  version  R version 4.4.0 (2024-04-24)
#>  os       macOS 15.4.1
#>  system   x86_64, darwin20
#>  ui       X11
#>  language (EN)
#>  collate  en_US.UTF-8
#>  ctype    en_US.UTF-8
#>  tz       America/New_York
#>  date     2026-01-19
#>  pandoc   3.7.0.2 @ /usr/local/bin/ (via rmarkdown)
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package     * version    date (UTC) lib source
#>  assertthat    0.2.1      2019-03-21 [1] CRAN (R 4.4.0)
#>  cadence     * 0.2.0      2026-01-19 [1] local
#>  cli           3.6.3      2024-06-21 [1] CRAN (R 4.4.0)
#>  digest        0.6.37     2024-08-19 [1] CRAN (R 4.4.1)
#>  dplyr       * 1.1.4      2023-11-17 [1] CRAN (R 4.4.0)
#>  evaluate      1.0.3      2025-01-10 [1] CRAN (R 4.4.1)
#>  fastmap       1.2.0      2024-05-15 [1] CRAN (R 4.4.0)
#>  fs            1.6.5      2024-10-30 [1] CRAN (R 4.4.1)
#>  generics      0.1.3      2022-07-05 [1] CRAN (R 4.4.0)
#>  glue          1.8.0      2024-09-30 [1] CRAN (R 4.4.1)
#>  htmltools     0.5.8.1    2024-04-04 [1] CRAN (R 4.4.0)
#>  knitr         1.49       2024-11-08 [1] CRAN (R 4.4.1)
#>  lifecycle     1.0.4      2023-11-07 [1] CRAN (R 4.4.0)
#>  magrittr      2.0.3      2022-03-30 [1] CRAN (R 4.4.0)
#>  pillar        1.10.1     2025-01-07 [1] CRAN (R 4.4.1)
#>  pkgconfig     2.0.3      2019-09-22 [1] CRAN (R 4.4.0)
#>  R6            2.5.1      2021-08-19 [1] CRAN (R 4.4.0)
#>  reprex        2.1.1      2024-07-06 [1] CRAN (R 4.4.0)
#>  rlang         1.1.5      2025-01-17 [1] CRAN (R 4.4.1)
#>  rmarkdown     2.29       2024-11-04 [1] CRAN (R 4.4.1)
#>  rstudioapi    0.17.1     2024-10-22 [1] CRAN (R 4.4.1)
#>  sessioninfo   1.2.2      2021-12-06 [1] CRAN (R 4.4.0)
#>  tibble        3.2.1      2023-03-20 [1] CRAN (R 4.4.0)
#>  tidyselect    1.2.1      2024-03-11 [1] CRAN (R 4.4.0)
#>  vctrs         0.6.5.9000 2025-09-08 [1] Github (r-lib/vctrs@1175638)
#>  withr         3.0.2      2024-10-28 [1] CRAN (R 4.4.1)
#>  xfun          0.50       2025-01-07 [1] CRAN (R 4.4.1)
#>  yaml          2.3.10     2024-07-26 [1] CRAN (R 4.4.0)
#> 
#>  [1] /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library
#> 
#> ──────────────────────────────────────────────────────────────────────────────

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions