R package ebal for Entropy Balancing: Error message

102 views Asked by At

I use the R package ebal for calculation of weights between treatment group and control group.

The package version is

> packageVersion("ebal")
[1] ‘0.1.8’

After 21 iterations the process stopped with the following error message:

Iteration 1 maximum deviation is = 725,777,997 
new loss 368351536 old loss= 725777997 

Iteration 2 maximum deviation is = 368,351,536 
new loss 3.641804e+199 old loss= 368351536 
LS Step Length is  6.770353e-05 
Loss is 368360898 

...

Iteration 19 maximum deviation is = 211,453,719
new loss 615965613 old loss= 211453719 
LS Step Length is  0.001065976 
Loss is 211885123 

Iteration 20 maximum deviation is = 211,885,123 
new loss 394660098 old loss= 211885123 
LS Step Length is  0.000346154 
Loss is 212104989 

Iteration 21 maximum deviation is = 212,104,989 
new loss NaN old loss= 212104989 

Error in if (loss.old <= loss.new) { : 
    missing value where TRUE/FALSE needed

I assume it has to do with the target means for the covariate distributions. But I have no idea how to deal with it. Could someone explain the error massage of ebal?

The doc ebal: Entropy Reweighting to Create Balanced Samples doesn't contain any information about the errors.

1

There are 1 answers

3
jay.sf On BEST ANSWER

I suspect either loss.old or loss.new becoming NA in line 40 of ebal::eb which ebal::ebalance is using internally.

> loss.old <- 0
> loss.new <- NA
> if (loss.old <= loss.new) {}
Error in if (loss.old <= loss.new) { : 
  missing value where TRUE/FALSE needed

The author might have overseen that possibility and couldn't provide a better error message. Try make it reproducible an file an issue at their GitHub.