oh great. we welcome this kind of contributions! please send us your code
if you want it to be included in Zelig.
Thanks!
Kosuke
--
Department of Politics
Princeton University
http://imai.princeton.edu
On Sun, 28 Sep 2008, Jeroen Ooms wrote:
> Ah you mean it that way. That would indeed give me the information I
> need. However, the reason I want this is because I am creating a
> graphical webinterface for zelig in which I would like to show the
> user an anova-like table of the predictors in the model and their
> significance values.
>
> Doing this by manually like you suggest would mean that an additional
> model has to be fitted for every predictor to check for its
> significance. A method like drop1(), that automatically does this for
> all predictors in the model and returns a nice result table would be
> preferred ofcourse. I already implemented drop1() for the normal,
> poisson and logit model, and I hoped (still do :) a similar function
> to be available for mlogit.
>
> thank you.
>
>
> Jeroen
>
>
>
>
>
> On Sun, Sep 28, 2008 at 8:20 PM, Kosuke Imai <kimai(a)princeton.edu> wrote:
>> My suggestion was that you can simply run a submodel and then do summary()
>> to get the residual deviance. The comparison of this number with the
>> residual deviance of the full model will give you what you want, I think.
>>
>> Kosuke
>>
>> --
>> Department of Politics
>> Princeton University
>> http://imai.princeton.edu
>>
>> On Sun, 28 Sep 2008, Jeroen Ooms wrote:
>>
>>> A summary(z.out) does not tell me the increase in deviance when one of
>>> the predictors would be removed from the model, as drop1() does, and
>>> as is often of interest to applied researchers.
>>>
>>> This information is different from the p-values of the seperate
>>> parameters, because multiple parameters can be estimated for one
>>> single term, for example when either the term itself or dependent
>>> variable is a factor with more than 2 levels.
>>>
>>>
>>> Jeroen
>>>
>>>
>>>
>>> On Sun, Sep 28, 2008 at 6:54 PM, Kosuke Imai <kimai(a)princeton.edu> wrote:
>>>>
>>>> even if anova() command does not work for mlogit, all necessary
>>>> informaition
>>>> (residual deviance and degrees of freedom) is available in
>>>> summary(z.out1).
>>>>
>>>> Kosuke
>>>>
>>>> --
>>>> Department of Politics
>>>> Princeton University
>>>> http://imai.princeton.edu
>>>>
>>>> On Sat, 27 Sep 2008, Jeroen Ooms wrote:
>>>>
>>>>> Thank you very much. I was assuming the as.factor() was not necessary
>>>>> when the variable already is a factor, but I should have read more
>>>>> carefully.
>>>>>
>>>>> Another question about the mlogit model: is it possible to perform
>>>>> some kind of variance analysis on the predictors of the model? For
>>>>> example, if I fitted the model <COLOR~AGE+RACE, model=mlogit> in which
>>>>> color is someones favorite color, and I wish to answer the question:
>>>>> does race significantly predict someones favorite color? So I would
>>>>> like to do an omnibus test for all parameters fitted for the term
>>>>> 'race', which are (color-1)*(race-1) parameters in the mlogit case if
>>>>> I'm not mistaken.
>>>>>
>>>>> For normal and logit model I implemented this using the SS type 3,
>>>>> using the drop1 function (which calculates the decrease in LR when the
>>>>> term would be dropped from the model). For example:
>>>>>
>>>>> data(mexico);
>>>>> options(contrasts=c("contr.sum", "contr.poly"));
>>>>>
>>>>> z.out1 <- zelig(age ~ pristr + factor(othcok) + othsocok,model =
>>>>> "normal", data = mexico)
>>>>> drop1(z.out1,attributes(z.out1$terms)$term.labels,test="Chisq");
>>>>>
>>>>> z.out2 <- zelig(as.factor(vote88) ~ pristr + factor(othcok) +
>>>>> othsocok, model = "mlogit", data = mexico)
>>>>> drop1(z.out2,attributes(z.out2$terms)$term.labels,test="Chisq");
>>>>>
>>>>> anova() and aov() give similar errors for mlogit models. Is there any
>>>>> other way to perform a per-term variance analysis, or doesn't this
>>>>> make any sense?
>>>>>
>>>>>
>>>>> Thank you!
>>>>>
>>>>> Jeroen
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> is it possible perform some kind of variance analysis on the
>>>>> predictors of a fitted mlogit model?
>>>>>
>>>>> On Fri, Sep 26, 2008 at 5:54 PM, Ferdinand Alimadhi
>>>>> <falimadhi(a)iq.harvard.edu> wrote:
>>>>>>
>>>>>> Hi Jeroen,
>>>>>> Can you try to use :
>>>>>>
>>>>>> mymodel<- zelig(as.factor(RACE)~AGE+REGION,data=US1991,model="mlogit")
>>>>>>
>>>>>> Zelig needs to know when the same formula is used for each level
>>>>>> (as.factor()) or different formulas for each level (id())
>>>>>>
>>>>>> http://gking.harvard.edu/zelig/docs/mlogit.pdf
>>>>>>
>>>>>> Thanks,
>>>>>> Ferdi
>>>>>>
>>>>>>
>>>>>> Jeroen Ooms wrote:
>>>>>>
>>>>>> The mlogit model returns an error:
>>>>>>
>>>>>>
>>>>>>
>>>>>> mymodel<- zelig(RACE~AGE+REGION,data=US1991,model="mlogit")
>>>>>>
>>>>>>
>>>>>> Error in attr(tt, "depFactors")$depFactorVar :
>>>>>> $ operator is invalid for atomic vectors
>>>>>>
>>>>>> I think it is a problem with the VGAM package. According to this topic
>>>>>> <http://tolstoy.newcastle.edu.au/R/e3/help/07/12/5772.html> using $ on
>>>>>> an atomic vector raises a warning sinsce R2.5.0 and an error since R
>>>>>> 2.7.2.
>>>>>> However, the VGAM package has been updated at 2008-05-14 so I
>>>>>> dont understand why it would not be fixed. Am I doing something wrong?
>>>>>> I am using R version 2.7.2 (2008-08-25), VGAM_0.7-7, Zelig_3.3-1.
>>>>>>
>>>>>> VGAM is giving a lot of warnings when it is loaded, could there be
>>>>>> some conflict?
>>>>>>
>>>>>> Attaching package: 'VGAM'
>>>>>>
>>>>>> The following object(s) are masked from package:splines :
>>>>>> bs,
>>>>>> ns
>>>>>>
>>>>>> The following object(s) are masked from package:boot :
>>>>>> logit,
>>>>>> simplex
>>>>>>
>>>>>> The following object(s) are masked from package:stats :
>>>>>> biplot,
>>>>>> coefficients,
>>>>>> deviance,
>>>>>> df.residual,
>>>>>> effects,
>>>>>> fitted,
>>>>>> fitted.values,
>>>>>> poly,
>>>>>> predict,
>>>>>> resid,
>>>>>> residuals,
>>>>>> weights
>>>>>>
>>>>>> The following object(s) are masked from package:graphics :
>>>>>> persp
>>>>>>
>>>>>>
>>>>>> The following object(s) are masked from package:base :
>>>>>> identity,
>>>>>> scale.default
>>>>>>
>>>>>> -
>>>>>> Zelig Mailing List, served by Harvard-MIT Data Center
>>>>>> Send messages: zelig(a)lists.gking.harvard.edu
>>>>>> [un]subscribe Options: http://lists.gking.harvard.edu/?info=zelig
>>>>>> Zelig program information: http://gking.harvard.edu/zelig/
>>>>>>
>>>>>>
>>>>>
>>>>> -
>>>>> Zelig Mailing List, served by Harvard-MIT Data Center
>>>>> Send messages: zelig(a)lists.gking.harvard.edu
>>>>> [un]subscribe Options: http://lists.gking.harvard.edu/?info=zelig
>>>>> Zelig program information: http://gking.harvard.edu/zelig/
>>>>>
>>>>
>>>
>>
>
-
Zelig Mailing List, served by Harvard-MIT Data Center
Send messages: zelig(a)lists.gking.harvard.edu
[un]subscribe Options: http://lists.gking.harvard.edu/?info=zelig
Zelig program information: http://gking.harvard.edu/zelig/
My suggestion was that you can simply run a submodel and then do summary()
to get the residual deviance. The comparison of this number with the
residual deviance of the full model will give you what you want, I think.
Kosuke
--
Department of Politics
Princeton University
http://imai.princeton.edu
On Sun, 28 Sep 2008, Jeroen Ooms wrote:
> A summary(z.out) does not tell me the increase in deviance when one of
> the predictors would be removed from the model, as drop1() does, and
> as is often of interest to applied researchers.
>
> This information is different from the p-values of the seperate
> parameters, because multiple parameters can be estimated for one
> single term, for example when either the term itself or dependent
> variable is a factor with more than 2 levels.
>
>
> Jeroen
>
>
>
> On Sun, Sep 28, 2008 at 6:54 PM, Kosuke Imai <kimai(a)princeton.edu> wrote:
>> even if anova() command does not work for mlogit, all necessary informaition
>> (residual deviance and degrees of freedom) is available in summary(z.out1).
>>
>> Kosuke
>>
>> --
>> Department of Politics
>> Princeton University
>> http://imai.princeton.edu
>>
>> On Sat, 27 Sep 2008, Jeroen Ooms wrote:
>>
>>> Thank you very much. I was assuming the as.factor() was not necessary
>>> when the variable already is a factor, but I should have read more
>>> carefully.
>>>
>>> Another question about the mlogit model: is it possible to perform
>>> some kind of variance analysis on the predictors of the model? For
>>> example, if I fitted the model <COLOR~AGE+RACE, model=mlogit> in which
>>> color is someones favorite color, and I wish to answer the question:
>>> does race significantly predict someones favorite color? So I would
>>> like to do an omnibus test for all parameters fitted for the term
>>> 'race', which are (color-1)*(race-1) parameters in the mlogit case if
>>> I'm not mistaken.
>>>
>>> For normal and logit model I implemented this using the SS type 3,
>>> using the drop1 function (which calculates the decrease in LR when the
>>> term would be dropped from the model). For example:
>>>
>>> data(mexico);
>>> options(contrasts=c("contr.sum", "contr.poly"));
>>>
>>> z.out1 <- zelig(age ~ pristr + factor(othcok) + othsocok,model =
>>> "normal", data = mexico)
>>> drop1(z.out1,attributes(z.out1$terms)$term.labels,test="Chisq");
>>>
>>> z.out2 <- zelig(as.factor(vote88) ~ pristr + factor(othcok) +
>>> othsocok, model = "mlogit", data = mexico)
>>> drop1(z.out2,attributes(z.out2$terms)$term.labels,test="Chisq");
>>>
>>> anova() and aov() give similar errors for mlogit models. Is there any
>>> other way to perform a per-term variance analysis, or doesn't this
>>> make any sense?
>>>
>>>
>>> Thank you!
>>>
>>> Jeroen
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> is it possible perform some kind of variance analysis on the
>>> predictors of a fitted mlogit model?
>>>
>>> On Fri, Sep 26, 2008 at 5:54 PM, Ferdinand Alimadhi
>>> <falimadhi(a)iq.harvard.edu> wrote:
>>>>
>>>> Hi Jeroen,
>>>> Can you try to use :
>>>>
>>>> mymodel<- zelig(as.factor(RACE)~AGE+REGION,data=US1991,model="mlogit")
>>>>
>>>> Zelig needs to know when the same formula is used for each level
>>>> (as.factor()) or different formulas for each level (id())
>>>>
>>>> http://gking.harvard.edu/zelig/docs/mlogit.pdf
>>>>
>>>> Thanks,
>>>> Ferdi
>>>>
>>>>
>>>> Jeroen Ooms wrote:
>>>>
>>>> The mlogit model returns an error:
>>>>
>>>>
>>>>
>>>> mymodel<- zelig(RACE~AGE+REGION,data=US1991,model="mlogit")
>>>>
>>>>
>>>> Error in attr(tt, "depFactors")$depFactorVar :
>>>> $ operator is invalid for atomic vectors
>>>>
>>>> I think it is a problem with the VGAM package. According to this topic
>>>> <http://tolstoy.newcastle.edu.au/R/e3/help/07/12/5772.html> using $ on
>>>> an atomic vector raises a warning sinsce R2.5.0 and an error since R
>>>> 2.7.2.
>>>> However, the VGAM package has been updated at 2008-05-14 so I
>>>> dont understand why it would not be fixed. Am I doing something wrong?
>>>> I am using R version 2.7.2 (2008-08-25), VGAM_0.7-7, Zelig_3.3-1.
>>>>
>>>> VGAM is giving a lot of warnings when it is loaded, could there be
>>>> some conflict?
>>>>
>>>> Attaching package: 'VGAM'
>>>>
>>>> The following object(s) are masked from package:splines :
>>>> bs,
>>>> ns
>>>>
>>>> The following object(s) are masked from package:boot :
>>>> logit,
>>>> simplex
>>>>
>>>> The following object(s) are masked from package:stats :
>>>> biplot,
>>>> coefficients,
>>>> deviance,
>>>> df.residual,
>>>> effects,
>>>> fitted,
>>>> fitted.values,
>>>> poly,
>>>> predict,
>>>> resid,
>>>> residuals,
>>>> weights
>>>>
>>>> The following object(s) are masked from package:graphics :
>>>> persp
>>>>
>>>>
>>>> The following object(s) are masked from package:base :
>>>> identity,
>>>> scale.default
>>>>
>>>> -
>>>> Zelig Mailing List, served by Harvard-MIT Data Center
>>>> Send messages: zelig(a)lists.gking.harvard.edu
>>>> [un]subscribe Options: http://lists.gking.harvard.edu/?info=zelig
>>>> Zelig program information: http://gking.harvard.edu/zelig/
>>>>
>>>>
>>>
>>> -
>>> Zelig Mailing List, served by Harvard-MIT Data Center
>>> Send messages: zelig(a)lists.gking.harvard.edu
>>> [un]subscribe Options: http://lists.gking.harvard.edu/?info=zelig
>>> Zelig program information: http://gking.harvard.edu/zelig/
>>>
>>
>
-
Zelig Mailing List, served by Harvard-MIT Data Center
Send messages: zelig(a)lists.gking.harvard.edu
[un]subscribe Options: http://lists.gking.harvard.edu/?info=zelig
Zelig program information: http://gking.harvard.edu/zelig/
The mlogit model returns an error:
> mymodel<- zelig(RACE~AGE+REGION,data=US1991,model="mlogit")
Error in attr(tt, "depFactors")$depFactorVar :
$ operator is invalid for atomic vectors
I think it is a problem with the VGAM package. According to this topic
<http://tolstoy.newcastle.edu.au/R/e3/help/07/12/5772.html> using $ on
an atomic vector raises a warning sinsce R2.5.0 and an error since R
2.7.2. However, the VGAM package has been updated at 2008-05-14 so I
dont understand why it would not be fixed. Am I doing something wrong?
I am using R version 2.7.2 (2008-08-25), VGAM_0.7-7, Zelig_3.3-1.
VGAM is giving a lot of warnings when it is loaded, could there be
some conflict?
Attaching package: 'VGAM'
The following object(s) are masked from package:splines :
bs,
ns
The following object(s) are masked from package:boot :
logit,
simplex
The following object(s) are masked from package:stats :
biplot,
coefficients,
deviance,
df.residual,
effects,
fitted,
fitted.values,
poly,
predict,
resid,
residuals,
weights
The following object(s) are masked from package:graphics :
persp
The following object(s) are masked from package:base :
identity,
scale.default
-
Zelig Mailing List, served by Harvard-MIT Data Center
Send messages: zelig(a)lists.gking.harvard.edu
[un]subscribe Options: http://lists.gking.harvard.edu/?info=zelig
Zelig program information: http://gking.harvard.edu/zelig/
Dear All,
I am running Zelig 3.3.1 (the latest version) on R 2.7.2 and LME4
0.999375-26. When I tried to run "demo(logit.mixed)", I got "Error in
checkSlotAssignment(object, name, value) : "terms" is not a slot in class
"mer"". Is this because the latest update of lme4 is not compatible with
Zelig? Any workarounds? Thanks.
Shige
I'm not entirely sure what exactly you are trying to do, but it works for
me. Try running demo(logit) and then
plot(s.out2, xlab = "Range of k5")
Of course, you can always edit the original function, which is in this
case plot.zelig.logit() I attach that file to this email, but you can get
it from the source code too.
Kosuke
--
Department of Politics
Princeton University
http://imai.princeton.edu
On Mon, 22 Sep 2008, Anthony A. Pezzola wrote:
> Kosuke,
>
> I am using model="logit"
>
> Thanks for your in put.
>
> Anthony
>
> -----------------------------------------------
> Anthony A. Pezzola
> apezzola(a)uc.cl
> (02) 354-7823
> Profesor de Ciencia Política
> Instituto de Ciencia Política
> Pontificia Universidad Católica de Chile
> Santiago de Chile
>
> -----Original Message-----
> From: Kosuke Imai [mailto:kimai@Princeton.EDU]
> Sent: Saturday, September 20, 2008 1:22 PM
> To: Anthony A. Pezzola
> Cc: zelig(a)lists.gking.harvard.edu
> Subject: Re: [zelig] xlab not printing when plot sim object
>
> Can you tell us what model you are using?
>
> Thanks,
> Kosuke
>
>
Dear list,
When ploting a sim object, I cannot seem to get a xlab to appear.
When ploting the following:
plot.zelig(zelig.sim.object, xlab="Range of k5")
or
plot(zelig.sim.object, xlab="Range of k5")
nothing appears for the xlab. I can change the ylab and the main, but not the
xlab or the sub.
I can generate xlab and sub, using title(), but I would prefer to be able to
fully label the graphic in the original command. Is this a know problem with
plotting zelig objects or have I missed something in the documentation?
Thank you for your input.
Anthony
--
Anthony A. Pezzola
(02) 354-7823
Profesor de Ciencia Política
Instituto de Ciencia Política
Universidad Pontifica Católica de Chile
Santiago de Chile
-
Zelig Mailing List, served by Harvard-MIT Data Center
Send messages: zelig(a)lists.gking.harvard.edu
[un]subscribe Options: http://lists.gking.harvard.edu/?info=zelig
Zelig program information: http://gking.harvard.edu/zelig/
I want to run a simple logit with clustered standard errors. But,
Zelig does not seem to support this. Is the logit.gee model the same
as a logit with clustered standard errors?
If so, and if I want to cluster on "X2", is this all I have to do?:
z.out <- zelig(Y ~ X1, model = "normal.gee", id = "X2", data = mydata)
Thanks!
-c
--
Casey A. Klofstad
University of Miami
Department of Political Science
Coral Gables, FL
klofstad(a)gmail.com
http://www.as.miami.edu/personal/cklofstad/
-
Zelig Mailing List, served by Harvard-MIT Data Center
Send messages: zelig(a)lists.gking.harvard.edu
[un]subscribe Options: http://lists.gking.harvard.edu/?info=zelig
Zelig program information: http://gking.harvard.edu/zelig/