Skip to content

Commit

Permalink
Merge pull request #363 from DeclareDesign/cran-patch-again
Browse files Browse the repository at this point in the history
skip on cran for clubsandwich tests
  • Loading branch information
graemeblair authored Sep 2, 2020
2 parents eac6915 + 1c31433 commit 9ca7645
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ appveyor.yml
CONDUCT.md
^vignettes$
^docs$
^.github$
^docs/templates/.*$
deploy.sh
_pkgdown.yml
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ jobs:
run: |
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("rcmdcheck")
remotes::install_github("jepusto/clubSandwich")
shell: Rscript {0}

- name: Check
Expand Down
2 changes: 2 additions & 0 deletions CRAN-RELEASE
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This package was submitted to CRAN on 2020-09-01.
Once it is accepted, delete this file and tag the release (commit c9eb598).
2 changes: 1 addition & 1 deletion cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
## Submission

This small patch mostly contains bugfixes, but also removes a dependency on `clubSandwich` as it was mentioned to us it may be removed in a couple of weeks. We now suggest the package and skip the test unless it is installed.
We sincerely apologize for the delay in sending this update. This small patch mostly contains bugfixes, but also removes a dependency on `clubSandwich.` We now suggest the package and skip the test unless it is installed. We have also fixed small bugs due to the most recent version of clubSandwich posted yesterday.
1 change: 1 addition & 0 deletions tests/testthat/test-iv-robust.R
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ test_that("iv_robust matches AER + ivpack", {
test_that("iv_robust matches AER + clubSandwich", {
skip_if_not_installed("AER")
skip_if_not_installed("clubSandwich")
skip_on_cran()

# ClubSandwich IV tests
for (se_type in cr_se_types) {
Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-lm-cluster.R
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ test_that("lm cluster se", {

test_that("Clustered SEs match clubSandwich", {
skip_if_not_installed("clubSandwich")
skip_on_cran()

lm_o <- lm(mpg ~ hp, data = mtcars)
lm_ow <- lm(mpg ~ hp, data = mtcars, weights = wt)
Expand Down Expand Up @@ -209,6 +210,7 @@ test_that("Clustered SEs match clubSandwich", {

test_that("multiple outcomes", {
skip_if_not_installed("clubSandwich")
skip_on_cran()


for (se_type in cr_se_types) {
Expand Down
9 changes: 4 additions & 5 deletions tests/testthat/test-lm-robust.R
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ test_that("lm robust F-tests are correct", {
skip_if_not_installed("car")
skip_if_not_installed("clubSandwich")


co <- lm_robust(mpg ~ hp + am, data = mtcars, se_type = "classical")
caro <- car::linearHypothesis(co, c("hp = 0", "am = 0"), test = "F")
carolm <- car::linearHypothesis(lm(mpg ~ hp + am, data = mtcars),
Expand Down Expand Up @@ -197,24 +196,24 @@ test_that("lm robust F-tests are correct", {
lmcr <- lm_robust(mpg ~ hp + am, data = mtcars, clusters = carb, se_type = se_type)
caro <- clubSandwich::Wald_test(lm(mpg ~ hp + am, data = mtcars),
cluster = mtcars$carb,
c(FALSE, TRUE, TRUE),
constraints = clubSandwich::constrain_zero(2:3),
vcov = ifelse(se_type == "stata", "CR1S", se_type),
test = "Naive-F")

lmcrw <- lm_robust(mpg ~ hp + am, data = mtcars, clusters = carb, weights = wt, se_type = se_type)
carow <- clubSandwich::Wald_test(lm(mpg ~ hp + am, weights = wt, data = mtcars),
cluster = mtcars$carb,
c(FALSE, TRUE, TRUE),
constraints = clubSandwich::constrain_zero(2:3),
vcov = ifelse(se_type == "stata", "CR1S", se_type),
test = "Naive-F")

expect_equivalent(
lmcr$fstatistic[c(1, 3)],
c(caro$Fstat, caro$df)
c(caro$Fstat, caro$df_denom)
)
expect_equivalent(
lmcrw$fstatistic[c(1, 3)],
c(carow$Fstat, carow$df)
c(carow$Fstat, carow$df_denom)
)
}

Expand Down

0 comments on commit 9ca7645

Please sign in to comment.