Skip to content

Commit

Permalink
Release 2.4.1 (#56)
Browse files Browse the repository at this point in the history
* Add GA token to gh-pages
* copulaCorrection: allow single endogenous regressor
  • Loading branch information
pschil authored Jan 28, 2021
1 parent fe6215b commit 450988d
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 16 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ man-roxygen
cran-comments.md
vignettes/REndo-introduction_cache
^\.github$
^_pkgdown\.yml$
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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"),
Expand Down Expand Up @@ -41,5 +41,5 @@ Suggests:
R.rsp
LinkingTo: Rcpp, RcppEigen
Encoding: UTF-8
RoxygenNote: 7.1.0
RoxygenNote: 7.1.1
VignetteBuilder: R.rsp
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 0 additions & 3 deletions R/f_checkinput_copulacorrection.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down
3 changes: 3 additions & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
template:
params:
ganalytics: UA-31477052-1
5 changes: 3 additions & 2 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
4 changes: 2 additions & 2 deletions src/f_copulacorrection_LL_rcpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ double copulaCorrection_LL_rcpp(const NumericVector& params,


// Short excursion to RcppEigen: Matrix multiplication
const Eigen::Map<Eigen::MatrixXd> A = Rcpp::as<Eigen::Map<Eigen::MatrixXd>>(m_data_exo_endo);
const Eigen::Map<Eigen::VectorXd> B = Rcpp::as<Eigen::Map<Eigen::VectorXd>>(params_endo_exo);
const Eigen::Map<Eigen::MatrixXd> A = Rcpp::as<Eigen::Map<Eigen::MatrixXd> >(m_data_exo_endo);
const Eigen::Map<Eigen::VectorXd> B = Rcpp::as<Eigen::Map<Eigen::VectorXd> >(params_endo_exo);

// Math! and immediately back to regular Rcpp again
NumericVector matMultRes = Rcpp::wrap(A*B);
Expand Down
6 changes: 0 additions & 6 deletions tests/testthat/test-inputchecks_copulacorrection.R
Original file line number Diff line number Diff line change
Expand Up @@ -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!")
Expand Down

0 comments on commit 450988d

Please sign in to comment.