Closed victorn1 closed 5 years ago
If I take a constant independent variable, I get the error Error in relevel.factor(C[[i]], levels(C[[i]])[2]) : 'ref' must be an existing level
Code to reproduce the problem:
n=20 a=sample(2,n,replace=T)-1 b=runif(n) c=rep(0,n) l=glm(a~b+c) matched=sample(2,n,replace=T)-1 b1=bal.tab(a~b+c,weights=matched,method="matching",s.d.denom="pooled")
Previous versions of Cobalt just silently removed constant variables from the analysis. The most convenient way may be that constant variables are removed with a warning, so that the script is not stopped.
Thank you for finding this! Fixed!
If I take a constant independent variable, I get the error Error in relevel.factor(C[[i]], levels(C[[i]])[2]) : 'ref' must be an existing level
Code to reproduce the problem:
Previous versions of Cobalt just silently removed constant variables from the analysis. The most convenient way may be that constant variables are removed with a warning, so that the script is not stopped.