tests/testthat/test-R2.R

context("test-R2.R ")
set.seed(56468541)

test_that("r2 outputs correct dimension for pibblefit", {
  sim <- pibble_sim(true_priors=TRUE)
  fit <- pibble(sim$Y, sim$X, sim$upsilon, sim$Theta, sim$Gamma, sim$Xi)
  rsquared <- r2(fit)
  expect_equal(dim(fit$Eta)[3], length(rsquared))
})

test_that("r2 outputs correct dimension for bassetfit", {
  sim <- pibble_sim()
  Gamma <- function(X) SE(X)
  Theta <- function(X) matrix(0, nrow(sim$Y)-1, ncol(X))
  fit <- basset(sim$Y, sim$X, Gamma = Gamma, Theta = Theta)
  rsquared <- r2(fit)
  expect_equal(dim(fit$Eta)[3], length(rsquared))
})

Try the fido package in your browser

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

fido documentation built on June 22, 2024, 9:36 a.m.