[R] mlogit

Peter Ehlers ehlers at ucalgary.ca
Sun Mar 7 23:12:58 CET 2010


On 2010-03-07 10:41, cmc wrote:
>
> I have tried doing it whithout attaching the mydata file, and i still get the
> same output.
>
> When i create mldata using mlogit.data i do not generate the chid and alt
> columns, is this where the problem is, if so how do i fix this problem.

I've suggested not naming the mlogit.data object 'mldata'. That will
work. Another way is to let mlogit() do the data conversion itself:
Instead of

  mldata<-mlogit.data(mydata, varying=NULL, choice="brand", shape="wide")
  mlogit.model<- mlogit(brand~1|female+age, data = mldata, reflevel="1")

use

  mlogit.model <- mlogit(brand~1|female+age,
                     data = mydata,  ## note: 'mydata', not 'mldata'
                     reflevel = "1",
                     varying = NULL,
                     choice = "brand",
                     shape = "wide")

  -Peter Ehlers

>
> Cheers for any help

-- 
Peter Ehlers
University of Calgary



More information about the R-help mailing list