Cesar,
The architecture behind Zelig4 was created (not by me mind) to allow developers who would
like to add models, an easier interface to Zelig. One of its key features is a
straightforward but capable method declaration that acts as a bridge. This declaration
allows the inclusion of a "hook" function. A hook allows you to take the output
from returned by the estimator function, and overwrite some portion of the results before
it is passed on to sim(). As an example, the negative binomial model overwrites the
standard errors that are generated by glm.nb() with robust standard errors (pragmatically
Wooldridge (2002, section 19.3.2 p.659) and Cameron and Trivedi (2009, section 17.3.3
p.563) both suggest robust standard errors for this particular negative binomial
estimator).
Take a look at the first function here:
https://github.com/IQSS/Zelig/blob/master/R/negbinom.R
which is:
zelig2negbinom <- function(formula, weights=NULL, ..., data)
z(
.function = "glm.nb",
.hook = "robust.glm.hook",
weights = weights,
formula = formula,
data = data
)
here you see .function is declaring the function for the estimator that the
"negbinom" model is using, and the .hook is pointing to a function that will
overwrite the standard errors. If you wanted to change the vcov matrix of modelX, you
could write a function to do this, my.new.vcov.hook and change the zelig2modelX function
to include ".hook="my.new.vcov.hook, "
The documentation is of course, a constant work in progress, and something I understand
will have significant revision over the next couple months. Take a look at section 1.4 of
the developer's manual, available on this page:
http://projects.iq.harvard.edu/zelig/documentation or more directly:
http://projects.iq.harvard.edu/zelig/files/booklet.pdf
Also, feel free to ask me any questions, either on or off list.
I hope you are very well. It's great to hear from you. Let me know if you have an
interesting application,
James.
--
James Honaker, Senior Research Scientist
//// Institute for Quantitative Social Science, Harvard University
________________________________________
From: zelig-bounces(a)lists.gking.harvard.edu [zelig-bounces(a)lists.gking.harvard.edu] On
Behalf Of Cesar Zucco [cesar.zucco(a)gmail.com]
Sent: Wednesday, February 20, 2013 12:04 PM
To: zelig(a)lists.gking.harvard.edu
Subject: [zelig] using alternate varcov matrix with sim()
Hello,
Can I supply a user defined variance-covariance matrix to sim()?
Suppose reg is some model zelig can run, such as
reg <- zelig(y~a+b,data=d,model="ls")
Then suppose I compute clustered standard errors using a user defined function cl(), which
returns both the clustered standard errors and an alternate variance-covariance matrix,
which we can call, respectively
cl.se
cl.vc
Now, I would like to compute quantities of interest as usual, but I would like sim() to
use cl.vc instead of vcov(reg).
Can this be done?
Thanks!
cz
-
--
Zelig Mailing List, served by HUIT
Send messages: zelig(a)lists.gking.harvard.edu
[un]subscribe Options:
http://lists.gking.harvard.edu/mailman/listinfo/zelig
Zelig program information:
http://gking.harvard.edu/zelig/
Zelig mailing list
Zelig(a)lists.gking.harvard.edu
To unsubscribe from this list or get other information:
https://lists.gking.harvard.edu/mailman/listinfo/zelig