1

i'm using data from ("TravelMode", package = "AER") and try to follow [Heiss,2002] paper this is what my code look like initially Nested Structured Picture

library(mlogit)
data("TravelMode", package = "AER")
TravelMode_frame <- mlogit.data(TravelMode,choice = "choice",shape="long",chid.var="individual",alt.var = "mode")
ml_TM <- mlogit(choice ~travel|income,data=TravelMode_frame,nests = list(public = c('train','bus'), car=('car'),air = c('air')), un.nest.el = FALSE,unscaled=TRUE)

then i want to separate travel time variable between air and the other three as the picture below, so i wrote

air <- idx(TravelMode_frame, 2) %in% c('air')
TravelMode_frame$travel_air <- 0
TravelMode_frame$travel_air[air] <- TravelMode_frame$travel[air]
TravelMode_frame$travel[TravelMode_frame$alt == "air"] <- "0"

then my data look like this

  individual  mode choice wait vcost travel gcost income size    idx travel_air
1          1   air  FALSE   69    59      0    70     35    1  1:air        100
2          1 train  FALSE   34    31    372    71     35    1 1:rain          0
3          1   bus  FALSE   35    25    417    70     35    1  1:bus          0
4          1   car   TRUE    0    10    180    30     35    1  1:car          0

~~~ indexes ~~~~
  chid   alt
1    1   air
2    1 train
3    1   bus
4    1   car

but when i compute it by

ml_TM <- mlogit(choice ~travel+travel_air|income,data=TravelMode_frame,nests = list(public = c('train','bus'), car=('car'), air = c('air')), un.nest.el = FALSE,unscaled=TRUE)

it's say Error in solve.default(H, g[!fixed]) : system is computationally singular: reciprocal condition number = 2.32747e-23

i had no idea why's this happened. could someone pls help me? i try cutting variable in the formula out 1 by 1 and it's useless

ps. i roll back to the data before i create travel_air and try making travel time a alt specific constant by

ml_TM <- mlogit(choice ~0|income|travel,data=TravelMode_frame,nests = list(public = c('train','bus'), car=('car'),
                 air = c('air')), un.nest.el = FALSE,unscaled=TRUE)

and it cant compute either (Error in solve.default(crossprod(attr(x, "gradi")[, !fixed])) : system is computationally singular: reciprocal condition number = 1.39039e-20)

1 Answers1

0

i think i get the idea behind this a little bit now. you can tell me if i'm wrong tho, i think my mistakes are

First thing, i forget to rescale income and travel time, so i need to add

TravelMode$travel <- TravelMode$travel/60+TravelMode$wait/60
TravelMode$income <- TravelMode$income/10

about the first question, this one

ml_TM <- mlogit(choice ~travel+travel_air|income,data=TravelMode_frame,nests = list(public = c('train','bus'), car=('car'), air = c('air')), un.nest.el = FALSE,unscaled=TRUE)

my nested have degenerate nested, so IV parameter will not count as dissimilarity anymore but the parameter to proportion the variable instead as the J & L model in the table in the (Heiss,2002) below and maybe because i tried to make it compute 2 variables at once, so come the error because they have to make IV parameter proportion to those variables simultaneously. Coefficient Estimate

for this problem

ml_TM <- mlogit(choice ~0|income|travel,data=TravelMode_frame,nests = list(public = c('train','bus'), car=('car'),
                 air = c('air')), un.nest.el = FALSE,unscaled=TRUE)

like the above case as model L in the table