tests/testthat/testsMDC.R

library(psr)

subject_1 <- c(1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17,
               18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30)
trial_1 <- c(1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2,
             1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2)
metric_1 <- c(31, 27, 33, 35, 42, 47, 40, 44, 63, 63, 28, 31, 43, 54, 44, 54, 68, 68, 47, 58, 47, 48, 40, 43, 43, 45, 47, 52, 58, 48,
              61, 61, 45, 52, 43, 44, 58, 48, 40, 44, 48, 47, 42, 52, 61, 45, 48, 43, 43, 52, 50, 52, 39, 40, 52, 58, 42, 45, 77, 67)

testthat::test_that("MDC", {
  testthat::expect_equal(round(MDC(subject_1, trial_1, metric_1, ICC = 0.88, confidence = 0.95)[1, 1], 1), 9.7)
})

Try the psr package in your browser

Any scripts or data that you put into this service are public.

psr documentation built on Aug. 13, 2021, 5:08 p.m.