Greetings all,
please consider the following data:
#Build Data frame
Slope<-c(1.291370, 12.208500, 2.110930, 0.578990, 5.019520, 0.807444,
0.554079
, 1.257080, 0.241504 , 0.184337 , 0.383044 , 0.342021)
Exposure<-c(790.54, 1167.79 , 845.58 , 1082.47 , 1189.61 , 677.17 ,
2058.56 , 469.09
, 112.02 , 803.31 , 254.14 ,1336.16)
FwyDist<-c(11809.4222 ,10623.0458, 12279.6271, 11571.2744, 15400.9318,
7786.4093, 1173.0635
, 2630.1493 , 4408.2271 ,6333.0374 ,8070.0090, 751.3506)
RTotEmp<-c( 2707.4835 , 0.0000 ,729.5191 , 15652.1514
,25613.8658 , 74214.9622
, 15094.1017, 1682.1790 , 15742.1817 , 0.0000, 257715.0631 ,
13564.0576)
RTotHh<-c( 38643.1731 , 17361.7998 , 96782.8727 , 57936.3218 , 42770.3231 ,
32393.5014
,40490.5267 , 32682.3341 , 17151.9293 , 35989.6510 ,167356.2668
,63072.8678)
SFsubM<-c(0,1,1,0,0,0,0,0,0,1,0,0)
TestData<-data.frame(Slope,Exposure,FwyDist,RTotEmp,RTotHh,SFsubM)
#Run Model
z.out <- zelig(SFsubM ~ Slope + IntDist + Exposure + RTotEmp + RTotHh,
model="mlogit", data=TestData)
I get the error
Error in attr(tt, "depFactors")$depFactorVar :
$ operator is invalid for atomic vectors
Which i dont know what it means. The data is a subset of my real data but
should reflect what im trying to do. Thanks
JR
--
View this message in context:
http://n4.nabble.com/trouble-getting-multinimial-logit-model-to-work-properly-tp1588079p1588079.html
Sent from the R help mailing list archive at Nabble.com.
Joshua Wiley
2010-Mar-10 22:49 UTC
[R] trouble getting multinimial logit model to work properly
JR, You need to use as.factor() for the DV (even if it is already a factor). Also, your formula includes a variable not in your sample data, "IntDist", perhaps you meant "FwyDist"? Try: zelig(as.factor(SFsubM) ~ Slope + Exposure + FwyDist + RTotEmp + RTotHh, model="mlogit", data=TestData) Also, see http://gking.harvard.edu/zelig/docs/mlogit.pdf for more details on using the mlogit model. Best regards, Josh On Wed, Mar 10, 2010 at 1:23 PM, LCOG1 <jroll@lcog.org> wrote:> > > #Run Model > z.out <- zelig(SFsubM ~ Slope + IntDist + Exposure + RTotEmp + RTotHh, > model="mlogit", data=TestData) > > I get the error > Error in attr(tt, "depFactors")$depFactorVar : > $ operator is invalid for atomic vectors > > Which i dont know what it means. The data is a subset of my real data but > should reflect what im trying to do. Thanks >-- Joshua Wiley Senior in Psychology University of California, Riverside http://www.joshuawiley.com/ [[alternative HTML version deleted]]