This project aims to provide simple code fragments for everyday data analysis tasks in Stata and in R. The ultimate goal is to make conversion between the two software packages easier.
The inspiration for this project is the Data Analysis Examples website made by the Statistical Consulting Group at UCLA.
The tasks are structured in the following four categories:
- Reading/writing data
- Data munging (recoding/cleaning)
- Computing statistical models
- Presenting results
There is a "standalone" and a "short" example for each task. The standalone example contains all the necessary commands to run the example (reading data, loading addons, etc.). The short example is just the code for the specific task (the standalone code without preparatory/unrelated steps).
The standalone code can be in the Rmd format. This allows for nicer explanations of what the code does than comments in the script files.
The file naming follows the scheme:
- adding-vars.{do,md}
- adding-vars-short.do
- adding-vars.{r,Rmd}
- addings-vars-short.r
The data on European Representative Democracies that is used in all the examples is compiled and kindly made available by Staffan Andersson, Torbjörn Bergman and Svante Ersson. The full citation is:
Andersson, Staffan; Bergman, Torbjörn & Ersson, Svante (2012). “The European Representative Democracy Data Archive”. Main sponsor: Riksbankens Jubileumsfond (In2007-0149:1-E). Principal investigator: Torbjörn Bergman. [www.erdda.se]
We have made some preliminary data cleaning steps mainly annotating
variables with their names from the codebook. The relevant scripts are
in the data-prep
folder.
Code was either written by Marco Steenbergen or by Christian Müller. Christian Müller maintains the git repository.
- Data Analysis Examples by the Statistical Consulting Group at UCLA
- to be extended
The data files are copyright (c) 2012-2013 by Staffan Andersson, Torbjörn Bergman and Svante Ersson. They may only be redistributed under the terms specified at erdda.se.
All code that is written for this project is licensed under the CC-BY licence:
stata2r by Marco Steenbergen and Christian Müller is licensed under a Creative Commons Attribution 3.0 Unported License.