Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Jorge Eduardo Pérez Pérez <perez.jorge@ur.edu.co> |

To |
"statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |

Subject |
Re: st: problem with nlsur quaids |

Date |
Tue, 4 Oct 2011 15:02:42 -0400 |

You have to write your own code to calculate the elasticities. You can calculate them for mean values of expenditure and use -nlcom- to get their standard errors after estimating the system via nlsur. Alternatively, you can calculate elasticities for each household using -predictnl- This is a quick example of the first approach on a 7 good system. First I define mean price indexes and additional variables such as the sums of a and g, then i calculate the elasticities. "lgastotal" is log total expenditure, "lprecio" is log price, "elasgasto" is expenditure elasticity. ---- * Share means and price means quietly { foreach x of varlist share* lprecio* lgastototal { sum `x' scalar `x'mean=r(mean) } * Price indexes glo asum "_b[a1]*lprecio1mean" forv i=2(1)7 { glo asum "${asum} + _b[a`i']*lprecio`i'mean" } glo gsum "" forv i=1(1)7 { forv j=1(1)7 { glo gsum "${gsum} + 0.5*_b[g`i'`j']*lprecio`i'mean*lprecio`j'mean" } } glo ap "4.7 + ${asum} ${gsum}" glo bp "_b[b1]*lprecio1mean" forv i=2(1)7 { glo bp "${bp} + _b[b`i']*lprecio`i'mean" } glo bp "(exp(${bp}))" * Mus forv i=1(1)7 { glo mu`i' "_b[b`i'] + 2*_b[l`i']/${bp}*(lgastototalmean-(${ap}))" } forv j=1(1)7 { glo gsum2`j' "" forv k=1(1)7 { glo gsum2`j' "${gsum2`j'} + _b[g`j'`k']*lprecio`k'mean" } } } forv i=1(1)7 { forv j=1(1)7 { 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}*(lgastototalmean - (${ap}))^2" * If expression is too long, split it cap nlcom (elasgasto`i': ${mu`i'}/share`i'mean + 1) (mu`i'`j': ${mu`i'`j'}), post noheader if _rc { qui nlcom (elasgasto`i': ${mu`i'}/share`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']/share`i'mean - ${delta}) , post noheader * Compensated price elasticity nlcom (elpc`i'`j': _b[elpnc`i'`j'] + _b[elasgasto`i']*share`j'mean), noheader qui est restore quaidsc } } As for the elasticity for each household, you can use code similar to this inside a loop over equations after defining mu: predictnl elasgasto`i'= (${mu`i'})/share`i' + 1 , se(seelasgasto`i') Hope this helps, _______________________ Jorge Eduardo Pérez Pérez On Tue, Oct 4, 2011 at 11:01 AM, Nick Cox <n.j.cox@durham.ac.uk> wrote: > > Nothing from me on elasticities. > > Nick > n.j.cox@durham.ac.uk > > > -----Original Message----- > From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Mintewab Bezabih > Sent: 04 October 2011 15:56 > To: statalist@hsphsun2.harvard.edu > Subject: SV: st: problem with nlsur quaids > > Thanks so much Nick. I folowed your tips and managed to run it now. My next problem is how to generate the elasticities. I presume I have to write my own code for that... do you or anybodyelse in the forum have any suggestions on that? > > thanks once again > minti > > ________________________________________ > Från: owner-statalist@hsphsun2.harvard.edu [owner-statalist@hsphsun2.harvard.edu] för Nick Cox [njcoxstata@gmail.com] > Skickat: den 2 oktober 2011 02:39 > Till: statalist@hsphsun2.harvard.edu > Ämne: Re: st: problem with nlsur quaids > > `lnp12'' with two '' occurs twice more. > > In a text editor supporting regular expressions I temporarily deleted > matches for `[a-z]*[0-9]*' -- which made it easier to find these > others. > > On Sun, Oct 2, 2011 at 1:16 AM, Nick Cox <njcoxstata@gmail.com> wrote: > > In the line > > > > scalar `l13' = -`l1' - `l2' - `l3'- `l4'- `l5'- `l6'- `l7'- `l8'- > > `l9'- `l10'- `l11-`l12' > > > > you have omitted an ' and in the line > > > > replace `w9' = `a9' + `g91'*`lnp1' + `g92'*`lnp2' + > > `g93'*`lnp3' + /// > > `g94'*`lnp4' + `g95'*`lnp5'+ > > `g96'*`lnp6'+ `g97'*`lnp7' + /// > > `g98'*`lnp8' + `g99'*`lnp9'+ > > `g910'*`lnp10'+ `g911'*`lnp11' + /// > > `g912'*`lnp12''+ `g913'*`lnp13'+ > > `b9'*(`lnexp'-`lnpindex')+ > > `l9'/`bofp'*(`lnexp' - `lnpindex')^2 > > > > you have one too many. > > > > There are I think other such problems in your file: see -hexdump- for > > a command that counts characters such as ` and '. > > > > Your naming practices could bite you. Does 113 mean 11,3 or 1,13? If > > you have indexes >9 it is best to use 11_3 and 1_13 to distinguish. > > > > Nick > > > > > > On Sat, Oct 1, 2011 at 10:23 PM, minti <Mintewab.Bezabih@economics.gu.se> wrote: > >> > >> I am having problems estimating a quaids system with 13 goods (12 equations) > >> and I cannot pinpoint where I went wrong. I keep on getting the messsage > >> nlsurquaids returned 198. Below are my codes for the nlsur and quaids. > >> Many thanks in advance. > >> minti > >> > > > > * > * 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/ > * > * 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/ > > * > * 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/ > > * * 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/

**References**:**st: problem with nlsur quaids***From:*minti <Mintewab.Bezabih@economics.gu.se>

**Re: st: problem with nlsur quaids***From:*Nick Cox <njcoxstata@gmail.com>

**Re: st: problem with nlsur quaids***From:*Nick Cox <njcoxstata@gmail.com>

**SV: st: problem with nlsur quaids***From:*Mintewab Bezabih <Mintewab.Bezabih@economics.gu.se>

- Prev by Date:
**Re: st: Looping across observations (forwards and backwards)** - Next by Date:
**Re: st: Claims of urgency** - Previous by thread:
**RE: st: problem with nlsur quaids** - Next by thread:
**st: Re: problem with nlsur quaids** - Index(es):