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]

Re: st: Re: problem with nlsur quaids


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: Re: problem with nlsur quaids
Date   Thu, 13 Oct 2011 13:29:46 +0100

That shouldn't be a separate line; it should be joined with the
previous. Perhaps the objection is that Stata is seeing one " but not
the other.

Nick

On Thu, Oct 13, 2011 at 1:21 PM, minti <[email protected]> wrote:
> 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
> }
> }
>

*
*   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