Difference between revisions of "Randomization in Stata"
Mrijanrimal (talk | contribs) (Created page with "**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...") |
Mrijanrimal (talk | contribs) |
||
Line 1: | Line 1: | ||
==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: | Here are a few steps that should be followed to create a reproducible randomization using Stata: |
Revision as of 16:03, 24 January 2017
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. This ensures that the randomization algorithm is the same, as it sometimes changes between Stata versions.
- 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.
- 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.