[Limdep Nlogit List] interactions in binary logit models
A.M.Zanni at lboro.ac.uk
A.M.Zanni at lboro.ac.uk
Fri Jun 18 05:04:51 EST 2010
Dear Prof Greene and Limdep Users
I am analysing a binary logit model with y=yes/no
responses to a program and a number of dependent
variables including price level and respondents
socio-economic characteristics. I would like to interact
the variable describing price levels (continuous) with
some of these characteristics (generally categorical) in
order to see how the response vary in accordance with
price.
I was about to ask how to replicate the STATA command
INTEFF (Ai and Norton, 2003) in Limdep, but then last week
came across Prof Greene's recent paper "Testing
Hypotheses about interaction terms in nonlinear models"
2010. Economic Letters 107, 291-296.
I have been trying to use the Limdep codes provided with
the paper. I came across a couple of problems
both in the set-up and interpretation. Hope you may help.
I started with the following - interaction between
variable price (continuous) and blwabv (dummy):
Sample ; All $
Namelist ; z=one,male, age1829, age3044, age4560, TOTHSLD,
CARYESN, FLYNOFL,rent, emp,
educ, ret,
taxpct, totco2, lower, higher,
CHGMONEY,CHGCLIMA,CHGOTHER,COSTB,TIMEB, EASYHOME,EASYTRAN
$
Probit ; Lhs = reduce ; Rhs = blwabv, price, z$
Calc ; df = b(1) ; da = b(2) $
Matrix ; bz = b(3:26) ; zbar = Mean(z) ; bzz = bz'zbar $
Create ; ME_Blw = phi( da*price + bzz)
; ME_Abv = phi(df + da*price + bzz) $
Calc ; Ran (123479) $
Draw ; N=100 $
Plot ; lhs = price ; rhs = ME_Blw,ME_Abv ; fill ; Grid
; Title=Partial Effects for a Model with No
Interaction Term
; Yaxis=Partial Effects$
And I obtain the following:
Calc ; df = b(1) ; da = b(2) $
--> Matrix ; bz = b(3:26) ; zbar = Mean(z) ; bzz =
bz'zbar $
Error 400: MNAME(first:last ). Matrix size exceeded
by this address.
Error 32: Model command. Start vals. unreadable or
wrong # given.
Error 583: Model command. Start vals. unreadable or
wrong # given.
--> Create ; ME_Blw = phi( da*price + bzz)
; ME_Abv = phi(df + da*price + bzz) $
Error 768: Have been unable to break down the command
segment.
Error 623: Check for error in DA*PRICE+BZZ
Error 623: Look for: Unknown names, pairs of
operators, e.g., */
Error 61: Compilation error in CREATE. See previous
diagnostic.
--> Calc ; Ran (123479) $
--> Draw ; N=50 $
--> Plot ; lhs = price ; rhs = ME_Blw,ME_Abv ; fill ;
Grid
; Title=Partial Effects for a Model with No
Interaction Term
; Yaxis=Partial Effects$
Error 71: Variable list contains a name not in the
expected table.
Error 539: Variable list: The unidentifiable string is
ME_BLW
Error 83: RHS/RH1 variable in list not in the
variable names table.
I also tried the following from the paper limdep command
file
? Model with interaction effects. Just examine partial
effect ? graphically.
Sample ; All $
Create ; int = blwabv*price$
Probit ; lhs = reduce
; Rhs = blwabv,price, int, one, male, age1829,
age3044, age4560, TOTHSLD, CARYESN, FLYNOFL,rent, emp,
educ, ret, taxpct,
totco2, lower, higher,
CHGMONEY,CHGCLIMA,CHGOTHER,COSTB,TIMEB, EASYHOME,EASYTRAN
$
Matrix ; bz = b(4:26) ; bzz = bz'zbar $
Calc ; df = b(1) ; da = b(2) ;di = b(3) $
Create ; ME_blwi = phi( da*price + bzz)
; ME_abvi = phi(df + da*price + di * price +
bzz) $
Calc ; Ran (123479) $
Draw ; N=100 $
Plot ; lhs = price ; rhs = ME_blwi,ME_abvi ; fill ;
Grid
; Title=Partial Effects for Blw and Abv with
Interaction
; Yaxis=Partial Effects $
? Plot results from both models in the same figure
Plot ; lhs = price ; rhs = ME_blwi,ME_abvi ; fill
;grid
;title=Fitted Probabilities for Models with Interaction
Terms
;Yaxis=Fitted Probabilities (Other Vars. At Means)$
And I obtained more of less the same (below):
Matrix ; bz = b(4:26) ; bzz = bz'zbar $
Error 442: Matrix: The expression contains an unknown
name.
Error 569: Error is in BZ'ZBAR
Error 583: Problem with matrix. See previous
diagnostic.
--> Calc ; df = b(1) ; da = b(2) ;di = b(3) $
--> Create ; ME_blwi = phi( da*price + bzz)
; ME_abvi = phi(df + da*price + di * price + bzz) $
Error 768: Have been unable to break down the command
segment.
Error 623: Check for error in DA*PRICE+BZZ
Error 623: Look for: Unknown names, pairs of
operators, e.g., */
Error 61: Compilation error in CREATE. See previous
diagnostic.
--> Calc ; Ran (123479) $
--> Draw ; N=150 $
--> Plot ; lhs = price ; rhs = ME_blwi,ME_abvi ; fill
; Grid
; Title=Partial Effects for Blw and Abv with
Interaction
; Yaxis=Partial Effects $
Error 71: Variable list contains a name not in the
expected table.
Error 539: Variable list: The unidentifiable string is
ME_BLWI
Error 83: RHS/RH1 variable in list not in the
variable names table.
--> Plot ; lhs = price ; rhs = ME_blwi,ME_abvi ; fill
;grid
;title=Fitted Probabilities for Models with
Interaction Terms
;Yaxis=Fitted Probabilities (Other Vars. At Means)$
Error 71: Variable list contains a name not in the
expected table.
Error 539: Variable list: The unidentifiable string is
ME_BLWI
Error 83: RHS/RH1 variable in list not in the
variable names table.
I am not sure what is wrong in the code above. Also I
would like to use a logit rather than a probit. In what
way would the code above be different?
* <!-- /* Style Definitions */ p.MsoNormal,
li.MsoNormal, div.MsoNormal {mso-style-parent:"";
margin:0cm; margin-bottom:.0001pt;
mso-pagination:widow-orphan; font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";
mso-ansi-language:EN-GB;} @page Section1 {size:612.0pt
792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt;
mso-header-margin:36.0pt; mso-footer-margin:36.0pt;
mso-paper-source:0;} div.Section1 {page:Section1;} --> I
would like to reproduce figure 4 in the paper (Greene,
2010), which seems to be the one I understand the better,
however I am not sure how to do that, and which specific
code to use. And how do i calculate the standard errors
and t-ratio as for the previous case of interaction
between continuous variables.
I also used the other codes provided with the paper for
interactions between continuous variables and they seem
to be working.
Any help would be much appreciated.
Best regards
* <!-- /* Style Definitions */ p.MsoNormal,
li.MsoNormal, div.MsoNormal {mso-style-parent:"";
margin:0cm; margin-bottom:.0001pt;
mso-pagination:widow-orphan; font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";
mso-ansi-language:EN-GB;} @page Section1 {size:612.0pt
792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt;
mso-header-margin:36.0pt; mso-footer-margin:36.0pt;
mso-paper-source:0;} div.Section1 {page:Section1;} -->
Dr Alberto M Zanni
Transport Studies Group
Department of Civil and Building Engineering
Loughborough Univesrity
Loughborough LE11 3TU - UK
email: a.m.zanni at lboro.ac.uk
More information about the Limdep
mailing list