I'm trying to find a way to
have country clusters in a relogit analysis.
I have country-year data
and the countries are grouped
by a numeric id variable "cid".
I've tried including a list
of options for robust such that my model is:
M1 <- zelig(violence ~ dem_age,
model = "relogit", tau = 88/5480,
data = data,
robust = list(
method =
"vcovHAC",
order.by = ~data$cid,
adjust = TRUE
))
However why I run "summary(M1)" I get an error:
Error in meatHAC
(x, order.by = order.by, prewhite = prewhite, weights = weights, :
subscript out of bounds
Any thoughts on what is going on?
ReLogit for zelig would be really useful if it could incorporate clusters.
Thanks
Christopher
Christopher <c.gandrud@...> writes:
robust = list( . . . ) only works for relogit if the data
does not have any missing values.
So, before
running the model the data needs to be
subsetted to only have complet cases.
This can be done simply
by using the command "complete.cases" from the stats package.
For example with a data frame called
"df":
df.complete <- df[complete.cases(df),]
Next issue: If you are interested in country
(i.e. unordered) groups of correlated data
method = "weave"
seems to make the most sense. It isn't perfectly comparable to
relogit y x, cluster(country)
in stata, but the standard errors seem to be closer then the
vcocHAC or kernHAC methods (the other
two methods relogit allows you to specify).
I believe this is because weave is based on Lumley and
Heagerty's (1999) approach,
which doesn't assume a particular dependence
structure to the correlated
data.
It would be helpful if someone with more
expertise could clarify this.
Anyways, the closest way to approximate
traditional country clusters with
relogit output is to run
ianglow's coeftest.cluster function on the fitted
relogit zelig model. You can find it here:
http://iangow.wordpress.com/2012/01/19/
iv-regression-and-two-way-cluster-robust-standard-
errors/
However, the output from this function
is of the coeftest
class and doesn't have the typical zelig
advantages,
e.g. ability to easily simulate quantities of interest or
simple integration with LaTeX through
mtable in the memisc package.