File: test-gee.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 (38 lines) | stat: -rw-r--r-- 766 bytes parent folder | download
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
32
33
34
35
36
37
38
skip_if_not_installed("gee")
data(warpbreaks)
void <- capture.output({
  m1_gee <- suppressMessages(gee::gee(breaks ~ tension, id = wool, data = warpbreaks))
})

test_that("ci", {
  expect_equal(
    suppressMessages(ci(m1_gee))$CI_low,
    c(30.90044, -17.76184, -22.48406),
    tolerance = 1e-3
  )
})

test_that("se", {
  expect_equal(
    standard_error(m1_gee)$SE,
    c(2.80028, 3.96019, 3.96019),
    tolerance = 1e-3
  )
})

test_that("p_value", {
  expect_equal(
    p_value(m1_gee)$p,
    c(0, 0.01157, 2e-04),
    tolerance = 1e-3
  )
})

mp <- suppressWarnings(model_parameters(m1_gee))
test_that("model_parameters", {
  expect_equal(
    mp$Coefficient,
    c(36.38889, -10, -14.72222),
    tolerance = 1e-3
  )
})