Skip to content

Commit

Permalink
Merge pull request #394 from DeclareDesign/new-version-1.0.0
Browse files Browse the repository at this point in the history
New version 1.0.0
  • Loading branch information
graemeblair authored Jul 28, 2023
2 parents 1a0131a + 4fbfb03 commit 6c0bc21
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 10 deletions.
3 changes: 0 additions & 3 deletions CRAN-SUBMISSION

This file was deleted.

3 changes: 1 addition & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Imports:
rlang (>= 0.2.0)
LinkingTo: Rcpp, RcppEigen
Encoding: UTF-8
RoxygenNote: 7.1.1
RoxygenNote: 7.2.0
LazyData: true
Suggests:
fabricatr (>= 0.10.0),
Expand All @@ -32,7 +32,6 @@ Suggests:
clubSandwich,
emmeans (>= 1.4),
estimability,
ivpack,
margins,
modelsummary,
prediction,
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# estimatr 1.0.0

* Version bump to coincide with DeclareDesign package version 1.0.0
* Tests edited

# estimatr 0.30.6

* Fix tests to address CRAN failures
Expand Down
2 changes: 1 addition & 1 deletion R/estimatr_lm_lin.R
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ lm_lin <- function(formula,
)
}

if (class(covariates) != "formula") {
if (!inherits(covariates, "formula")) {
stop(
"The `covariates` argument must be specified as a formula:\n",
"You passed an object of class ", class(covariates)
Expand Down
2 changes: 1 addition & 1 deletion R/estimatr_lm_robust.R
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
#'
#' Bell, Robert M, and Daniel F McCaffrey. 2002. "Bias Reduction in Standard Errors for Linear Regression with Multi-Stage Samples." Survey Methodology 28 (2): 169-82.
#'
#' Gaure, Simon. 2013. "OLS with multiple high dimensional category variables." Computational Statistics \& Data Analysis 66: 8-1. \doi{10.1016/j.csda.2013.03.024}
#' Gaure, Simon. 2013. "OLS with multiple high dimensional category variables." Computational Statistics & Data Analysis 66: 8-1. \doi{10.1016/j.csda.2013.03.024}
#'
#' Halperin, I. 1962. "The product of projection operators." Acta Scientiarum Mathematicarum (Szeged) 23(1-2): 96-99.
#'
Expand Down
3 changes: 1 addition & 2 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
## Submission

Thank you for reviewing this minor patch, which addresses failures on CRAN due to changes in all.equal in r-devel per email from Prof. Ripley.
Thank you for reviewing this minor patch, which addresses failures on CRAN due to ivpack being archived. The version is also bumped and the email address of the maintainer changed.

There are no changes to worse in reverse depends.

We have checked this in win builder and on OS X, linux, and Windows in release, oldrel, and devel on Github Actions with no issues.


2 changes: 1 addition & 1 deletion man/lm_robust.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions tests/testthat/test-condition-pr-matrix.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ test_that("Checks class", {

test_that("Complete randomization", {

skip_if_not_installed("randomizr")

prs <- rep(0.4, times = n)
comp_ra <- randomizr::declare_ra(N = n, prob = prs[1])
perms <- randomizr::obtain_permutation_matrix(comp_ra)
Expand Down
6 changes: 6 additions & 0 deletions tests/testthat/test-iv-robust.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ test_that("iv_robust matches AER + ivpack", {

skip_if_not_installed("AER")
skip_if_not_installed("ivpack")
skip("ivpack is not available")

ivco <- iv_robust(y ~ x | z, data = dat, se_type = "classical")
ivfit <- AER::ivreg(y ~ x | z, data = dat)
ivo <- summary(ivfit)
Expand Down Expand Up @@ -323,6 +325,8 @@ test_that("iv_robust matches AER + clubSandwich", {

test_that("iv_robust different specifications work", {
skip_if_not_installed("AER")
skip_if_not_installed("ivpack")
skip("ivpack not available")

# More instruments than endog. regressors
ivro <- iv_robust(mpg ~ wt | hp + cyl, data = mtcars, se_type = "HC0")
Expand Down Expand Up @@ -439,6 +443,8 @@ test_that("S3 methods", {

test_that("IV diagnostics", {

skip_if_not_installed("AER")

# Load stata diagnostics
stata_diags <- read.table(
"stata-iv-diagnostics.txt",
Expand Down
10 changes: 10 additions & 0 deletions tests/testthat/test-lh-robust.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ dat <- data.frame(

# se tests
test_that("lh_robust works with all se types", {
skip_if_not_installed("car")
for (se_type in se_types) {
lhro <-
tidy(
Expand All @@ -34,6 +35,7 @@ test_that("lh_robust works with all se types", {
})

test_that("lh_robust with clusters works for all se_types ", {
skip_if_not_installed("car")
for (se_type in cr_se_types) {
lhro <-
tidy(
Expand All @@ -58,6 +60,8 @@ test_that("lh_robust with clusters works for all se_types ", {
})

test_that("lh_robust matches lm_robust with fixed effects", {
skip_if_not_installed("car")

lhro <-
lh_robust(
Y ~ Z * X,
Expand All @@ -76,6 +80,8 @@ test_that("lh_robust matches lm_robust with fixed effects", {
})

test_that("lh_robust matches lm_robust with weights", {
skip_if_not_installed("car")

lhro <-
lh_robust(
Y ~ Z * X,
Expand All @@ -95,6 +101,8 @@ test_that("lh_robust matches lm_robust with weights", {
})

test_that("lh_robust matches lm_robust with subsetted data.frame", {
skip_if_not_installed("car")

lhro <-
lh_robust(Y ~ Z * X,
data = dat,
Expand All @@ -112,6 +120,8 @@ test_that("lh_robust matches lm_robust with subsetted data.frame", {
})

test_that("lh_robust matches lm_robust with subsetted data.frame", {
skip_if_not_installed("car")

lhro <-
lh_robust(Y ~ Z * X,
data = dat,
Expand Down
4 changes: 4 additions & 0 deletions tests/testthat/test-s3-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,8 @@ test_that("tidy, glance, summary, and print work", {

test_that("vcov works", {

skip_if_not_installed("AER")

# not identical due to < 1e-15 diffs
expect_equal(
vcov(lm_robust(y ~ x, data = dat, se_type = "classical")),
Expand Down Expand Up @@ -841,6 +843,8 @@ test_that("predict works with fixed effects", {

test_that("predict.iv_robust works with fixed effects", {

skip_if_not_installed("AER")

ro <- iv_robust(mpg ~ hp + factor(cyl) | vs + factor(cyl), data = mtcars)
rfo <- iv_robust(mpg ~ hp | vs, fixed_effects = ~ cyl, data = mtcars)
io <- AER::ivreg(mpg ~ hp + factor(cyl) | vs + factor(cyl), data = mtcars)
Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-stata-output.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ test_that("lm_robust matches stata", {

test_that("iv_robust matches stata", {

skip_if_not_installed("AER")

# write.csv(mtcars,
# file = 'tests/testthat/mtcars.csv',
# row.names = F)
Expand Down

0 comments on commit 6c0bc21

Please sign in to comment.