tests/testthat/test-helpers.R

test_that("trace works", {
  mat <- matrix(2, 3, 3)
  expect_equal(tr(mat), 6)
})

test_that("thurstone works", {
  lambda <- sigma <- rep(1, 10)
  expect_equal(sum(thurstone(lambda, sigma)), 10 / 11)
})

test_that("covmat works", {
  lambda <- sigma <- rep(1, 10)
  expect_equal(covmat(lambda, sigma), lambda %*% t(lambda) + diag(sigma^2))
})

Try the alphaci package in your browser

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

alphaci documentation built on May 29, 2024, 8:55 a.m.