Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Again the requrest: SIMULATION TO INTERPRET AND PRESENT LOGIT RESULTS without formatting - hopefully looks better

From   Scott Merryman <>
Subject   Re: Again the requrest: SIMULATION TO INTERPRET AND PRESENT LOGIT RESULTS without formatting - hopefully looks better
Date   Fri, 2 Mar 2012 15:20:33 -0600

On Fri, Mar 2, 2012 at 11:02 AM, Alexander M. Jais
<> wrote:
* How do I code the Interaction Variable and Independent Variable,
which are NOT binary – the explanation in Zellner shows only the
binary interaction term (see lines 3, 10, … in Do file below; based
on Zellner 2009, also attached, see pages 21-23) ?

* Why is in line 8 all independent variables set to zero?

1.  How do you want to code the interaction of two ordinal variables?
In the example below using two continuous variables, mpg is allowed
vary over a range of values while gear_ratio is set at the minimum or
maximum value.

2.  From page 10 of the paper:  "The ambivalent firm, as defined by
Hoetker (2007b), is modeled by setting the values of the independent
variables other than asset specificity and demand uncertainty to zero,
and serves as a useful illustration because the predicted
probabilities for this hypothetical firm vary substantially..."


sysuse auto, clear
gen  mpggear= mpg*gear

estsimp logit fore mpg gear price mpggear
foreach var in X Y0 Y1 Y0lb Y1lb Y0ub Y1ub dY dYlb dYub {
gen `var' = .
setx price mean
qui {
forvalues obs = 20(1)40 {
	replace X = `obs' in `obs'
	setx mpg  `obs'+1
	foreach as_lev in 0 1 {
		if `as_lev' == 0 {
			qui sum gear
			local gear_lev = r(min)
		if `as_lev' == 1 {
			qui sum gear
			local gear_lev = r(max)
		setx gear `gear_lev' mpggear `gear_lev'*`obs'
		simqi, genpr(Y`as_lev'_tmp) prval(1)
		sum Y`as_lev'_tmp, meanonly
		replace Y`as_lev' = r(mean) in `obs'
		_pctile Y`as_lev'_tmp, p(2.5, 97.5)
		replace Y`as_lev'lb = r(r1) in `obs'
		replace Y`as_lev'ub = r(r2) in `obs'
drop *_tmp
twoway rbar Y0ub Y0lb X, mw msize(1) lcolor(gs12) fcolor(gs16)  ///
  || line Y0 X, color(gs12) ///
  || rspike Y1ub Y1lb X, color(gs0) lp(dot)  ///
  || line Y1 X, color(gs0) ///
  || , yscale (r(0 1)) ylabel(0(.2)1) ///
   legend(order(2 "Minimum Gear Ratio" 4 "Maximum Gear Ratio") size(*.7)) ///
   xtitle("MPG") ytitle("Probility of Foreign Origin") graphregion(fcolor(gs16))


*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index