diff --git a/.Rbuildignore b/.Rbuildignore index 6ed1d8a..4582170 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -9,3 +9,4 @@ man-roxygen cran-comments.md vignettes/REndo-introduction_cache ^\.github$ +^_pkgdown\.yml$ diff --git a/DESCRIPTION b/DESCRIPTION index 01188ac..7c0eac1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: REndo Title: Fitting Linear Models with Endogenous Regressors using Latent Instrumental Variables Type: Package -Version: 2.4.0 -Date: 2020-05-23 +Version: 2.4.1 +Date: 2020-10-12 Authors@R: c( person(given="Raluca", family="Gui", email = "raluca.gui@business.uzh.ch", role = c("cre","aut")), person(given="Markus", family="Meierer", email = "markus.meierer@business.uzh.ch", role = "aut"), @@ -41,5 +41,5 @@ Suggests: R.rsp LinkingTo: Rcpp, RcppEigen Encoding: UTF-8 -RoxygenNote: 7.1.0 +RoxygenNote: 7.1.1 VignetteBuilder: R.rsp diff --git a/NEWS.md b/NEWS.md index 6597733..76f3609 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,10 @@ +# REndo 2.4.1 + +## SIGNIFICANT USER-VISIBLE CHANGES +* Allow using the method `copulaCorrection` with a single endogenous regressor + + + # REndo 2.4.0 ## SIGNIFICANT USER-VISIBLE CHANGES diff --git a/R/f_checkinput_copulacorrection.R b/R/f_checkinput_copulacorrection.R index 9a584e7..7ef9755 100644 --- a/R/f_checkinput_copulacorrection.R +++ b/R/f_checkinput_copulacorrection.R @@ -60,9 +60,6 @@ checkinput_copulacorrection_formula <- function(formula){ if(num.specials.lhs > 0) err.msg <- c(err.msg, "Please specify no endogenous regressor in the left-hand side of the formula.") - # Check that not all RHS1 are endogenous - if(all(all.vars(formula(F.formula, rhs=1, lhs=0)) %in% c(names.vars.discrete, names.vars.continuous))) - err.msg <- c(err.msg, "Please do not specify all regressors as endogenous.") # Check that the specials contains no transformations / functions (ie discrete(log(P))) and are specified additively # allowed.names.rhs2 <- c("~", "+", "discrete", "continuous", all.vars(formula(F.formula, rhs=1, lhs=0))) diff --git a/_pkgdown.yml b/_pkgdown.yml new file mode 100644 index 0000000..27d31da --- /dev/null +++ b/_pkgdown.yml @@ -0,0 +1,3 @@ +template: + params: + ganalytics: UA-31477052-1 diff --git a/cran-comments.md b/cran-comments.md index 36ec173..dc4d682 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,8 +1,9 @@ # Comment from the authors -This is version 2.4.0 which adds formal tests of assumptions, performs improved checks of user-inputs, and considerably speeds up calculations of the LL function in method copulaCorrection by re-writing it in Rcpp and RcppEigen. +This is version 2.4.1 which newly allows to use the method copulaCorrection with a single endogenous regressor whereas before also exogenous regressors were required. ## Test environments -* local install on OS X 10.15.4, R 3.6.2, devtools 2.3.0 +* local install on OS X 10.15.4, R 4.0.1, devtools 2.3.1 +* github actions: win, osx, linux (release and devel) * win-builder (rdevel, release) * rhub (all) diff --git a/src/f_copulacorrection_LL_rcpp.cpp b/src/f_copulacorrection_LL_rcpp.cpp index 53a3198..5c763a2 100644 --- a/src/f_copulacorrection_LL_rcpp.cpp +++ b/src/f_copulacorrection_LL_rcpp.cpp @@ -38,8 +38,8 @@ double copulaCorrection_LL_rcpp(const NumericVector& params, // Short excursion to RcppEigen: Matrix multiplication - const Eigen::Map A = Rcpp::as>(m_data_exo_endo); - const Eigen::Map B = Rcpp::as>(params_endo_exo); + const Eigen::Map A = Rcpp::as >(m_data_exo_endo); + const Eigen::Map B = Rcpp::as >(params_endo_exo); // Math! and immediately back to regular Rcpp again NumericVector matMultRes = Rcpp::wrap(A*B); diff --git a/tests/testthat/test-inputchecks_copulacorrection.R b/tests/testthat/test-inputchecks_copulacorrection.R index 36ca65b..bcf7223 100644 --- a/tests/testthat/test-inputchecks_copulacorrection.R +++ b/tests/testthat/test-inputchecks_copulacorrection.R @@ -26,12 +26,6 @@ test_that("Fail if bad 2nd RHS", { expect_error(copulaCorrection(formula= y ~ y ~ X1 + X2 + P1|continuous(P1)+continuous(P2), data=dataCopCont2), regexp = "The above errors were encountered!") expect_error(copulaCorrection(formula= y ~ X1 + X2 + P2|continuous(P1)+continuous(P2), data=dataCopCont2), regexp = "The above errors were encountered!") - # Fail if all regressors are endogenous - expect_error(copulaCorrection(formula= y ~ P1|continuous(P1), data=dataCopCont2), regexp = "The above errors were encountered!") - expect_error(copulaCorrection(formula= y ~ P1+P2|continuous(P1)+continuous(P2), data=dataCopCont2), regexp = "The above errors were encountered!") - expect_error(copulaCorrection(formula= y ~ X1 + X2 + P2|continuous(X1)+continuous(X2)+continuous(P2), data=dataCopCont2), regexp = "The above errors were encountered!") - expect_error(copulaCorrection(formula= y ~ X1 + X2 + P2+P1|continuous(P1)+continuous(P2)+continuous(X1)+continuous(X2), data=dataCopCont2), regexp = "The above errors were encountered!") - # Fail if not exactly the same in model expect_error(copulaCorrection(formula= y ~ X1 + X2 + log(P1)|continuous(P1), data=dataCopCont2), regexp = "The above errors were encountered!") expect_error(copulaCorrection(formula= y ~ X1 + X2 + P1|continuous(log(P1)), data=dataCopCont2), regexp = "The above errors were encountered!")