estimatr icon indicating copy to clipboard operation
estimatr copied to clipboard

Clusters & Fixed effects sometimes crashes R

Open NickCH-K opened this issue 5 years ago • 1 comments

I was preparing a class example and came across the following issue:

library(wooldridge)
data(mathpnl)

# This works fine
fe_cluster <- lm_robust(math4 ~ expp + lunch, fixed_effects = ~distid, data = mathpnl)

# This works fine
fe_cluster <- lm_robust(math4 ~ expp + lunch, clusters = distid, data = mathpnl)

# This refuses to converge, takes up a quickly-expanding amount of memory, and if allowed to run for long enough, crashes the computer
fe_cluster <- lm_robust(math4 ~ expp + lunch, fixed_effects = ~distid, clusters = distid, data = mathpnl)

Since clusters & FE works fine in other cases, I'm guessing there's something data-specific about why this isn't converging. I haven't been able to pin down exactly what that is, but still it is quite odd.

I've had estimatr-crashes-R errors in a few contexts (as in previous issues I've filed); it would be nice if there was some sort of nonconvergence catcher so that estimatr would let itself give up rather than leaking and crashing R/the computer.

NickCH-K avatar Aug 07 '20 00:08 NickCH-K

One thing I would also add for usability

  • Add a check for the interrupt signal in the do loops in C++, so that people can Ctrl-C instead of R hanging.

nfultz avatar Aug 07 '20 00:08 nfultz