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]

From |
Nick Cox <n.j.cox@durham.ac.uk> |

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

Subject |
RE: st: Calculating an Index |

Date |
Tue, 24 Jan 2012 14:54:38 +0000 |

You've asked me in public; so I will decline this invitation in public. There is an important underlying point in principle. Statalist is a discussion list, not a help line. It depends absolutely on people contributing exactly as they wish. This may and will often seem capricious: some questions are ignored, some answered with extraordinarily good and full help. Some people contribute almost every day, some occasionally, and many not at all. That's all a consequence of, and a description of, freedom to contribute as and when you want. If and when people start saying that they particularly request the help of X on this, all that is undermined. People could start to say, "Maarten Buis is a star on this and as a special favour I would appreciate his looking at my question", or Bill Gould, or any other named person. All that would do, beyond any mild or strong flattery implied, is just change the flavour of the list, put extra pressure on extraordinarily busy people, and so forth. It also follows that no one need explain why they don't want to (continue to) contribute to a thread. People can be too busy, no longer interested, not understand the further questions, feel they have nothing extra to say, feel it is a case for more self-help, be in a bad mood, whatever; no matter, that's your private reason. Nick n.j.cox@durham.ac.uk -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Pavlos C. Symeou Sent: 24 January 2012 14:05 To: statalist@hsphsun2.harvard.edu Cc: Nick Cox Subject: Re: st: Calculating an Index Dear Nick, thank you the advice. I 've just ordered Kit Baum's book and started looking into the Mata reference manual that comes with Stata. But before I manage to reach a satisfactory level of programming competence that will allow me to deal with this and future problems I would appreciate it if for this time you could help me with the solution. Hopefully, this will be the last time I have to ask for assistance:) Best wishes, Pavlos On Δευτέρα, 23 Ιανουάριος 2012 11:51:50 πμ, Nick Cox wrote: > > This has the same flavour as the previous problem so you should be > able to adapt the previous solutions, or whichever one you adopted. > > My own view implicit in > > http://www.stata.com/statalist/archive/2012-01/msg00428.html > > is that your problem is very awkward without Mata and much less > awkward with it. So, that advice would require you to learn more > about > Mata and I really can't give enough detail in a posting to > explain all > that you need to know. I'd recommend that you study Kit Baum's > excellent book > > http://www.stata.com/bookstore/stata-programming-introduction > > and William Gould's authoritative columns on Mata matters in the > Stata > Journal in addition to [M]. > > Nick > > On Sun, Jan 22, 2012 at 9:05 PM, Pavlos C. > Symeou<p.symeou@gmail.com> wrote: >> >> Dear Statlisters, >> >> Nick and Antonios kindly responded to a similar problem I >> encountered last >> week. I hope I can also find some assistance with the following >> problem >> which is a bit more complex. I don't know much about programming >> (e.g. using >> mata) I would appreciate it if you could explain your code so >> that I can >> adjust it in future problems. This way I will avoid to annoy you >> with >> similar problems. >> >> Here it goes. I have data for a number of firms for multiple >> years per firm. >> Each firm operates in a number of markets each year. A market's >> identifier >> is denoted by a 3-digit number. I want to calculate a new >> variable "index" >> as follows: >> >> 1) for each company-year I take the sales_ratio of each market >> and multiply >> it with each other market's sales ratio: >> >> a) If the identifiers of the two markets are the same, then I >> multiply their >> product with 1. >> b) If the identifiers of the two markets have the same first 2 >> digits (i.e. >> they differ in the 3rd digit), then I multiply their product with 2. >> c) If the identifiers of the two markets have the same first >> digit but >> differ in all others, then I multiply their product with 3. >> d) If the identifiers of the two markets differ in the first >> digit, then I >> multiply their product with 4. >> >> The "index" variable equals the sum of a, b, c, and d. >> >> From the example data below, the Index for Firm 1 in Year 1996 >> should be: >> (0.071 * 0.14 * 4) + (0.071 * 0.071 * 4) + (0.071 * 0.29 * 4) + >> (0.14 * >> 0.071 * 3) + (0.14 * 0.29 * 3) +(0.071 * 0.29 * 2) = 0.335 >> >> firm_id year market sales_ratio >> 1 1996 262 .071 >> 1 1996 349 .14 >> 1 1996 353 .071 >> 1 1996 357 .29 >> 1 1997 382 .36 >> 1 1997 733 .071 >> 1 1997 262 .5 >> 1 1997 353 .5 >> 1 1998 349 .15 >> 1 1998 357 .31 >> 1 1998 365 .077 >> 1 1998 382 .38 >> 1 1998 733 .077 >> 2 1996 349 .13 >> 2 1996 357 .27 >> 2 1996 365 .067 >> 2 1996 366 .067 >> 2 1996 371 .067 >> 2 1996 382 .33 >> 2 1996 733 .067 >> * * 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: Index***From:*"Pavlos C. Symeou" <p.symeou@gmail.com>

**Re: st: Index***From:*A Loumiotis <antonis.loumiotis@gmail.com>

**st: Calculating an Index***From:*"Pavlos C. Symeou" <p.symeou@gmail.com>

**Re: st: Calculating an Index***From:*Nick Cox <njcoxstata@gmail.com>

**Re: st: Calculating an Index***From:*"Pavlos C. Symeou" <p.symeou@gmail.com>

- Prev by Date:
**Re: st: ice error** - Next by Date:
**st: file names in esttab, style(tex)** - Previous by thread:
**Re: st: Calculating an Index** - Next by thread:
**Re: st: Index** - Index(es):