I am using the plm library to run fixed effect regressions and the sandwich,lmtest libraries to compute robust standard errors. I have no problem running the regressions, but in some instances when I go to compute the standard errors I get the following error:
library(plm)
library(sandwich)
library(lmtest)
fe_reg <- plm(y ~ x + I(x^2)+factor(date), data=reg_data, index=c("id","date"), model="within")
coeftest(fe_reg, vcov.=vcovHC(fe_reg, type="HC1"))
RRuntimeError: Error in solve.default(crossprod(demX))
system is computationally singular: reciprocal condition number = 1.84726e-25
I do not have any problems computing the coefficients or the "normal" standard errors (ie homoscedastic). Also, I have no problem computing the robust standard errors when I omit the quadratic term:
fe_reg <- plm(y ~ x +factor(date), data=reg_data, index=c("id","date"), model="within")
Anyone have any idea what is going on? If the design matrix were singular then the coefficients should not have been computed, so I don't understand where the issue is coming from when computing the standard errors.
Thanks!