Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: QUAIDS Elasticities
From
Derya Karaci <[email protected]>
To
"[email protected]" <[email protected]>
Subject
st: QUAIDS Elasticities
Date
Thu, 29 Dec 2011 10:33:00 -0800 (PST)
Hello,
I am trying to obtain QUAIDS elasticities after running Poi(2008) program to estimate a 5-good demand system. The formulas are provided by Banks,Blundell and Lewbel (RESTAT,1997) and I am trying to use the coefficients to compute the elasticities for each household with predictnl. The code seems to work fine but I am obtaining unusually large own-price elasticities (mostly greater than one in absolute value) which are inconsistent with the literature. I post my code below. Am I making a mistake in the implementation of the formulas? Any help will be greatly appreciated!
I tried to run it on the average values (instead of obtaining an elasticity matrix for each household) but that also gave very large elasticities.
Many thanks in advance... and merry Christmas!
Derya
Note: I know gammas are variables, not parameters but I couldn't get it to work otherwise.
******************************************************************************************************************
nlsur quaids3 @ w1 w2 w3 w4 lnp1-lnp5 lnexp var1 var2 var3 var4, ifgnls nequations(4) ///
param(a1 a2 a3 a4 b1 b2 b3 b4 g11 g12 g13 g14 g22 g23 g24 g34 g33 g44 l1 l2 l3 l4 ///
h1 h2 h3 h4 r1 r2 r3 r4 j1 j2 j3 j4 k1 k2 k3 k4)
estimates save est
* Recover the parameters of fifth equation:
*-------------------------------------------
estimates use est
nlcom (a1:_b[/a1]) (a2:_b[/a2]) (a3:_b[/a3]) (a4:_b[/a4]) ///
(a5:1-_b[/a1]-_b[/a2]-_b[/a3]- _b[/a4]) ///
.......(more stuff)
(l5:-_b[/l1]-_b[/l2]-_b[/l3]-_b[/l4]), iterate(1000) post
***post missing gamma
*-------------------------------------------forvalues i=1/5{ gen gama1`i'=_b[g1`i']
}
forvalues i=2/5{
forvalues j=1/5{
if `i'>`j' {
gen gama`i'`j'=_b[g`j'`i']
}
else {
gen gama`i'`j'=_b[g`i'`j']
}
}
}
*** Generate b(p):
gen double bp=p1^_b[b1]*p2^_b[b2]*p3^_b[b3]*p4^_b[b4]*p5^_b[b5]
*** Generate P(p):
gen double lnap = 4.9 + _b[a1]*lnp1 + _b[a2]*lnp2 + _b[a3]*lnp3 + _b[a4]*lnp4 +_b[a5]*lnp5
forvalues i = 1/5 {
forvalues j = 1/5 {
replace lnap = lnap + 0.5*gama`i'`j'*lnp`i'*lnp`j'
}}
***Budget elasticities
forvalues i=1/5{
predictnl e`i' = _b[b`i']+((2*_b[l`i']/bp)*(lnexp-lnap))/w`i' + 1, se(se`i')
}
****Price elasticities (uncompensated)
forvalues i=1/5{ forvalues j=1/5{
gen gp`j'=0
forvalues l=1/5{
replace gp`j'=gp`j'+gama`j'`l' * lnp`l'
}
if `i'==`j'{
local delt=1
}
else {
local delt=0
}
predictnl e`i'`j'= (((gama`i'`j' - (( _b[b`i']+((2*_b[l`i']/bp)*(lnexp-lnap))))* ///
(_b[a`j'] + gp`j') - (_b[l`i']*_b[b`j']/bp)*(lnexp-lnap)^2 )))/w`i' - `delt' ///
, se(se`i'`j')
drop gp`j'
}
}
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/