markmfredrickson / optmatch

Functions for optimal matching in R
https://markmfredrickson.github.io/optmatch
Other
47 stars 14 forks source link

exactMatch on unique variable crashes #149

Closed josherrickson closed 6 years ago

josherrickson commented 6 years ago
> exactMatch(pr ~ cost, data = nuclearplants)
[[1]]
[[1]]
[[1]]
....... <snipped a LOT of output>
[[1]]
[[1]]
[[1]]
Error: C stack usage  7969200 is too close to the limit

I believe this is due to exactMatch.R#L111 returning all empty vectors since nothing is eligible match. (This can also occur if the RHS variable is unique between Treatment/Control.)

josherrickson commented 6 years ago
> exactMatch(pr ~ cost, data = nuclearplants)
Error in .local(x, ...) :
  There is no overlap of value between treatment and control groups.

Closing. @benthestatistician feel free to suggest a better error message. See test.exactMatch.R#L255 for simpler examples of the two scenarios (truly unique X versus unique across groups).

benthestatistician commented 3 years ago

Commit 4f99c96 on branch issue206-NAs-in-blocking-vars updates this a bit. I think that if the user passed a character or factor variable with these odd characteristics, we should give her the benefit of the doubt and try to create the exact matching structure she requested, even if it forbids all matches. (And despite the fact that it may potentially cause the error given in the issue statement.)

(I thought this was a nice solution btw, particularly the test distinguishing two scenarios that aren't distinguished in the code.)