Skip to content

PovertyAction/zindex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zindex

zindex was developed by the Global Poverty Research Lab at Northwestern University, with support from Innovations for Poverty Action.

Installation

*zindex can be installed directly from Github
net install zindex, from("https://raw.githubusercontent.com/PovertyAction/zindex/master") replace 

* or using haghish's Github command
github install PovertyAction/zindex

Help File

Title

zindex -- Generates an index using z-scores

Syntax

zindex varlist [if] [in], gen(varname) [options]

options Description ------------------------------------------------------------------------- Main

* gen(varname) Name of index variable to be created

Optional

* mean(varlist) Variables that will be used to standardize against (e.g. baseline versions of main varlist)

* condition(string) A condition to specify a sub-group to standardize against (e.g. control group)

Description

zindex creates a z-score index. The resulting index is the z-score of the mean of each index components' z-scores. Steps of index creation:

1. Generate z-scores for each variable included in the index

2. Generate means of these z-scores

3. Create index by generating the z-score for the means of these z-scores

The mean() option allows you to specify a list of variables to standardize against. The means and SDs of this varlist will be used in the initial z-scores (in step 1 above) instead of the means and SDs of the main varlist specified for the index. The size of this varlist must be the same size as the main varlist specified for index. A common input is a list of the baseline versions of the index variables to standardize against the baseline values.

The condition() option allows you to specify a subgroup to standardize against. The condition is applied when taking the mean and SD of each variable going into the index (in step 1 above) and when taking the mean and SD of the means of the z-scores (in step 3 above). A common condition is "treatment == 0" to standardize against the control group.

[if] [in] restricts the sample used for ALL STEPS to the observations that meet the if/in condition. If {opt:condition()} is specified, only the observations that fulfill both {opt:condition()} and the if/in condition is used to calculate the mean and standard deviation for standardization.

Examples

sysuse citytemp.dta

Create an index of heat, not standardized against a different round or subgroup

zindex tempjan tempjuly heatdd, gen(hot_weather)

Standardize against the Northeast

zindex tempjan tempjuly heatdd, gen(hot_weather_NE) condition(region == 1) Calculate the index only for the Northeast. Note that hot_weather_NE and hot_weather_NE_only are the same for all cities in the Northeast, but hot_weather_NE_only does not have any values for cities outside of the Northeast.

zindex tempjan tempjuly heatdd if region == 1, gen(hot_weather_NE_only)

Standardize against January temperatures and days of cold

zindex tempjuly heatdd, gen(hot_weather_NE) mean(tempjan cooldd)

Stored results

zindex stores the following in r():

Scalars r(m_VAR) number of missing observations in VAR (one return value per variable in the index)

Authors

Caton Brewster Codecheck: Kelsey Larson

For questions or suggestions, submit a GitHub issue or e-mail researchsupport@poverty-action.org.

About

Creates standardized index variables

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors