|(12 intermediate revisions by 3 users not shown)|
<span style="color:#ff0000"> '''NOTE: this article is only a template. Please add content!''' </ span>
add introductory 1-2 sentences here
Read First ==
* include here key points you want to make sure all readers understand
* organize information on the topic into subsections. for each subsection, include a brief description / overview, with links to articles that provide details
the , a to
== Back to Parent ==
== Back to Parent ==
This article is part of the topic [[
*topic name, as listed on main page*]]
This article is part of the topic []
== Additional Resources ==
list here other articles related to this topic, with a brief description and link
*category name* ]]
Aggregation is the compilation of many values to create one aggregate value. It takes place during data construction, which occurs between data cleaning and data analysis. This page provides common cases of aggregation and outlines best practices.
- Make sure to use specialized commands for aggregation like Stata’s
egen rowtotal() to avoid errors.
- After aggregating, check if any missing values were created. If they were, make sure you can explain why.
Common Cases of Aggregation
Questionnaires often split variables into categories in order to help respondents recall information more exhaustively and according to the researcher’s definitions. For example, even if a researcher is only interested in total income, he/she may design the questionnaire to ask about categories of income (i.e. agricultural wages, non-agricultural wages, self-employment, crop production, livestock production, transfers, and other income). He/she we will then aggregate these category values later.
To properly aggregate categories in survey data, make sure to clean the categories for survey codes and to use commands that properly handle missing data like
Questionnaires often ask the same question over a number of repeated instances. For example, a questionnaire may repeat through a list of crops that a household cultivates and ask for the annual income earned on each. To calculate total income earned on crops, the researcher would then aggregate these group values.
Aggregating repeat groups introduces issues similar to those described above, but missing values are even more common. Accordingly, be sure to clean the categories for survey codes and use commands that properly handle missing data like
Use Specialized Commands
Do not manually aggregate variables. Code like
gen var_aggregate = var1 + var2 + var3 would lead to many
var_aggregate values incorrectly reported as missing, since most programming languages would consider
var_aggregate as missing if any one of
var3 were missing. Instead, use the
egen Stata command, which treats missing values as 0. For example:
egen total_income = rowtotal(income1, income2, income3). In R, use the
If your variables have units, make sure that your variables are standardized to the same unit before aggregating.
Avoid Double Corrections
If you have applied adjustments, transformations, or normalizations to the disaggregated variables, it is not typically a good idea to apply the same adjustments to the aggregated value.
Back to Parent
This article is part of the topic Data Analysis
- More details on how Stata handles missing values
- Stata’s manual on
- FAO’s guide on constructing income aggregates
- UCLA’s guide on collapsing data across observations to create summary statistics