I've described the issue identification in more detail on the tjbal issue page. To be short, there is a problem within ebalance_custom where the eb() function returns a vector of weights with one element equal to NA, another equal to one, and the rest equal to zero. This causes pX_D0w in get.dist to be assigned a value of NA. As a result, dist.now is assigned NA and this crashes KBAL because "if (dist.now < mindistsofar)" cannot be evaluated.
The proposed fix here adds the additional constraint that dist.now is not NA. In the case that dist.now is NA the fix will cause KBAL to exit the while loop and use the mindist that had be calculated up until dist.now returned NA.
I want to reiterate that this is a temporary fix for a root issue with eb() within the ebalance_custom() function. I apologize for not knowing what exactly the root issue is because I'm not certain why ebalance would return a weight equal to NA.
… KBAL
I've described the issue identification in more detail on the tjbal issue page. To be short, there is a problem within ebalance_custom where the eb() function returns a vector of weights with one element equal to NA, another equal to one, and the rest equal to zero. This causes pX_D0w in get.dist to be assigned a value of NA. As a result, dist.now is assigned NA and this crashes KBAL because "if (dist.now < mindistsofar)" cannot be evaluated.
The proposed fix here adds the additional constraint that dist.now is not NA. In the case that dist.now is NA the fix will cause KBAL to exit the while loop and use the mindist that had be calculated up until dist.now returned NA.
I want to reiterate that this is a temporary fix for a root issue with eb() within the ebalance_custom() function. I apologize for not knowing what exactly the root issue is because I'm not certain why ebalance would return a weight equal to NA.