tests/testthat/test-coeffTable.R

test_that("coeffTable matches identity coefficients by ID pair", {
  x = relabel(nuclearPed(2), new = c("Z", "A", "B", "C"))
  tab = coeffTable(x, coeff = c("kappa", "identity"))

  expect_equal(tab[tab$id1 == "A" & tab$id2 == "B", "D8"], 1)
})

test_that("coeffTable respects input order", {
  x = selfingPed(1)
  res1 = coeffTable(x, ids = 1:2, coeff = "identity")
  res2 = coeffTable(x, ids = 2:1, coeff = "identity")

  expect_equal(res1[c("D3", "D5", "D7")], c(0, 0.5, 0.5), check.attributes = FALSE)
  expect_equal(res2[c("D3", "D5", "D7")], c(0.5, 0, 0.5), check.attributes = FALSE)
})

Try the ribd package in your browser

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

ribd documentation built on Aug. 4, 2026, 1:07 a.m.