File: test-model_parameters.epi2x2.R

package info (click to toggle)
r-cran-parameters 0.24.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,852 kB
  • sloc: sh: 16; makefile: 2
file content (17 lines) | stat: -rw-r--r-- 598 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
skip_on_cran()
skip_if_not_installed("epiR")

test_that("model_parameters.epi2x2", {
  data(mtcars)
  tab <- xtabs(~ am + vs, data = mtcars)
  out <- model_parameters(epiR::epi.2by2(tab))
  expect_identical(out$Parameter, c("RR", "OR", "ARisk", "AFRisk", "PARisk", "PAFRisk"))
  expect_identical(
    attributes(out)$pretty_names,
    c(
      RR = "Risk Ratio", OR = "Odds Ratio", ARisk = "Attributable Risk",
      AFRisk = "Attributable Fraction in Exposed (%)", PARisk = "Attributable Risk in Population",
      PAFRisk = "Attributable Fraction in Population (%)"
    )
  )
})