I'm using the alpaca package (feglm) to specify a FE model, with individuals nested within states:
logit1 <- feglm(response ~ var1 + var2 + var3 | state,
data = maindata,
family = binomial(link = "logit")
)
I can specify clustering using the summary argument:
summary(logit1, type = "sandwich", cluster = "state")
but ideally I would like to be able to do this within the equation itself, because summary generates a summary.feglm object and I'm having some trouble using that for other things.
I've tried a couple of methods, something like this:
logit1 <- feglm(response ~ var1 + var2 + var3 | state,
data = maindata,
family = binomial(link = "logit"),
vcov = "cluster",
cluster = "state"
)
but I always get an error that the arguments are not used, so I'm a bit stuck.
Does anyone have any suggestions for how to do this?