Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • cmxtmixlogit - expected probabilities and sign of margin effects


    First of all, I would like to say that it is my first thread in Statalist. I apologize for any mistakes I may make.

    I am using cmxtmixlogit in Stata 16.0 on Windows 7 to fit a mixed logit model to choice data in which decisions-makers make repeated choices. I have

    The coefficient of the alternative-specific variable is negative, but the marginal effects are in the opposite direccion. Both figures are significant. I have read before in other threads about similar problems but it was not clear to me (
    HTML Code:
    https://www.statalist.org/forums/forum/general-stata-discussion/general/1427065-negative-interaction-coefficient-but-positive-marginal-effects
    ,
    HTML Code:
    https://www.statalist.org/forums/forum/general-stata-discussion/general/1329201-marginal-effects-significance-vs-original-model-effects-significance
    ,
    HTML Code:
    https://www.statalist.org/forums/forum/general-stata-discussion/general/1362415-interpretation-of-marginal-effects-of-multinomial-logit
    )

    Here is an example of my data:

    ----------------------- copy starting from the next line -----------------------
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input long(ID_orden ID_VEH) double choice long Alternativa str12 ID_VEHICULO long(Tiempos_mostrados Frec_total_bis_fact Hasta_Bahia Noches_fact_1 Tipo_dia_2h_2 Fecha_2h group_PMV_5)
    21036 1 1 1 "A//4JrVAStU=" 35 1 2 27 1 1 1
    21036 1 0 2 "A//4JrVAStU=" 57 1 2 27 1 1 1
    54760 2 1 1 "A/+cM7Qaq80=" 36 1 1 27 3 1 1
    54760 2 0 2 "A/+cM7Qaq80=" 56 1 1 27 3 1 1
    50259 3 1 1 "a/+OR+K+1M8=" 34 1 2 15 2 7 1
    50259 3 0 2 "a/+OR+K+1M8=" 54 1 2 15 2 7 1
    73314 4 1 1 "a/+qCASnMoM=" 33 3 2 27 3 7 1
    86172 4 1 1 "a/+qCASnMoM=" 34 3 1 27 1 6 1
    73314 4 0 2 "a/+qCASnMoM=" 54 3 2 27 3 7 1
    86172 4 0 2 "a/+qCASnMoM=" 55 3 1 27 1 6 1
    end
    label values Alternativa Alternativa
    label def Alternativa 1 "AP-4", modify
    label def Alternativa 2 "N-IV", modify
    label values Frec_total_bis_fact Frec_total_bis_fact
    label def Frec_total_bis_fact 1 "1", modify
    label def Frec_total_bis_fact 3 "3", modify
    label values Hasta_Bahia Hasta_Bahia
    label def Hasta_Bahia 1 "Hasta Jerez", modify
    label def Hasta_Bahia 2 "Hasta Bahia", modify
    label values Noches_fact_1 Noches_fact_1
    label def Noches_fact_1 15 "14", modify
    label def Noches_fact_1 27 "No consta", modify
    label values Tipo_dia_2h_2 Tipo_dia_2h_2
    label def Tipo_dia_2h_2 1 "Weekday", modify
    label def Tipo_dia_2h_2 2 "Friday", modify
    label def Tipo_dia_2h_2 3 "Saturday", modify
    label values Fecha_2h Fecha_2h
    label def Fecha_2h 1 "12:00:00", modify
    label def Fecha_2h 6 "14:00:00", modify
    label def Fecha_2h 7 "16:00:00", modify
    label values group_PMV_5 group_PMV_5
    label def group_PMV_5 1 "EMPTY", modify
    ------------------ copy up to and including the previous line ------------------

    Observations are drivers choosing between two roads. Many drivers choose more than once. I have repeated observations for many drivers.

    ID_VEH identifies the vehicle, ID_orden identifies the number of the recurrence, and Alternativa identifies the alternative chosen by the driver.
    The alternative-specific variable is Tiempos_motrados that it is travel times estimates of both road alternatives displayed to drivers.


    My code is as belows:

    Code:
    cmset ID_VEH ID_orden Alternativa
    And the result is:
    cmset ID_VEH ID_orden Alternativa
    panel data: panels ID_VEH and time ID_orden
    note: case identifier _caseid generated from ID_VEH ID_orden
    note: panel by alternatives identifier _panelaltid generated from ID_VEH Alternativa caseid variable: _caseid
    alternatives variable: Alternativa
    panel by alternatives variable: _panelaltid (unbalanced)
    time variable: ID_orden, 1 to 104307, but with gaps
    delta: 1 unit


    Then:

    Code:
    cmxtmixlogit choice, random(Tiempos_mostrados) casevars(ib(first).Hasta_Bahia ib(first).Frec_total_bis_fact ib(first).Noches_fact_1 ib(first).Tipo_dia_2h_2 ib(first).Fecha_2h ib(first).group_PMV_5) intpoints(2500)
    
    margins, dydx(Tiempos_mostrados) alternative(AP-4)
    
    margins, at(Tiempos_mostrados=generate(Tiempos_mostrados)) at(Tiempos_mostrados=generate(Tiempos_mostrados+5)) at(Tiempos_mostrados=generate(Tiempos_mostrados+10)) at(Tiempos_mostrados=generate(Tiempos_mostrados+15)) at(Tiempos_mostrados=generate(Tiempos_mostrados-5)) at(Tiempos_mostrados=generate(Tiempos_mostrados-10)) at(Tiempos_mostrados=generate(Tiempos_mostrados-15)) alternative(AP-4)
    As expected, the average coefficient of the travel time estimates is negative. This means that when the travel time shown for a road increases, the probability of choosing that alternative decreases. However, the marginal effect and the expected probabilities are significant and of opposite signs. So I do not know exactly what is the correct interpretation of the problem. Could you help me, please?
Working...
X