Running examples in ‘estimatr-Ex.R’ failed
The error most likely occurred in:

> ### Name: iv_robust
> ### Title: Two-Stage Least Squares Instrumental Variables Regression
> ### Aliases: iv_robust
> 
> ### ** Examples
> 
> library(fabricatr)
> dat <- fabricate(
+   N = 40,
+   Y = rpois(N, lambda = 4),
+   Z = rbinom(N, 1, prob = 0.4),
+   D  = Z * rbinom(N, 1, prob = 0.8),
+   X = rnorm(N),
+   G = sample(letters[1:4], N, replace = TRUE)
+ )
> 
> # Instrument for treatment `D` with encouragement `Z`
> tidy(iv_robust(Y ~ D + X | Z + X, data = dat))
         term   estimate std.error  statistic      p.value  conf.low conf.high
1 (Intercept)  4.1844199 0.4737009  8.8334635 1.204381e-10  3.224611 5.1442292
2           D -0.1806666 0.6563979 -0.2752394 7.846636e-01 -1.510655 1.1493219
3           X -0.3353374 0.3159417 -1.0613901 2.953919e-01 -0.975496 0.3048213
  df outcome
1 37       Y
2 37       Y
3 37       Y
> 
> # Instrument with Stata's `ivregress 2sls , small rob` HC1 variance
> tidy(iv_robust(Y ~ D | Z, data = dat, se_type = "stata"))
         term   estimate std.error  statistic      p.value  conf.low conf.high
1 (Intercept)  4.1739130 0.4663684  8.9498203 6.786988e-11  3.229800  5.118026
2           D -0.2472826 0.6576307 -0.3760205 7.089929e-01 -1.578586  1.084021
  df outcome
1 38       Y
2 38       Y
> 
> # With clusters, we use CR2 errors by default
> dat$cl <- rep(letters[1:5], length.out = nrow(dat))
> tidy(iv_robust(Y ~ D | Z, data = dat, clusters = cl))
         term   estimate std.error  statistic      p.value  conf.low conf.high
1 (Intercept)  4.1739130 0.3799258 10.9861279 0.0004679073  3.104427  5.243399
2           D -0.2472826 0.8908011 -0.2775958 0.7951441307 -2.725386  2.230820
        df outcome
1 3.865421       Y
2 3.980269       Y
> 
> # Again, easy to replicate Stata (again with `small` correction in Stata)
> tidy(iv_robust(Y ~ D | Z, data = dat, clusters = cl, se_type = "stata"))
         term   estimate std.error  statistic      p.value  conf.low conf.high
1 (Intercept)  4.1739130 0.3778202 11.0473522 0.0003817331  3.124916  5.222910
2           D -0.2472826 0.8893636 -0.2780444 0.7947585341 -2.716552  2.221987
  df outcome
1  4       Y
2  4       Y
> 
> # We can also specify fixed effects, that will be taken as exogenous regressors
> # Speed gains with fixed effects are greatests with "stata" or "HC1" std.errors
> tidy(iv_robust(Y ~ D | Z, data = dat, fixed_effects = ~ G, se_type = "HC1"))

 *** caught segfault ***
address fd18bd59, cause 'memory not mapped'

Traceback:
 1: demeanMat(Y = as.matrix(model_data[["outcome"]]), X = model_data[["design_matrix"]],     Zmat = model_data[["instrument_matrix"]], fes = model_data[["fixed_effects"]],     weights = if (is.numeric(model_data[["weights"]])) model_data[["weights"]] else rep(1,         nrow(model_data[["design_matrix"]])), has_int = attr(model_data$terms,         "intercept"), eps = 1e-08)
 2: demean_fes(model_data)
 3: iv_robust(Y ~ D | Z, data = dat, fixed_effects = ~G, se_type = "HC1")
 4: tidy(iv_robust(Y ~ D | Z, data = dat, fixed_effects = ~G, se_type = "HC1"))
An irrecoverable exception occurred. R is aborting now ...