Bookmark and Share

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: Re: problem with nlsur quaids


From   minti <[email protected]>
To   [email protected]
Subject   st: Re: problem with nlsur quaids
Date   Thu, 13 Oct 2011 05:21:26 -0700 (PDT)

Thanks jorge for the correction.  I still get the error message(invalid
syntax 198). I have put the trace on to help me see where the problem is and
it comes right before this line

-_b[l`i']*_b[b`j']/${bp}*(lnexpmean - (${ap}))^2"

Below is  the corrected code 
thanks
minti
****




set trace on
set tracedepth 4

quietly {
foreach x of varlist w* lnp* lnexp {
sum `x'
scalar `x'mean=r(mean)
}
* Price indexes
glo asum "_b[a1]*lnp1mean"
forv i=2(1)13 {
glo asum "${asum} + _b[a`i']*lnp`i'mean"
}
glo gsum ""
forv i=1(1)13 {
forv j=1(1)13 {
glo gsum "${gsum} + 0.5*_b[g`i'`j']*lnp`i'mean*lnp`j'mean"
}
}
glo ap "4.7 + ${asum} ${gsum}"
glo bp "_b[b1]*lnp1mean"
forv i=2(1)13 {
glo bp "${bp} + _b[b`i']*lnp`i'mean"
}
glo bp "(exp(${bp}))"
* Mus
forv i=1(1)13 {
glo mu`i' "_b[b`i'] + 2*_b[l`i']/${bp}*(lnexp-(${ap}))"
}
forv j=1(1)13 {
glo gsum2`j' ""
forv k=1(1)13 {
glo gsum2`j' "${gsum2`j'} + _b[g`j'`k']*lnp`k'mean"
}
}
}
forv i=1(1)13 {
forv j=1(1)13 {
glo delta=cond(`i'==`j',1,0)
glo mu`i'`j' "_b[g`i'`j'] - ${mu`i'}*(_b[a`j'] ${gsum2`j'})
-_b[l`i']*_b[b`j']/${bp}*(lnexpmean - (${ap}))^2"
* If expression is too long, split it
cap nlcom (elasgasto`i': ${mu`i'}/w`i'mean + 1) (mu`i'`j':
${mu`i'`j'}), post noheader
if _rc {
qui nlcom (elasgasto`i': ${mu`i'}/w`i'mean + 1) (mu`i'`j'f:
(1e+2)*(${mu`i'`j'})), post noheader
qui nlcom (elasgasto`i': _b[elasgasto`i']) (mu`i'`j':
_b[mu`i'`j'f]/(1e+2)), post noheader
}
* Uncompensated price elasticity
nlcom (elasgasto`i': _b[elasgasto`i']) (elpnc`i'`j':
_b[mu`i'`j']/w`i'mean - ${delta})  , post noheader
* Compensated price elasticity
nlcom (elpc`i'`j': _b[elpnc`i'`j'] + _b[elasgasto`i']*w`j'mean), noheader
qui est restore quaidsc
}
}


--
View this message in context: http://statalist.1588530.n2.nabble.com/problem-with-nlsur-quaids-tp6851426p6888689.html
Sent from the Statalist mailing list archive at Nabble.com.
*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index