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: Calculating an Index
Nick Cox <email@example.com>
RE: st: Calculating an Index
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.
From: firstname.lastname@example.org [mailto:email@example.com] On Behalf Of Pavlos C. Symeou
Sent: 24 January 2012 14:05
Cc: Nick Cox
Subject: Re: st: Calculating an Index
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:)
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
> is that your problem is very awkward without Mata and much less
> awkward with it. So, that advice would require you to learn more
> 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
> and William Gould's authoritative columns on Mata matters in the
> Journal in addition to [M].
> On Sun, Jan 22, 2012 at 9:05 PM, Pavlos C.
> Symeou<firstname.lastname@example.org> 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
>> 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
>> 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
>> 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: