When I want to specify my own robust standard errors in a regression command like plm, how do I do this directly without running several functions?
library("plm")
library("lmtest")
Data <- iris
Data$time <- as.numeric(rep(1951:2000,3))
here is what I would run in plm:
regression <- plm(Sepal.Length ~ Sepal.Width + Petal.Length,
data = Data,
index = c("Species", "time"),
model = "within",
effect = "twoways")
now say I'd like a covariance matrix which clusters at the individual (species level):
results <- coeftest(regression,vcov=vcovHC(regression,type="HC0",cluster="group"))
My question is how I can include these standard errors directly in plm
without having to run it first. This is not a big deal as the covariance matrix is calculated in a separate step anyways but would feel more elegant.