Difference between revisions of "Randomization in Stata"

Jump to: navigation, search
Line 21: Line 21:
This article is part of the topic [[Randomized Control Trials]]
This article is part of the topic [[Randomized Control Trials]]


[Category: Impact Evaluation Design]
[[Category: Impact Evaluation Design]]

Revision as of 15:33, 25 January 2017

Why use Stata to randomize

Using Stata to randomize and then preloading the generated data file into the survey software is the better option among the two. The main advantages of using Stata during randomization are as follows:

  • Randomization in Stata is transparent and reproducible which is important for publishing research.
  • Randomization in Stata is done before the survey takes place. This provides an opportunity to double check the result of a randomization and fix bugs before using the software in the field.
  • Randomization in Stata provides the option of ensuring balance in the dataset i.e. it helps the researcher randomize while preserving the overall demographic/characteristic balances.

Steps on effectively using Stata to randomize survey questionnaire

Here are a few steps that should be followed to create a reproducible randomization using Stata:

  • Use a dataset which has a unique ID [respondent ID, household number, etc.]
  • While writing a do-file, pay close attention to the following things:
    • Set version. Setting Stata's version in a do file ensures that the randomization algorithm is the same, as it sometimes changes between Stata versions.
      For example - version 12.0
    • Set seed. This makes sure that the same random number is generated for the first observation, for the second observation, and so on, for every time the code is run.
      For example - set seed 12345
    • Properly sorting the data. The data should be sorted such that observations are in the same order every time the code is run. The most optimal situation is sorting using an ID variable which uniquely and fully identifies each observation.
  • Convert the random numbers into categorical variables or dummy variables. This helps you check if the data is balanced.

The end goal is to have a CSV format file containing the ID variable used for randomization and the categorical variables created from the random numbers generated. This dataset will be preloaded into SurveyCTO, so that after an enumerator enters the respondent ID at the start of a survey, the result of the randomization will be loaded for the form and can be used for various sections of the survey.

Back to Parent

This article is part of the topic Randomized Control Trials