Rogério,
I'm currently changing/fixing/addressing the issue of weights across Zelig.
I've just included weights in the "mlogit" model you requested, in the
current Beta available as:
install.packages("ZeligChoice", repos="http://r.iq.harvard.edu",
type="source")
Three current caveats: [1] these weights in the mlogit model right now are looking for a
vector of weights (of same length as the dataset). So in your code example, use
...weights=mexico$age, not ...weights="age". For backwards compatibility, the
weights will shortly also accept a variable name in the dataset, just not presently. [2]
You can't have zero valued weights presently (again this will shortly change), so if
you have zeros (for example, if your weights are from matching) then set those weights to
a tiny number like 1.0e-8, or remove those observations from the dataset before passing
the data to Zelig. [3] Setx() does not currently pay attention to your weights, which
just means that when some variables are automatically set to their means, those will be
the unweighted means, not the weighted means.
Again, those three points will be resolved in the coming days (for all models in Zelig and
ZeligChoice), but since you wrote about this function, I thought I'd try to get it up
working in its preliminary state for you.
Best,
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 Rogério Barbosa [antrologos(a)gmail.com]
Sent: Friday, May 10, 2013 9:17 AM
To: Owen, Matthew; zelig(a)lists.gking.harvard.edu
Subject: Re: [zelig] Weighted Multinomial Logistic
Hi Matt, (cc Zelig List)
After a long time, I'm writing to you again... concerning to the same issue. Just
recalling: I needed to use weights in a mlogit model. By the time Zelig's multinomial
function was that one from "Multinomial" package. I was trying to implement
mlogit function from VGAM (vglm) into Zelig through zelig2. But my dead line was close...
so I gave up trying to figure out how to do that at that time.
It seems now Zelig uses exactly the function from VGAM. And vglm allows weights. So I
runned two mlogit models. See below:
###########################################
library(Zelig)
library(ZeligChoice)
z.out1 = zelig(as.factor(vote88)~pristr + othcok, model="mlogit", data=mexico)
z.out2 = zelig(as.factor(vote88)~pristr + othcok, model="mlogit",
weights=~age,data=mexico) #age is being used as weights just for the sake of example
summary(z.out1)
summary(z.out2)
###########################################
The results of the two model are exactly the same. In other words, the weights are not
working. Am I getting something wrong?
thanks for you attention and help,
best regards,
----
H Jerônimo Barbosa
Sociology PhD Student at USP - São Paulo, Brazil
Researcher at Center for Metropolitan Studies (Cem/Cebrap)
On Mon, Sep 17, 2012 at 4:21 PM, Matt Owen
<mowen@iq.harvard.edu<mailto:mowen@iq.harvard.edu>> wrote:
Can you give a particular example of what you are trying to accomplish?
I ran the following (as a test) with no issue:
library(Zelig)
data(mexico)
zelig(as.factor(vote88) ~ pristr + othcok + othsocok, model = "mlogit", weights
= 1:10, data = mexico[1:10, ])
On Sep 17, 2012, at 11:25 AM, Rogério Barbosa wrote:
Hey Matt,
Is it possible to use Zelig2 to implement vglm, as I was trying to do? If yes, how can it
be done?
Best,
R.
On Mon, Sep 17, 2012 at 12:03 PM, Matt Owen
<mowen@iq.harvard.edu<mailto:mowen@iq.harvard.edu>> wrote:
Zelig's "mlogit" currently does not support the weights parameter. This has
been added as a feature request here:
https://github.com/zeligdev/ZeligMultinomial/issues/1
On Sep 17, 2012, at 10:54 AM, Rogério Barbosa wrote:
Hi,
I'm trying to run a weighted multinomial logistic -- but "mlogit" family
doesn't allow weights... I tryed to implement an external function from VGAM package
not multinomial() -- which seems to be the Zelig's built-in; but vglm() ] using
Zelig2... But I'm couldn't make it work.
Is there any other way to use weights in a mlogit?
thanks,
Rogério J. Barbosa
Researcher at Centre for Metropolitan Studies/Cebrap
São Paulo - Brazil -
--
Zelig Mailing List, served by HUIT
Send messages: zelig@lists.gking.harvard.edu<mailto:zelig@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@lists.gking.harvard.edu<mailto:Zelig@lists.gking.harvard.edu>
https://lists.gking.harvard.edu/mailman/listinfo/zelig