its probably collinearity. run a regression; if that works (with all
the variables included), the mlogit will usually work.
stats runs anything but it does that by dropping variables. so unless
you're watching closely, you wind up estimating a model you didn't ask
it to run.
Gary
---
On Thu, May 20, 2010 at 3:22 PM, Eric McGhee <mcghee(a)ppic.org> wrote:
Thanks Olivia. I've been poking around and it
seems like the problem is connected to the IVs I'm including. If I pare the model
way down, it works. Is it possible I'm overloading my data, and the mlogit function
is just dropping values of the DV where I don't have enough degrees of freedom? The
full model runs in Stata, but Stata will run just about anything.
Eric McGhee | Research Fellow | PPIC | 415-291-4439
Any opinions expressed in this message are those of the author alone and do not
necessarily reflect any position of the Public Policy Institute of California.
-----Original Message-----
From: monkeykupo(a)gmail.com [mailto:monkeykupo@gmail.com] On Behalf Of Olivia Lau
Sent: Thursday, May 20, 2010 11:26 AM
To: Eric McGhee
Cc: zelig(a)lists.gking.harvard.edu
Subject: Re: [zelig] mlogit
Hi, Eric.
I think that after eliminating the missing data, that one of the
factor levels in defhow2 drops off. A factor variable can have empty
levels (a defined value, but no values of that defined value), but
this becomes a problem when the factor is the DV. I would do the
list-wise deletion before, then check to see how many levels are
actually left in defhow2, then do factor(...) as you have it below
with those levels only.
Yours,
Olivia
On Thu, May 20, 2010 at 2:04 PM, Eric McGhee <mcghee(a)ppic.org> wrote:
I'm having trouble getting Zelig to run
simulations from a multinomial logit
model. The DV is called "defhow2" and has five categories, and I'm
running
the following syntax:
ppicjan10 <- read.dta("Jan 2010.regonly.dta", convert.factors=FALSE)
ppicjan10$defhow2 <- factor(ppicjan10$defhow2, levels=c(1,2,3,4,8),
labels=c("cuts", "taxes",
"cuts+taxes", "borrow", "other/dk"))
z.out <- zelig(as.factor(defhow2) ~
age+income+educ+lat+sex2+own2+cv+ba+osc+oth+pid7+ideo5+
ageXginfo+incXginfo+educXginfo+latXginfo+ownXginfo+cvXginfo+baXginfo+oscXginfo+
othXginfo+pidXginfo+ideoXginfo+ginfo, model="mlogit",
data=ppicjan10, baseline="other/dk")
x.out <- setx(z.out, fn=NULL)
s.out <- sim(z.out, x=x.out)
Everything is fine until the simulation command, where I get the following
error:
Error in factor(pr, levels = sort(unique(pr)), labels = ynames) :
invalid labels; length 5 should be 1 or 4
Resources online suggest that missing data is often to blame for this error
message, so I eliminated all of my missing data just to see if I could get
it to work in principle. No luck-same message. Does anyone know what might
be going on?
Eric McGhee
Research Fellow
PUBLIC POLICY
INSTITUTE OF CALIFORNIA
500 Washington Street, Suite 600
San Francisco, CA 94111
tel 415 291 4439
fax 415 291 4401
web
www.ppic.org
Any opinions expressed in this message are those of the author alone and do
not necessarily reflect any position of the Public Policy Institute of
California.
-
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: