Estimation using mlogit in R -
i have paper author proposes d-optimal design nested multinomial logit model no-choice. design follows:
cs 1:
alt a: 1 2 2 1 2 2
alt b: 2 2 1 2 1 2
alt c: 0 0 0 0 0 0
cs 2:
alt 1: 2 1 1 2 2 2
alt 2: 2 2 2 2 1 1
alt 3: 0 0 0 0 0 0
cs 3:
alt 1: 2 2 1 1 1 2
alt 2: 1 1 2 2 2 1
alt 3: 0 0 0 0 0 0
cs 4:
alt 1: 2 2 1 1 2 1
alt 2: 1 1 2 2 1 2
alt 3: 0 0 0 0 0 0
cs 5:
alt 1: 1 2 1 2 2 1
alt 2: 2 1 2 1 1 2
alt 3: 0 0 0 0 0 0
cs 6:
alt 1: 1 2 1 2 1 2
alt 2: 2 1 2 1 2 1
alt 3: 0 0 0 0 0 0
cs 7:
alt 1: 2 1 1 2 2 1
alt 2: 1 2 2 1 2 2
alt 3: 0 0 0 0 0 0
cs 8:
alt 1: 2 1 2 2 2 1
alt 2: 1 2 2 1 1 2
alt 3: 0 0 0 0 0 0
the design d-optimal design 8 choice sets , every choice set has 2 alternatives (6 two-level attributes alternative). tried estimate nested multinomial logit model in r using mlogit , design. thus, made simulated data using random response follow:
individual--choiceid--mode----choice----aa--ab--ac--ad--ae--af
------1-------------1----------a-------false-----1-----2-----2-----1-----2-----2
------1-------------1----------b-------false-----2-----2-----1-----2-----1-----2
------1-------------1----------c--------true-----0-----0-----0-----0-----0-----0
------1-------------2----------a-------false-----2-----1-----1-----2-----2-----2
------1-------------2----------b--------true-----2-----2-----2-----2-----1-----1
------1-------------2----------c-------false-----0-----0-----0-----0-----0-----0
------1-------------3----------a-------false-----2-----2-----1-----1-----1-----2
------1-------------3----------b-------false-----1-----1-----2-----2-----2-----1
the data contains responses of 30 people, means, data contains 240 choices (8 choices person). when used command
sim = read.csv("sim.csv",header=t) dat <- mlogit.data(sim, choice = "choice", shape = "long", alt.var = "mode", chid.var = "choideid",id.var="individual") nl.dat <- mlogit(choice ~ aa+ab+ac+ad+ae, dat, reflevel="c", nests = list(our = c("a","b") , sq = c("c")), unscaled = true)
i got error
error in solve.default(crossprod(attr(x, "gradi")[, !fixed])) : system computationally singular: reciprocal condition number = 1.13304e-18
someone has idea i'm doing wrong?
Comments
Post a Comment