Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: RE: RE: interaction


From   "Scott Merryman" <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: RE: interaction
Date   Sun, 9 Oct 2005 14:44:21 -0500

> -----Original Message-----
> From: [email protected] [mailto:owner-
> [email protected]] On Behalf Of [email protected]
> Sent: Thursday, October 06, 2005 6:46 PM
> To: [email protected]
> Subject: st: RE: RE: interaction
> 
> Scott,
>       I'm sorry if I wasn't clear about my question. Since the dependent
> variable is log transformed, the percentage increase is (exp(.29)-1)*100=
> 34 percent for group=1

Thanks.  I was thinking in terms of a continuous variable, in which

ln(Y) = b1 + b2X2 + e

b2 = dln(Y)/dX2 = (dY/Y)/dx

With a dummy variable the usual interpretation is:
 
ln(Y) = b1 + b2D + e

Percentage change = (Y1/Y0) -1 = exp{b1 + b2*1 + e} / exp{b1 + b2*0 + e} - 1
= exp{b2} - 1


In taking a look at the issue interpreting dummy variables in loglinear
models, I came across a few papers on this topic.  The following is taken
from van Garderen and Shah (2002).

Halvorsen and Palmquist (1980) pointed out that the unlike a continuous
variable, the coefficient of a dummy variable, multiplied by 100, is
not the usual percentage effect of that variable on the dependent variable
(the na�ve estimator).  Instead it should be calculated as:

	p = exp(b} -1

This is the case if the value of b is known. In practice, however, b is
unknown and has to be estimated.  Kennedy (1981) pointed out that this
transformation results in a biased estimator for p.

If the error term is assumed to be normally distributed then the OLS
estimator of b is efficient and unbiased. Goldberger (1968) noted that the
expected value exp{b_hat} = exp{b + .5*V(b_hat)} where V(b_hat) is the
variance of b_hat.

This led Kennedy to suggest:

	p = 100*(exp{b_hat - .5*V(b_hat)} - 1),

where V(b_hat) is the OLS estimate of the variance of b_hat.


Van Garderen and Shah go on to develop the Exact Minimum Variance Unbiased
Estimator of the percentage change in Y due to a change in D from 0 to 1:

	p =100*{exp(b_hat)0_F_1(m; -.5*V(b_hat)) - 1},

where m = (n-k)/2, n is the sample size k is the number of regressors and
0_F_1 is the hypergeometric function.

The term 0_F_1(m; -.5*V(b_hat)) tends to exp{-.5V(b_hat)} as the sample
increases.

The authors also give the variance of Kennedy's estimator as:

	V(p) = 100^2*exp{2*b_hat}*[exp{-V(b_hat)} - exp{2*V(b_hat)}

Stata does not have hypergeometric function so the exact estimator cannot be
directly calculated, but the program listed below calculates the unbiased
percentage change using Kennedy's method.


Example:

. sysuse auto, clear
(1978 Automobile Data)

. gen lnprice = ln(price)

. qui reg lnprice fore mpg gear

. disp "HP estimator =" exp(_b[fore])-1
HP estimator =.57716448

. semidum fore

Unbiased Estimated Percentage Change in Dependent Variable
Kennedy's (1981) approximation method for semilogarithmic equations  
----------------------------------------------------------------------------
variable |   % Change  Std. Err.     t      P>|t|    [ 95% Conf. Interval ]
---------+------------------------------------------------------------------
foreign  |  56.70733    17.6987     3.20    0.002     21.40832    92.00633
----------------------------------------------------------------------------


Scott


References

Giles, D.E.A. (1982). The interpretation of dummy variables in 
	semilogarithmic equations. Economics Letters, 10, 77-79.

Goldberger, A.S. (1968). The interpretation and estimation of 
	Cobb-Douglas functions. Econometrica 36, 464-472.

Halvorsen, R. and Palmquist, R. (1980). The interpretation of dummy 
	variables in semilogarithmic equations. American Economic Review,
	 70, 474-75.

Kennedy, P. E. (1981). Estimation with correctly interpreted dummy
	variables in semilogarithmic equations. American Economic Review,
71, 	801.

van Garderen, K. J. (2001). Optimal prediction in loglinear models. Journal
	of Econometrics, 104, 119-140.

van Garderen, K. J. and Shah, C. (2002). Exact interpretation of dummy 
	variables in semilogarithmic equations. The Econometrics Journal, 5,

	149-159.

------------------------------------------------------------------------

*! version 1.0.0 October 9, 2005
*! Scott Merryman
program semidum
version 9.1
syntax varname, [level(integer 95)]


scalar v_hat = _se[`varlist']^2
 
local kennedy = 100*(exp(_b[`varlist'] -.5*v_hat)-1)

local var  = 100^2*exp(2*_b[`varlist'])*[exp(-v_hat) - exp(-2*v_hat)]
local se=  sqrt(`var')
local t = `kennedy'/`se'

local pvalue =  2*ttail(`=e(df_r)', abs(`t'))
local ul =`kennedy' + invttail(`=e(df_r)',(1- `level'/100)/2)*`se' 
local ll =`kennedy' - invttail(`=e(df_r)',(1- `level'/100)/2)*`se'

disp ""
disp in smcl in gr "Unbiased Estimated Percentage Change in Dependent
Variable"
disp in smcl in gr "Kennedy's (1981) approximation method for
semilogarithmic equations  "

disp in smcl in gr "{hline 15}{c TT}{hline 68}"
disp in smcl in gr   "{ralign 14:variable}"  _col(15) " {c |} " ///
        _col(20) "% Change"  ///
        _col(30)  `"Std. Err."' ///
        _col(44) "t" ///
        _col(52) "P>|t|" ///
        _col(62) `"[ `level'% Conf. Interval ]"' ///
        _n  "{hline 15}{c +}{hline 68}"

di in smcl in  gr "{ralign 14: `varlist' }" _col(15) " {c |} " ///
 _col(18) in ye %-9.0g `kennedy' ///
 _col(30) in ye %8.0g `se' ///
 _col(42) in ye %5.2f `t' ///
 _col(52) in ye %5.3f  `pvalue' ///
 _col(62) in ye %9.0g `ll' "   " in ye %9.0g `ul' ///
 _n in gr "{hline 15}{c BT}{hline 68}"


end





*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index