tests/testthat/test-pkg-estimatr.R

test_that("Issue #530 from the `modelsummary` repo", {
  skip_if_not_installed("estimatr")
  toy_df <- data.frame(
    y = c(1, 2, 3),
    x = c(1, 2, 4),
    weights = c(0.2, 0.2, 0.6)
  )
  mod <- estimatr::lm_robust(x ~ y, data = toy_df)
  modw <- estimatr::lm_robust(x ~ y, weights = weights, data = toy_df)

  expect_equal(
    as.numeric(r2(mod)$R2),
    summary(mod)$r.squared
  )

  expect_equal(
    as.numeric(r2(modw)$R2),
    summary(modw)$r.squared
  )
})

Try the performance package in your browser

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

performance documentation built on Nov. 2, 2023, 5:48 p.m.