Search
   >> Home >> Products >> Features >> User-written commands

What’s Hot on the SSC archive
video: How to download and install user-written commands in Stata

User-written commands

The Stata community is represented by a diverse group of researchers from a broad spectrum of fields, from anthropology to biostatistics, economics, finance, political science, psychology, public health, sociology, survey research, and zoology. Stata’s programming language lets users write commands that behave just like official Stata commands, and many users make their commands available to others through channels such as the Stata Journal, the SSC archive, or their own website. Stata’s search, net search, and ssc commands make finding and installing those commands a snap. So even if you don’t see something listed on our Features page, another user may have already written and made available a command to solve your problem.

Stata’s user-written commands are supported by the people who wrote them. StataCorp does not certify the validity of these commands, nor do we offer technical support for them. However, many of the authors are also members of the Statalist forum, and user-written commands are a frequent topic of discussion.

The number of available user-written commands is ever-growing, so even if a command is not currently available for your task, one may appear in the future. If you have installed Stata, you can easily locate a user-written command by using the search command to conduct a search based on keywords you specify. For example, say that you want to produce a forest plot, a type of graph common to meta-analysis. In Stata, you can type

       . search forest plot

You will then be presented with a list of potentially suitable commands, and you can click on the blue links to read more about them and to install them. If you do not yet have Stata, you can search the SSC archive. The SSC archive contains many, though not all, user-written commands.

Below we highlight just some of the categories of user-written commands available.

Meta-analysis

In medical disciplines, such as oncology or cardiology, many studies of the same disease or treatment are performed. Meta-analysis is the use of statistical techniques to combine results from different studies, and many user-written commands have been produced in this area, including commands for tests for heterogeneity, cumulative pooled estimates, meta-analysis regression, tests for publication bias, funnel plots, forest plots, and L’Abbe plots.

See Meta-Analysis in Stata: An Updated Collection from the Stata Journal, edited by Jonathan A. C. Sterne.

Treatment effects

Did participants in a training program obtain wages higher than their peers who did not participate? Treatment-effects estimators are used to measure the impact of an event, controlling for confounding factors such as age, gender, or level of education. Because of their frequent use, particularly in economics, many of these estimators are available in Stata via user-written commands. Nearest-neighbor and propensity-score matching commands exist, as do commands for evaluating the sensitivity of the estimators to violations of various assumptions, and commands for extensions of the basic model to multinomial treatments in which subjects could have received one of several alternative treatments.

Output generation

Ultimately, we need to communicate our results to others, and researchers typically do this by presenting tables of summary statistics and estimation results. Different disciplines and journals have their own styles, and an array of user-written commands for producing output exists to satisfy virtually all tastes. Whether you write reports in Word or LaTeX, or you want to transfer output to Excel spreadsheets, a user-written command likely exists to fit your needs.

Limited dependent-variable models

Not all dependent variables are continuous. Some are binary. Some are ordered. Some represent counts. Some are censored. Some are subject to sample selection. While Stata includes a spectrum of commands to handle such variables, the number of existing models is overwhelming and continues to grow. Fortunately, Stata’s built-in capability for programming maximum likelihood estimators makes implementing new models straightforward for user-programmers. Scores of user-written commands for limited dependent-variable models are now available for cross-sectional, panel, and multilevel datasets.

Survival analysis

The focus of survival analysis is to model the amount of time required for an event to occur. Stata’s built-in survival analysis commands are widely recognized to be among the best in the industry, and practitioners have written additional commands to round out Stata’s offerings. Many user-written commands are available for cure and relative-risk models, discrete-time proportional-hazards models, and flexible parametric models.

Data management

When starting a research project, the data are almost never in the form you would like. Stata’s built-in data-management facilities are renowned, but you may come across a dataset that requires a custom level of manipulation beyond what you think Stata can do. Another Stata user has probably faced the same problem already and has made available a command to do the “heavy lifting”. Whether you need to convert data from a GIS program, manipulate value labels in your dataset, apply a linear filter, or create a complicated indicator variable, a user-written command is probably available to help.

Multilevel and correlated data

Pupils are clustered within classrooms, which are clustered within schools, which are clustered within school districts. Consumers are clustered within neighborhoods, which are nested within towns, which are nested within metropolitan areas. Many datasets have observations that are nested within one or more larger groupings. Ignoring the correlations inherent in such data can result in inefficient or biased results. In addition to Stata’s built-in commands for multilevel mixed-effects linear regression, logit, and Poisson models, many user-written commands exist for multilevel data.

Econometrics

Econometricians frequently develop new estimators and tests, which are then implemented by Stata users. A variety of user-written commands is available for instrumental-variables estimation, panel-data unit-root tests, inequality measurement, and wage decompositions, to mention just a few areas of development.

Statistical graphs

Stata’s flexible graphics engine has motivated users to develop a variety of statistical graphs. Whether you need a specialized regression diagnostic plot to analyze the fit of your model, a plot of the cumulative distribution of a variable, a cycle plot to examine seasonality, a spine plot of two-way categorical data, a Bland–Altman plot to compare two assays, or a choropleth to map the spatial distribution of poverty, another Stata user has probably written the command you need.

More

Spatial data visualization. Marginal effects. Univariate and multivariate statistical tests. The range of user-written commands available is as diverse as the people who use Stata. Regardless of your field of study, there are user-written commands that will complement your Stata experience.

Stata’s user-written commands are supported by the people who wrote them. StataCorp does not certify the validity of these commands, nor do we offer technical support for them. StataCorp does not offer a warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose or any command’s statistical or other accuracy.

The Stata Blog: Not Elsewhere Classified Find us on Facebook Follow us on Twitter LinkedIn Google+ Watch us on YouTube