File: test-model_parameters.pairwise.htest.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 (31 lines) | stat: -rw-r--r-- 834 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
test_that("model_parameters.pairwise.htest", {
  data(airquality)
  airquality$Month <- factor(airquality$Month, labels = month.abb[5:9])
  model <- pairwise.t.test(airquality$Ozone, airquality$Month)
  mp <- model_parameters(model)

  expect_equal(
    mp$Group1,
    c("Jun", "Jul", "Jul", "Aug", "Aug", "Aug", "Sep", "Sep", "Sep", "Sep")
  )
  expect_equal(
    mp$p,
    c(1, 0.00026, 0.05113, 0.00019, 0.04987, 1, 1, 1, 0.00488, 0.00388),
    tolerance = 1e-3
  )

  smokers <- c(83, 90, 129, 70)
  patients <- c(86, 93, 136, 82)
  model <- suppressWarnings(pairwise.prop.test(smokers, patients))
  mp <- model_parameters(model)

  expect_equal(
    mp$Group1,
    c("2", "3", "3", "4", "4", "4")
  )
  expect_equal(
    mp$p,
    c(1, 1, 1, 0.11856, 0.09322, 0.12377),
    tolerance = 1e-3
  )
})