Hello,
I am attempting to understand coefficient elasticity and have tried to hand calculate an elasticity "by hand" and then compare it to results produced by Stata's margins, eyex command.
the example and data are taken from Cameron & Travedi's (2010) "Microeconomics Using Stata" page 107
I regress totexp on the c.income#c.age interaction and want to understand what percentage change in totexp results from a 1% change in income when age is set at 66,
Below is my Stata do file followed by output. I attempt to estimate elasticities based on the equation e = ME * x/y.
My estimation (obviously incorrect) and Stata's (correct) diverge. Any suggestions as to how I am incorrectly estimating a coefficient elasticity would be greatly appreciated.
/* .do file*/
clear
use mus03data
capture log close
set more off
log using "c:\statalog\test", replace
log on
set logtype text
renvars, lower
/*page 107 of Cameron Trivedi 2010*/
regress totexp suppins phylim actlim totchr c.age female c.income c.income#c.age famsze, vce(robust) noheader allbaselevels
/*******************************/
/*Stata Margins calculated*/
/*******************************/
margins , eyex(income) at(age=(66)) vsquish atmeans
/*******************************/
/*hand calculated*/
/*******************************/
/*calculate means of predicotrs*/
egen msuppins= mean(suppins)
egen mphylim = mean(phylim)
egen mactlim = mean(actlim)
egen mtotchr = mean(totchr)
egen mage = mean(age)
egen mfemale = mean(female)
egen mincome = mean(income)
egen mfamsze = mean(famsze)
/*calculate predicted value to be used in elasticity = ME * x/y */
gen y = _b[suppins]*msuppins+_b[phylim]*mphylim+_b[actlim]*mactlim+_b[totchr]*mtotchr+_b[famsze]*mfamsze+_b[female]*mfemale+_b[income]*mincome+ ///
_b[income#age]*(mincome)*66 + _b[age]*66+ _cons
/* ME is slope of interaction or (_b[income] + _b[income#age]*age)
x = mincome and y is predicted above*/
gen elas66=(_b[income]+_b[income#age]*66)*mincome/y
list elas66 if _n==1
/*OUTPUT*/
Stata's elasticity
------------------------------------------------------------------------------
| Delta-method
| ey/ex Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
income | -.0233873 .0321488 -0.73 0.467 -.0864229 .0396482
------------------------------------------------------------------------------
my elasticity
+----------+
| elas66 |
|----------|
1. | .0445353 |
+----------+
thanks in advance
Ed
I am attempting to understand coefficient elasticity and have tried to hand calculate an elasticity "by hand" and then compare it to results produced by Stata's margins, eyex command.
the example and data are taken from Cameron & Travedi's (2010) "Microeconomics Using Stata" page 107
I regress totexp on the c.income#c.age interaction and want to understand what percentage change in totexp results from a 1% change in income when age is set at 66,
Below is my Stata do file followed by output. I attempt to estimate elasticities based on the equation e = ME * x/y.
My estimation (obviously incorrect) and Stata's (correct) diverge. Any suggestions as to how I am incorrectly estimating a coefficient elasticity would be greatly appreciated.
/* .do file*/
clear
use mus03data
capture log close
set more off
log using "c:\statalog\test", replace
log on
set logtype text
renvars, lower
/*page 107 of Cameron Trivedi 2010*/
regress totexp suppins phylim actlim totchr c.age female c.income c.income#c.age famsze, vce(robust) noheader allbaselevels
/*******************************/
/*Stata Margins calculated*/
/*******************************/
margins , eyex(income) at(age=(66)) vsquish atmeans
/*******************************/
/*hand calculated*/
/*******************************/
/*calculate means of predicotrs*/
egen msuppins= mean(suppins)
egen mphylim = mean(phylim)
egen mactlim = mean(actlim)
egen mtotchr = mean(totchr)
egen mage = mean(age)
egen mfemale = mean(female)
egen mincome = mean(income)
egen mfamsze = mean(famsze)
/*calculate predicted value to be used in elasticity = ME * x/y */
gen y = _b[suppins]*msuppins+_b[phylim]*mphylim+_b[actlim]*mactlim+_b[totchr]*mtotchr+_b[famsze]*mfamsze+_b[female]*mfemale+_b[income]*mincome+ ///
_b[income#age]*(mincome)*66 + _b[age]*66+ _cons
/* ME is slope of interaction or (_b[income] + _b[income#age]*age)
x = mincome and y is predicted above*/
gen elas66=(_b[income]+_b[income#age]*66)*mincome/y
list elas66 if _n==1
/*OUTPUT*/
Stata's elasticity
------------------------------------------------------------------------------
| Delta-method
| ey/ex Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
income | -.0233873 .0321488 -0.73 0.467 -.0864229 .0396482
------------------------------------------------------------------------------
my elasticity
+----------+
| elas66 |
|----------|
1. | .0445353 |
+----------+
thanks in advance
Ed
Comment