From 4053672cdbde47223f82cd7071cda9bd2ed960fa Mon Sep 17 00:00:00 2001 From: Mauricio Caceres Date: Wed, 8 Nov 2023 17:05:12 -0500 Subject: [PATCH] #47 .lp_conditional_test_fn sets fullRank_flag=F if X_TB has 0 rows --- R/arp-nuisance.R | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/R/arp-nuisance.R b/R/arp-nuisance.R index e27a00c..9b6e062 100644 --- a/R/arp-nuisance.R +++ b/R/arp-nuisance.R @@ -515,11 +515,12 @@ B_index = (linSoln$lambda > tol_lambda) Bc_index = (B_index == FALSE) X_TB = base::matrix( X_T_ARP[B_index,], ncol = base::ncol(X_T_ARP) ) # select binding moments + Xdim = base::min(base::dim(X_TB)) # Check whether binding moments have full rank. - if (base::is.vector(X_TB)) { + if (base::is.vector(X_TB) | (Xdim == 0)) { fullRank_flag = FALSE } else { - fullRank_flag = (Matrix::rankMatrix(X_TB) == base::min(base::dim( X_TB ) )) + fullRank_flag = (Matrix::rankMatrix(X_TB) == Xdim) } # If degenerate or binding moments don't have full rank, switch to dual