? ? 1. Test for significance of squared term ? CLOGIT ; Lhs = Choice ; Choices=Brand1,Brand2,Brand3,None ; Rhs = Fash,Qual,Price,Asc4 $ CALC ; L0 = logl $ CLOGIT ; Lhs = Choice ; Choices=Brand1,Brand2,Brand3,None ; Rhs = Fash,Qual,Price,Pricesq,Asc4 $ CALC ; L1 = logl $ CALC ; list ; chisq = 2*(l1 - l0) $ ? ? 2. Test for homogeneity. Are men the same as women ? ? SAMPLE ; All $ CLOGIT ; For[Male = 0] ; Lhs = Choice ; Choices=Brand1,Brand2,Brand3,None ; Rhs = Fash,Qual,Price,Asc4 $ CALC ; LoglF = LogL $ MATRIX ; db = b ; dv = varb $ CLOGIT ; For[ Male = 1] ; Lhs = Choice ; Choices=Brand1,Brand2,Brand3,None ; Rhs = Fash,Qual,Price,Asc4 $ CALC ; LoglM = LogL $ MATRIX ; db = db - b ; dv = dv + varb $ CLOGIT ; Lhs = Choice ; Choices=Brand1,Brand2,Brand3,None ; Rhs = Fash,Qual,Price,Asc4 $ CALC ; LoglMF = LogL $ ? Likelihood Ratio Test CALC ; List ; Chisq = 2*(LoglM + LogLF - LOGLMF) ; Ctb(.95,8) $ ? Wald test MATRIX ; List ; Wald = db'db $ ? A convenient way to compute all three models. CLOGIT ; For[Male = *,1,0] ; Lhs = Choice ; Choices=Brand1,Brand2,Brand3,None ; Rhs = Fash,Qual,Price,Asc4 $ ? ? 3. Examine the marginal effect of price on brand choice ? SAMPLE ; All $ CLOGIT ; Lhs = Choice ; Choices=Brand1,Brand2,Brand3,None ; Rhs = Fash,Qual,Price,Asc4 ; Effects : Price (*) $ ? ? 4. What would happen to the market shares of the three brands ? If the price of Brand 1 of shoes rose by 50%. What would ? happen to the market shares if the prices of all three ? brands rose by 50%? ? SAMPLE ; All $ CLOGIT ; Lhs = Choice ; Choices=Brand1,Brand2,Brand3,None ; Rhs = Fash,Qual,Price,Asc4 ; Effects : Price (*) $ CLOGIT ; Lhs = Choice ; Choices=Brand1,Brand2,Brand3,None ; Rhs = Fash,Qual,Price,Asc4 ; Simulation = * ; Scenario: Price (Brand1) = [*] 1.5 $ CLOGIT ; Lhs = Choice ; Choices=Brand1,Brand2,Brand3,None ; Rhs = Fash,Qual,Price,Asc4 ; Simulation = * ; Scenario: Price (Brand1,Brand2,Brand3) = [*] 1.5 $ ? ? 5. Testing for IIA ? SAMPLE ; All $ CLOGIT ; Lhs = Choice ; Choices=Brand1,Brand2,Brand3,None ; Rhs = Fash,Qual,Price,Asc4 $ CLOGIT ; Lhs = Choice ; Choices=Brand1,Brand2,Brand3,None ; Rhs = Fash,Qual,Price,Asc4 ; IAS = Brand3 $ ? ? 6. Do men pay different attention to fashion than women? ? Is the difference statistically significant? ? Create ; MaleFash = Male*Fash $ CLOGIT ; Lhs = Choice ; Choices=Brand1,Brand2,Brand3,None ; Rhs = Fash,Qual,Price,Asc4,MaleFash $ CLOGIT ; Lhs = Choice ; Choices=Brand1,Brand2,Brand3,None ; Rhs = Fash,Qual,Price,Asc4,MaleFash ; Simulation = * ; Scenario: MaleFash(*) = [*] 0 $ ? ? 7. Building heterogeneity into the model ? NLOGIT (none) ; Lhs = Choice ; Choices = Brand1,Brand2,Brand3,None ; Rhs = Fash,Qual,Price,ASC4 ; Effects: Price(Brand1,Brand2,Brand3) $ NLOGIT (het) ; Lhs = Choice ; Choices = Brand1,Brand2,Brand3,None ; Rhs = Fash,Qual,Price,ASC4 ; Het ; Effects: Price(Brand1,Brand2,Brand3) $ NLOGIT (variance, het) ; Lhs = Choice ; Choices = Brand1,Brand2,Brand3,None ; Rhs = Fash,Qual,Price,ASC4 ; Het ; Hfn = Male,age25,age39 ; Effects: Price(Brand1,Brand2,Brand3) $ ? ? 8. Testing for homoscedasticity with a Wald test ? NLOGIT (het) ; Lhs = Choice ; Choices = Brand1,Brand2,Brand3,None ; Rhs = Fash,Qual,Price,ASC4 ; Het ; Par $ MATRIX ; c = b(5:7) ; vc = Varb(5:7,5:7) ; List ; WaldStat = c'c $ ? ? 9. Testing for heterogeneity in the heteroscedasticity ? NLOGIT (het) ; Lhs = Choice ; Choices = Brand1,Brand2,Brand3,None ; Rhs = Fash,Qual,Price,ASC4 ; Het $ CALC ; LogLR = LogL $ NLOGIT (variance, het) ; Lhs = Choice ; Choices = Brand1,Brand2,Brand3,None ; Rhs = Fash,Qual,Price,ASC4 ; Het ; Hfn = Male,age25,age39 $ CALC ; LoglU = LogL $ CALC ; List ; LRTest = 2*(LogLU - LogLR) ; Ctb(.95,3) $ ?************************************************************************ ?************************************************************************ ?************************************************************************ ? ? These exercises are based on the travel model data, clogit.lpj ? ?************************************************************************ ?************************************************************************ ?************************************************************************ ? ? 1. Basic nested logit ? NLOGIT ; Lhs = Mode ; Choices=Air,Train,Bus,Car ; Rhs = One,GC,TTME,INVT,INVC ; Tree = Private(Air,Car),Public(Train,Bus) ; Show Tree $ CALC ; LOGLU = LOGL $ ? ? 2. Different normalization ? NLOGIT ; Lhs = Mode ; Choices=Air,Train,Bus,Car ; Rhs = One,GC,TTME,INVT,INVC ; Tree = Private(Air,Car),Public(Train,Bus) ; RU2 ; CrossTab$ ? ? 3. Constrain IV parameters to produce MNL model ? NLOGIT ; Lhs = Mode ; Choices=Air,Train,Bus,Car ; Rhs = One,GC,TTME,INVT,INVC ; Tree = Private(Air,Car),Public(Train,Bus) ; IVSET:(Private,Public)=[1] $ CALC ; LOGLR = LOGL $ CALC ; List ; LRTEST = 2*(LOGLU - LOGLR) $ ? ? 4. Degenerate branch. Two normalizations ? NLOGIT ; Lhs = Mode ; Choices=Air,Train,Bus,Car ; Rhs = One,GC,TTME,INVT,INVC ; Tree = Fly(Air),Ground(Car,Train,Bus) $ NLOGIT ; Lhs = Mode ; Choices=Air,Train,Bus,Car ; Rhs = One,GC,TTME,INVT,INVC ; Tree = Fly(Air),Ground(Car,Train,Bus) ; RU2 $ ? ? 5. Use nested logit to reveal scaling. ? NLOGIT ; Lhs = Mode ; Choices=Air,Train,Bus,Car ; Rhs = One,GC,TTME,INVT,INVC ; Tree = Fly(Air),Drive(Car),Rail(Train),Ride(Bus) ; IVSET: (Ride) = [1] ; Par $ NLOGIT ; Lhs = Mode ; Choices=Air,Train,Bus,Car ; Rhs = One,GC,TTME,INVT,INVC ; HET ; SDV = SA,ST,1.0,SC $ ? ? 6. A Generalized Nested Logit Model ? NLOGIT ; Lhs = Mode ; Choices=Air,Train,Bus,Car ; Rhs = One,GC,TTME,INVT,INVC ; Tree = Fast(Air,Car,Train),Public(Train,Bus) ; GNL $ ? ? 7. Homoscedastic vs. Heteroscedastic Extreme Value ? NLOGIT ; Lhs = Mode ; Choices = Air,Train,Bus,Car ; Rhs = TTME,INVC,INVT,GC,One ; Effects: INVT(*) $ CALC ; LR = LogL $ NLOGIT ; Lhs = Mode ; Choices = Air,Train,Bus,Car ; Rhs = TTME,INVC,INVT,GC,One ; Het ; Effects: INVT(*) $ CALC ; LU = LogL $ CALC ; List ; LRTEST = 2*(LU - LR); Ctb(.95,3) $ ? ? 8.Heterogeneous. Does Income affect the means or the variances? ? SAMPLE ; All $ NLOGIT ; Lhs = Mode ; Choices = Air,Train,Bus,Car ; Rhs = TTME,INVC,INVT,GC; Rh2=One,Hinc $ CREATE ; LOGLMean = Logl_Obs $ NLOGIT ; Lhs = Mode ; Choices = Air,Train,Bus,Car ; Rhs = TTME,INVC,INVT,GC,one ; Het ; Hfn = HINC $ CREATE ; LoglVar = Logl_Obs $ CREATE ; V = LoglMean - LogLVar $ REJECT ; CASC = 0 $ CALC ; List ; Vuong = sqr(n) * xbr(v) / sdv(v) $