Florian W. Chávez Juárez - Economics - Software


Florian Wendelspiess Chávez Juárez



Stay informed about this paper

By providing your e-mail address, I will keep you informed about new versions of this paper or an eventual publication.

Your e-Mail address: send
This website uses cookies. By using the website, you accept the use of cookies. Ok, I accept cookies  NO, I don't accept cookies


A Guide to Stata

pdf downloadThis document is intended to help new users of Stata to have an easy start and for more experienced user it might be useful as look-up references. For the latter use, please consider the extensive index in the end. Please check regularily for updated versions. [click on the pdf-symbol to download the file]. Current version: 1.7 (Released on May 18, 2015)

Free ado-files

Hereafter I propose some very simple ado-files that can be helpful in daily work with Stata. Download installation instructions here. Before using these files, please read the terms of use.

Name Description
kwstat kwstat computes sample statistics of a variable y in function of another variable x. The approach is inspired by the kernel regression (Nadaraya-Watson estimator) which computes the conditional mean of y in function of x. kwstat does the same but not only for the mean but also for the standard deviation, deciles, range, etc. Note that this procedure is an ad-hoc method and should be used in an exploratory way to visualize the data. It is not rooted in a well-defined statistical concept.

Just type ssc install kwstat in Stata to install it.
kernel kernel computes several kernel functions. The following kernel functions are included: epanechnikov, normal/gaussian, triangle, beta, logit, uniform, cosine, parzn. The module exports the estimated function as a new variable, which can then be used for various non-parametric estimation procedures.

Just type ssc install kernel in Stata to install it.
fmiss fmiss allows you to identify not only the total number missing values in each variable, but also how many of them are unique in the sense that for all other variables of the observation the information is available. This distinction is important to see which variable is causing a large drop int he sample size on its own. The module identifies missing value in numerical and string variable. For the case of numerical variables, also Stata-coded missing values (e.g. “.a”) are identified. Since a main issue of missing values is that it might introduce a sample selection problem, fmiss offers a very simple and purely introductive way to detect such problems. Using the option detail, a mean-comparison test between the original sample and the sample one would get by including the variable (this means dropping the unique missing values) is computed and variable where the difference is significant are reported.

Just type ssc install fmiss in Stata to install it.
shapley2 Shapley2 is a post-estimation command to compute the Shorrocks-Shapley decomposition of any statistic of the model (normally the R squared). Shapley2 can be used for most estimation commands, e.g. ols, probit, logit, oprobit. Compared to the user written command shapley, shapley2 is faster and enables you to compute the Shapley value by groups of variables. The results are stored as e()-matrices, allowing the user to use them afterwards, for instance to export them to LaTeX.

Just type ssc install shapley2 in Stata to install it.
iopThis routine implements different methodologies to compute ex-ante inequality of opportunity for binary, ordered and continuous variables. For binary and ordered variables the method proposed by Paes de Barros et al (2008) and a modification introduced by Wendelspiess Chávez Juárez & Soloaga (2013) are computed. For continuous variables the two approaches by Ferreira & Gignoux (2011, 2011b) are implemented. Additionally, iop allows you to compute the decomposition of the inequality of opportunity measures by groups (Oaxaca-like approach) and by explanatory factors (shapley like decomposition). IOP allows you to use fweights and iweights.

Related articles:
Wendelspiess Chávez Juárez & Soloaga (2014) Stata Journal.
Soloaga & Wendelspiess Chavez Juarez (2012) Application to Mexico in a book published by Stata Press.

Just type ssc install iop in Stata to install it.
ttesttable ttesttable is a very simple Stata module that performs a mean-comparison test (t-Test) for all possible combinations of groups defined by a variable. For instance, if you have 4 types of observations and you would like to see if there are differences in means between groups, this module computes the t-test for all six possible combinations. The output is presented in a table of differences in means and includes the significance level of the t-test. This table can be exported directly as a LaTeX file and the underlying matrices are available for further use in Stata.

Just type ssc install ttesttable in Stata to install it.
frank This command creates a new variable with the fractional rank based on an existing variable. The command is based on Stata's egen command rank(), then computed the fractional version of this rank, using the formula Frank = (RANK-min)/(max-min). The name of the new variable can be chosen by the user.
makecross This ado-file generates cross variables, e.g. the cross variable of income with a gender dummy gives you: incomeXgender. The ado-file can generate a large number of cross variable using only one command!
makesq This ado-file generates squared variables of the varlist you indicate. You can choose the way the new variables are called.
maxmin This ado-file computes the maximum/minimum value of a independent variable that was used in a regression in linear and quadratic terms. Additionally the ado-file provide the option to give you a graphical output.