I'm estimating a series of country and year fixed-effects panel models using the felm function. I would like to calculate the number of countries included in each estimation. I can easily do this if I run my regressions using the plm function, as shown below. However, I don't want to run my regressions using plm for other reasons. Is there a way of calculating the number of id's used in a felm estimation?
a sample code is given below:
library(plm); library(lfe)
data("Grunfeld", package = "plm")
reg_plm <- plm(inv ~ value + capital, data = Grunfeld, model = "within", effect = "twoways")
reg_felm <- felm(inv ~ value + capital |
firm + year, data=Grunfeld)
pdim(reg_plm)[["panel.names"]]$id.names
Note that my data is an unbalanced panel and pdim does not work with a felm object.