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: Creating a varible equal to the means of subpopulations


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: Creating a varible equal to the means of subpopulations
Date   Sun, 16 Feb 2014 15:05:42 +0000

This is an FAQ.

How do I create variables summarizing for each individual properties
of the other members of a group?
http://www.stata.com/support/faqs/data-management/creating-variables-recording-properties/

The Statalist FAQ advises scrutiny of the Stata FAQs before posting.

In this case, the key is

sum of others = sum of all - this value

number of others = number of all - 1

watching out for missing values.

Nick
[email protected]

On 16 February 2014 14:51, Fredrik Vest <[email protected]> wrote:

> I have a panel with 19 regions over 25 years, and I want to generate a
> variable equal to the mean of X in all regions except one. To be more
> precise; all observations should equal the mean of X that year,
> excluding the region corresponding to that cell.
> Something like this: For observation "region 1, year 1": my variable
> should equal the mean of X for year 1 for all regions but region 1.
> For observation "region g, year t": my variable should equal the mean
> of X for year t for all regions but region g.
> The idea is to compare the value of an observation in a region with
> the mean of the observations in all the other regions within the same
> year.
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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