estimatr
estimatr copied to clipboard
if `y` has no column names, `lm_robust_fit` fails to `tidy`
library(DeclareDesign)
dat <-
fabricate(N = 100,
Z = complete_ra(N),
Y = .9 * X + .2 * Z + rnorm(N))
fit <-
lm_robust_fit(
y = dat$Y,
X = matrix(dat$Z),
weights = NULL,
ci = FALSE,
cluster = NULL,
alpha = 0.05,
se_type = "none",
return_vcov = FALSE,
try_cholesky = FALSE,
has_int = TRUE
)
tidy(fit)
Should force y
to have column names and should test S3 methods on lm_robust_fit
since it will remain exported.
lm_robust_fit is not the friendly one iirc - agree that this is low priority - error checking / warnings etc belongs in lm_robust.
To the extent that tidy fails, if there is no colname provided to lm_robust, maybe just set it to Y.
lm_robust assigns a colname via model.matrix
, so even if you pass it a matrix with no names it works. It's just lm_robust_fit, and you're correct I just need to set a colname to Y (and Y1, Y2, ... YN if there are N outcomes).