-
Notifications
You must be signed in to change notification settings - Fork 28
Description
Hi, thanks for this great estimator. I encountered problems when I tried to add interaction terms into the regression estimated by "fect" function. I tried different ways:
Way 1:
out.mc <- fect(formula = DV ~ IV1 + IV2 + IV1:IV2 + controls,
data = df, index = c("newid", "year"), force = "two-way",
lambda = c(0.5), method = "mc", CV = TRUE, pre.period = NULL,
se = TRUE, nboots = 100, parallel = FALSE, seed = 9799)
The results did not report the coefficient of the interaction term but showed coefficients of IV1 and IV2.
Way2:
df <- transform(df, inter = IV1*IV2)
out.mc <- fect(formula = DV ~ IV1 + IV2 + inter + controls,
data = df, index = c("newid", "year"), force = "two-way",
lambda = c(0.5), method = "mc", CV = TRUE, pre.period = NULL,
se = TRUE, nboots = 100, parallel = FALSE, seed = 9799)
The results returned errors (copied below) and said interaction terms has collinearity issues. However, I did not see collinearity issues when estimating the regression with xtreg or reghdfe.
"The variable 'x.7' has been removed because of collinearity (see $collin.var).
Error in beta0CV[, , i] <- beta0cv :
number of items to replace is not a multiple of replacement length"
Could you help with this interaction issue? Many thanks in advance!