bluuebunny/crossref_metadata_2025 huggingface dataset:
Maximum Likelihood and Two-Step Estimation of an Ordered-Probit Selection Model
Authors: Chiburis Richard , Lokshin Michael
Published: November 2018

We discuss the estimation of a regression model with an ordered-probit selection rule. We have written a Stata command, oheckman, that computes two-step and full-information maximum-likelihood estimates of this model. Using Monte Carlo simulations, we compare the performances of these estimators under various conditions.
Two Postestimation Commands for Assessing Confounding Effects in Epidemiological Studies
Authors: Wang Zhiqiang
Published: November 2018

Confounding is a major issue in observational epidemiological studies. This paper describes two postestimation commands for assessing confounding effects. One command (confall) displays and plots all possible effect estimates against one of p-value, Akaike information criterion, or Bayesian information criterion. This computing-intensive procedure allows researchers to inspect the variability of the effect estimates from various possible models. Another command (chest) uses a stepwise approach to identify variables that have substantially changed the effect estimate. Both commands can be used after most common estimation commands in epidemiological studies, such as logistic regression, conditional logistic regression, Poisson regression, linear regression, and Cox proportional hazards models.
QIC Program and Model Selection in GEE Analyses
Authors: Cui James
Published: November 2018

The generalized estimating equation (GEE) approach is a widely used statistical method in the analysis of longitudinal data in clinical and epidemiological studies. It is an extension of the generalized linear model (GLM) method to correlated data such that valid standard errors of the parameter estimates can be drawn. Unlike the GLM method, which is based on the maximum likelihood theory for independent observations, the gee method is based on the quasilikelihood theory and no assumption is made about the distribution of response observations. Therefore, Akaike's information criterion, a widely used method for model selection in glm, is not applicable to gee directly. However, Pan (Biometrics 2001; 57: 120–125) proposed a model-selection method for gee and termed it quasilikelihood under the independence model criterion. This criterion can also be used to select the best-working correlation structure. From Pan's methods, I developed a general Stata program, qic, that accommodates all the distribution and link functions and correlation structures available in Stata version 9. In this paper, I introduce this program and demonstrate how to use it to select the best working correlation structure and the best subset of covariates through two examples in longitudinal studies.
Making Regression Tables Simplified
Authors: Jann Ben
Published: November 2018

estout, introduced by Jann (Stata Journal 5: 288–308), is a useful tool for producing regression tables from stored estimates. However, its syntax is relatively complex and commands may turn out long even for simple tables. Furthermore, having to store the estimates beforehand can be cumbersome. To facilitate the production of regression tables, I therefore present here two new commands called eststo and esttab. eststo is a wrapper for official Stata's estimates store and simplifies the storing of estimation results for tabulation. esttab, on the other hand, is a wrapper for estout and simplifies compiling nice-looking tables from the stored estimates without much typing. I also provide updates to estout and estadd.
Review of a Handbook of Statistical Analyses Using Stata, Fourth Edition, by Rabe-Hesketh and Everitt
Authors: Dupont William D.
Published: November 2018

This article reviews A Handbook of Statistical Analyses Using Stata, Fourth Edition, by Sophia Rabe-Hesketh and Brian S. Everitt.
Speaking Stata: Turning over a New Leaf
Authors: Cox Nicholas J.
Published: November 2018

Stem-and-leaf displays have been widely taught since John W. Tukey publicized them energetically in the 1970s. They remain useful for many distributions of small or modest size, especially for showing fine structure such as digit preference. Stata's implementation stem produces typed text displays and has some inevitable limitations, especially for comparison of two or more displays. One can re-create stem-and-leaf displays with a few basic Stata commands as scatterplots of stem variable versus position on line with leaves shown as marker labels. Comparison of displays then becomes easy and natural using scatter, by(). Back-to-back presentation of paired displays is also possible. I discuss variants on standard stem-and-leaf displays in which each distinct value is a stem, each distinct value is its own leaf, or axes are swapped. The problem shows how one can, with a few lines of Stata, often produce standard graph forms from first principles, allowing in turn new variants. I also present a new program, stemplot, as a convenience tool.
Metan: Fixed- and Random-Effects Meta-Analysis
Authors: Harris Ross J. , Deeks Jonathan J. , Altman Douglas G. , Bradburn Michael J. , Harbord Roger M. , Sterne Jonathan A. C.
Published: November 2018

This article describes updates of the meta-analysis command metan and options that have been added since the command's original publication (Bradburn, Deeks, and Altman, metan – an alternative meta-analysis command, Stata Technical Bulletin Reprints, vol. 8, pp. 86–100). These include version 9 graphics with flexible display options, the ability to meta-analyze precalculated effect estimates, and the ability to analyze subgroups by using the by() option. Changes to the output, saved variables, and saved results are also described.
Mata Matters: Overflow, Underflow and the IEEE Floating-Point Format
Authors: Linhart Jean Marie
Published: November 2018

Mata is Stata's matrix language. The Mata Matters column shows how Mata can be used interactively to solve problems and as a programming language to add new features to Stata. In this quarter's column, we investigate underflow and overflow and then delve into the details of how floating-point numbers are stored in the IEEE 754 floating-point standard. We show how to test for overflow and underflow. We demonstrate how to use the %21x format to see underflow and the %16H, %16L, %8H, and %8L formats for displaying the byte content of doubles and floats.
Speaking Stata: Correlation with Confidence, or Fisher's z revisited
Authors: Cox Nicholas J.
Published: November 2018

Ronald Aylmer Fisher suggested transforming correlations by using the inverse hyperbolic tangent, or atanh function, a device often called Fisher's z transformation. This article reviews that function and its inverse, the hyperbolic tangent, or tanh function, with discussions of their definitions and behavior, their use in statistical inference with correlations, and how to apply them in Stata. Examples show the use of Stata and Mata in calculator style. New commands corrci and corrcii are also presented for correlation confidence intervals. The results of using bootstrapping to produce confidence intervals for correlations are also compared. Various historical comments are sprinkled throughout.
A Closer Examination of Subpopulation Analysis of Complex-Sample Survey Data
Authors: West Brady T. , Berglund Patricia , Heeringa Steven G.
Published: November 2018

In recent years, general-purpose statistical software packages have incorporated new procedures that feature several useful options for design-based analysis of complex-sample survey data. A common and frequently desired technique for analysis of survey data in practice is the restriction of estimation to a subpopulation of interest. These subpopulations are often referred to interchangeably in a variety of fields as subclasses, subgroups, and domains. In this article, we consider two approaches that analysts of complex-sample survey data can follow when analyzing subpopulations; we also consider the implications of each approach for estimation and inference. We then present examples of both approaches, using selected procedures in Stata to analyze data from the National Hospital Ambulatory Medical Care Survey (NHAMCS). We conclude with important considerations for subpopulation analyses and a summary of suggestions for practice.
Accommodating Covariates in Receiver Operating Characteristic Analysis
Authors: Janes Holly , Longton Gary , Pepe Margaret S.
Published: November 2018

Classification accuracy is the ability of a marker or diagnostic test to discriminate between two groups of individuals, cases and controls, and is commonly summarized by using the receiver operating characteristic (roc) curve. In studies of classification accuracy, there are often covariates that should be incorporated into the ROC analysis. We describe three ways of using covariate information. For factors that affect marker observations among controls, we present a method for covariate adjustment. For factors that affect discrimination (i.e., the ROC curve), we describe methods for modeling the ROC curve as a function of covariates. Finally, for factors that contribute to discrimination, we propose combining the marker and covariate information, and we ask how much discriminatory accuracy improves (in incremental value) with the addition of the marker to the covariates. These methods follow naturally when representing the ROC curve as a summary of the distribution of case marker observations, standardized with respect to the control distribution.
A General-purpose Method for Two-group Randomization Tests
Authors: Kaiser Johannes , Lacy Michael G.
Published: November 2018

We outline a novel approach to calculate exact p-levels for two-sample randomization tests. The approach closely resembles permute in its applications, with the main difference being that the results are approximated only if the execution time needed to calculate exact p-levels would exceed a specified maximum. We demonstrate its use by deriving p-levels for the significance of Somers’ D, the coefficient of variation, the difference in means and in medians, and the difference in two multinomials.
How to do Xtabond2: An Introduction to Difference and System GMM in Stata
Authors: Roodman David
Published: November 2018

The difference and system generalized method-of-moments estimators, developed by Holtz-Eakin, Newey, and Rosen (1988, Econometrica 56: 1371–1395); Arellano and Bond (1991, Review of Economic Studies 58: 277–297); Arellano and Bover (1995, Journal of Econometrics 68: 29–51); and Blundell and Bond (1998, Journal of Econometrics 87: 115–143), are increasingly popular. Both are general estimators designed for situations with “small T, large N″ panels, meaning few time periods and many individuals; independent variables that are not strictly exogenous, meaning they are correlated with past and possibly current realizations of the error; fixed effects; and heteroskedasticity and autocorrelation within individuals. This pedagogic article first introduces linear generalized method of moments. Then it describes how limited time span and potential for fixed effects and endogenous regressors drive the design of the estimators of interest, offering Stata-based examples along the way. Next it describes how to apply these estimators with xtabond2. It also explains how to perform the Arellano–Bond test for autocorrelation in a panel after other Stata commands, using abar. The article concludes with some tips for proper use.
Metandi: Meta-analysis of Diagnostic Accuracy Using Hierarchical Logistic Regression
Authors: Harbord Roger M. , Whiting Penny
Published: November 2018

Meta-analysis of diagnostic test accuracy presents many challenges. Even in the simplest case, when the data are summarized by a 2 x 2 table from each study, a statistically rigorous analysis requires hierarchical (multilevel) models that respect the binomial data structure, such as hierarchical logistic regression. We present a Stata package, metandi, to facilitate the fitting of such models in Stata. The commands display the results in two alternative parameterizations and produce a customizable plot. metandi requires either Stata 10 or above (which has the new command xtmelogit), or Stata 8.2 or above with gllamm installed.
Further Development of Flexible Parametric Models for Survival Analysis
Authors: Lambert Paul C. , Royston Patrick
Published: November 2018

Royston and Parmar (2002, Statistics in Medicine 21: 2175–2197) developed a class of flexible parametric survival models that were programmed in Stata with the stpm command (Royston, 2001, Stata Journal 1: 1–28). In this article, we introduce a new command, stpm2, that extends the methodology. New features for stpm2 include improvement in the way time-dependent covariates are modeled, with these effects far less likely to be over parameterized; the ability to incorporate expected mortality and thus fit relative survival models; and a superior predict command that enables simple quantification of differences between any two covariate patterns through calculation of time-dependent hazard ratios, hazard differences, and survival differences. The ideas are illustrated through a study of breast cancer survival and incidence of hip fracture in prostate cancer patients.
Speaking Stata: I. J. Good and Quasi-Bayes Smoothing of Categorical Frequencies
Authors: Cox Nicholas J.
Published: November 2018

I. J. Good (1916–2009) was a prolific scientist who contributed to many fields, mostly from a Bayesian standpoint. This column explains his idea of quasi-Bayes (a.k.a. pseudo-Bayes) estimation or smoothing of categorical frequencies in a contingency table, which is especially useful as a way of dealing with awkward sampling or random zeros. It shows how the method can be implemented, almost calculator-style, using a combination of Stata and Mata. Convenience commands qsbayesi and qsbayes are also introduced.
A statistician's perspective on “Mostly Harmless Econometrics: An Empiricist's Companion”, by Joshua D. Angrist and Jörn-Steffen Pischke
Authors: Gelman Andrew
Published: November 2018

This article reviews Mostly Harmless Econometrics: An Empiricist's Companion, by Joshua D. Angrist and Jörn-Steffen Pischke.
Confirmatory Factor Analysis using Confa
Authors: Kolenikov Stanislav
Published: November 2018

This article describes the confa command, which fits confirmatory factor analysis models by maximum likelihood and provides diagnostics for the fitted models. Descriptions of the command and its options are given, and some illustrative examples are provided.
Graphical Representation of Multivariate Data using Chernoff Faces
Authors: Raciborski Rafal
Published: November 2018

Chernoff (1971, Technical Report 71, Department of Statistics, Stanford University; 1973, Journal of the American Statistical Association 68: 361– 368) proposed the use of cartoon-like faces to represent points in k dimensions. This article describes a Stata implementation of a face-generating algorithm using the method proposed by Flury (1980, Technical Report 3, Institute of Mathematical Statistics and Actuarial Science, Bern University), Schüpbach (1987, Technical Report 25, Institute of Mathematical Statistics and Acturial Science, Bern University), and Friendly (1991, http://www.math.yorku.ca/SCS/sasmac/faces.html ). I present examples of applying Chernoff faces to data clustering and outlier detection.
Improved Degrees of Freedom for Multivariate Significance Tests Obtained from Multiply Imputed, Small-Sample Data
Authors: Marchenko Yulia V. , Reiter Jerome P.
Published: November 2018

We propose improvements to existing degrees of freedom used for significance testing of multivariate hypotheses in small samples when missing data are handled using multiple imputation. The improvements are for 1) tests based on unrestricted fractions of missing information and 2) tests based on equal fractions of missing information with M ( p - 1) ≤ 4, where M is the number of imputations and p is the number of tested parameters. Using the mi command available as of Stata 11, we demonstrate via simulation that using these adjustments can result in a more sensible degrees of freedom (and hence closer-to-nominal rejection rates) than existing degrees of freedom.
A Seasonal Unit-Root Test with Stata
Authors: Depalo Domenico
Published: November 2018

Many economic time series exhibit important systematic fluctuations within the year, i.e., seasonality. In contrast to usual practice, I argue that using original data should always be considered, although the process is more complicated than that of using seasonally adjusted data. Motivations to use unadjusted data come from the information contained in their peaks and troughs and from economic theory. One major complication is the possible unit root at seasonal frequencies. In this article, I tackle the issue of implementing a test to identify the source of seasonality. In particular, I follow Hylleberg et al. (1990, Journal of Econometrics 44: 215–238) for quarterly data.
Nonparametric Testing of Distributions—the Epps–Singleton Two-Sample Test using the Empirical Characteristic Function
Authors: Goerg Sebastian J. , Kaiser Johannes
Published: November 2018

In statistics, two-sample tests are used to determine whether two samples have been drawn from the same population. An example of such a test is the widely used Kolmogorov–Smirnov two-sample test. There are other distribution-free tests that might be applied in similar occasions. In this article, we describe a two-sample omnibus test introduced by Epps and Singleton, which usually has a greater power than the Kolmogorov–Smirnov test although it is distribution free. The superiority of the Epps–Singleton characteristic function test is illustrated in two examples. We compare the two tests and supplement this contribution with a Stata implementation of the omnibus test.
Multiple Imputation of Missing Values: Further Update of Ice, with an Emphasis on Categorical Variables
Authors: Royston Patrick
Published: November 2018

Multiple imputation of missing data continues to be a topic of considerable interest and importance to applied researchers. In this article, the ice package for multiple imputation by chained equations (also known as fully conditional specification) is further updated. Special attention is paid to categorical variables. The relationship between ice and the new multiple-imputation system in Stata 11 is clarified.
Speaking Stata: Creating and Varying Box Plots
Authors: Cox Nicholas J.
Published: November 2018

Box plots have been a standard statistical graph since John W. Tukey and his colleagues and students publicized them energetically in the 1970s. In Stata, graph box and graph hbox are commands available to draw box plots, but sometimes neither is sufficiently flexible for drawing some variations on standard box plot designs. This column explains how to use egen to calculate the statistical ingredients needed for box plots and twoway to re-create the plots themselves. That then allows variations such as adding means, connecting medians, or showing all data points beyond certain quantiles.
Cem: Coarsened Exact Matching in Stata
Authors: Blackwell Matthew , Iacus Stefano , King Gary , Porro Giuseppe
Published: November 2018

In this article, we introduce a Stata implementation of coarsened exact matching, a new method for improving the estimation of causal effects by reducing imbalance in covariates between treated and control groups. Coarsened exact matching is faster, is easier to use and understand, requires fewer assumptions, is more easily automated, and possesses more attractive statistical properties for many applications than do existing matching methods. In coarsened exact matching, users temporarily coarsen their data, exact match on these coarsened data, and then run their analysis on the uncoarsened, matched data. Coarsened exact matching bounds the degree of model dependence and causal effect estimation error by ex ante user choice, is monotonic imbalance bounding (so that reducing the maximum imbalance on one variable has no effect on others), does not require a separate procedure to restrict data to common support, meets the congruence principle, is approximately invariant to measurement error, balances all nonlinearities and interactions in sample (i.e., not merely in expectation), and works with multiply imputed datasets. Other matching methods inherit many of the coarsened exact matching method's properties when applied to further match data preprocessed by coarsened exact matching. The cem command implements the coarsened exact matching algorithm in Stata.
Partial Effects in Probit and Logit Models with a Triple Dummy-Variable Interaction Term
Authors: Cornelißen Thomas , Sonderhof Katja
Published: November 2018

In nonlinear regression models, such as probit or logit models, coefficients cannot be interpreted as partial effects. The partial effects are usually nonlinear combinations of all regressors and regression coefficients of the model. We derive the partial effects in such models with a triple dummy-variable interaction term. The formulas derived here are implemented in the Stata inteff3 command. The command also applies the delta method to compute the standard errors of the partial effects. We illustrate the use of the command with an empirical application, analyzing how the gender gap in labor-market participation is affected by the presence of children and a university degree. We find that the presence of children increases the gender gap in labor-market participation but that this increase is smaller for more highly educated individuals.
Direct and Indirect Effects in a Logit Model
Authors: Buis Maarten L.
Published: November 2018

In this article, I discuss a method by Erikson et al. (2005, Proceedings of the National Academy of Science 102: 9730–9733) for decomposing a total effect in a logit model into direct and indirect effects. Moreover, I extend this method in three ways. First, in the original method the variable through which the indirect effect occurs is assumed to be normally distributed. In this article, the method is generalized by allowing this variable to have any distribution. Second, the original method did not provide standard errors for the estimates. In this article, the bootstrap is proposed as a method of providing those. Third, I show how to include control variables in this decomposition, which was not allowed in the original method. The original method and these extensions are implemented in the ldecomp command.
Power Transformation via Multivariate Box–Cox
Authors: Lindsey Charles , Sheather Simon
Published: November 2018

We present a new Stata estimation program, mboxcox, that computes the normalizing scaled power transformations for a set of variables. The multivariate Box–Cox method (defined in Velilla, 1993, Statistics and Probability Letters 17: 259–263; used in Weisberg, 2005, Applied Linear Regression [Wiley]) is used to determine the transformations. We demonstrate using a generated example and a real dataset.
Mata Matters: Stata in Mata
Authors: Gould William
Published: November 2018

Mata is Stata's matrix language. In the Mata Matters column, we show how Mata can be used interactively to solve problems and as a programming language to add new features to Stata. The subject of this column is using Mata to solve data analysis problems with the new Stata commands putmata and getmata, which were added to official Stata 11 in the update of 11 February 2010.
Model Fit Assessment via Marginal Model Plots
Authors: Lindsey Charles , Sheather Simon
Published: November 2018

We present a new Stata command, mmp, that generates marginal model plots (Cook and Weisberg, 1997, Journal of the American Statistical Association 92: 490–499) for a regression model. These plots allow for the comparison of the fitted model with a nonparametric or semiparametric model fit. The user may precisely specify how the alternative fit is computed. Demonstrations are given for logistic and linear regressions, using the lowess smoother to generate the alternate fit. Guidelines for the use of mmp under different models (through glm and other commands) and different smoothers (such as lpoly) are also presented.
Data Envelopment Analysis
Authors: Ji Yong-bae , Lee Choonjoo
Published: November 2018

In this article, we introduce a user-written data envelopment analysis command for Stata. Data envelopment analysis is a linear programming method for assessing the efficiency and productivity of units called decision-making units. Over the last decades, data envelopment analysis has gained considerable attention as a managerial tool for measuring performance of organizations, and it has been used widely for assessing the efficiency of public and private sectors such as banks, airlines, hospitals, universities, defense firms, and manufacturers. The dea command in Stata will allow users to conduct the standard optimization procedure and extended managerial analysis. The dea command developed in this article selects the chosen variables from a Stata data file and constructs a linear programming model based on the selected dea options. Examples are given to illustrate how one could use the code to measure the efficiency of decision-making units.
Speaking Stata: Finding Variables
Authors: Cox Nicholas J.
Published: November 2018

A standard task in data management is producing a list of variable names showing which variables have specific properties, such as being of string type, or having value labels attached, or having a date format. A first-principles strategy is to loop over variables, checking one by one which have the property or properties concerned. I discuss this strategy in detail with a variety of examples. A canned alternative is offered by the official command ds or by a new command, findname, published formally with this column.
Regression Analysis of Censored Data Using Pseudo-observations
Authors: Parner Erik T. , Andersen Per K.
Published: November 2018

We draw upon a series of articles in which a method based on pseudovalues is proposed for direct regression modeling of the survival function, the restricted mean, and the cumulative incidence function in competing risks with right-censored data. The models, once the pseudovalues have been computed, can be fit using standard generalized estimating equation software. Here we present Stata procedures for computing these pseudo-observations. An example from a bone marrow transplantation study is used to illustrate the method.
Translation from Narrative Text to Standard Codes Variables with Stata
Authors: Belotti Federico , Depalo Domenico
Published: November 2018

In this article, we describe screening, a new Stata command for data management that can be used to examine the content of complex narrative-text variables to identify one or more user-defined keywords. The command is useful when dealing with string data contaminated with abbreviations, typos, or mistakes. A rich set of options allows a direct translation from the original narrative string to a user-defined standard coding scheme. Moreover, screening is flexible enough to facilitate the merging of information from different sources and to extract or reorganize the content of string variables.
A Procedure to Tabulate and Plot Results after Flexible Modeling of a Quantitative Covariate
Authors: Orsini Nicola , Greenland Sander
Published: November 2018

The use of flexible models for the relationship between a quantitative covariate and the response variable can be limited by the difficulty in interpreting the regression coefficients. In this article, we present a new postestimation command, xblc, that facilitates tabular and graphical presentation of these relationships. Cubic splines are given special emphasis. We illustrate the command through several worked examples using data from a large study of Swedish men on the relation between physical activity and the occurrence of lower urinary tract symptoms.
Pointwise Confidence Intervals for the Covariate-adjusted Survivor Function in the Cox Model
Authors: Cefalu Matthew
Published: November 2018

A graphical representation of the pointwise confidence intervals allows a researcher to easily assess the precision of estimators. In the absence of covariates, the official command sts graph can be used to plot these intervals for the survivor function or the cumulative hazard function; however, in the presence of covariates, sts graph is insufficient. The user-written command survci can be used to plot the pointwise intervals for the survivor function after the Cox model. In this article, I describe the current and new features of survci. The new features include pointwise confidence intervals for the cumulative hazard function and the support of stratified Cox models, as well as factor variables; available as of Stata 11. I describe the methods used in calculating pointwise confidence intervals in the Cox model for both the covariate-adjusted survivor function and the covariate-adjusted cumulative hazard function. I also demonstrate the syntax of survci using Stata's example cancer dataset, cancer.dta.
Fitting Fully Observed Recursive Mixed-process Models with cmp
Authors: Roodman David
Published: November 2018

At the heart of many econometric models are a linear function and a normal error. Examples include the classical small-sample linear regression model and the probit, ordered probit, multinomial probit, tobit, interval regression, and truncated-distribution regression models. Because the normal distribution has a natural multidimensional generalization, such models can be combined into mul-tiequation systems in which the errors share a multivariate normal distribution. The literature has historically focused on multistage procedures for fitting mixed models, which are more efficient computationally, if less so statistically, than maximum likelihood. Direct maximum likelihood estimation has been made more practical by faster computers and simulated likelihood methods for estimating higher-dimensional cumulative normal distributions. Such simulated likelihood methods include the Geweke–Hajivassiliou-Keane algorithm (Geweke, 1989, Econometrica 57: 1317–1339; Hajivassiliou and McFadden, 1998, Econometrica 66: 863–896; Keane, 1994, Econometrica 62: 95–116). Maximum likelihood also facilitates a generalization to switching, selection, and other models in which the number and types of equations vary by observation. The Stata command cmp fits seemingly unrelated regressions models of this broad family. Its estimator is also consistent for recursive systems in which all endogenous variables appear on the right-hand sides as observed. If all the equations are structural, then estimation is full-information maximum likelihood. If only the final stage or stages are structural, then estimation is limited-information maximum likelihood. cmp can mimic a score of built-in and user-written Stata commands. It is also appropriate for a panoply of models that previously were hard to estimate. Heteroskedasticity, however, can render cmp inconsistent. This article explains the theory and implementation of cmp and of a related Mata function, ghk2(), that implements the Geweke–Hajivassiliou–Keane algorithm.
Poisson: Some Convergence Issues
Authors: Silva J. M. C. Santos , Tenreyro Silvana
Published: November 2018

In this article, we identify and illustrate some shortcomings of the poisson command in Stata. Specifically, we point out that the command fails to check for the existence of the estimates, and we show that it is very sensitive to numerical problems. While these are serious problems that may prevent users from obtaining estimates or may even produce spurious and misleading results, we show that the informed user often has simple workarounds available for addressing these problems.
Estimation of Ordered Response Models with Sample Selection
Authors: De Luca Giuseppe , Perotti Valeria
Published: November 2018

We introduce two new Stata commands for the estimation of an ordered response model with sample selection. The opsel command uses a standard maximum-likelihood approach to fit a parametric specification of the model where errors are assumed to follow a bivariate Gaussian distribution. The snpopsel command uses the semi-nonparametric approach of Gallant and Nychka (1987, Econometrica 55: 363–390) to fit a semiparametric specification of the model where the bivariate density function of the errors is approximated by a Hermite polynomial expansion. The snpopsel command extends the set of Stata routines for semi-nonparametric estimation of discrete response models. Compared to the other semi-nonparametric estimators, our routine is relatively faster because it is programmed in Mata. In addition, we provide new postestimation routines to compute linear predictions, predicted probabilities, and marginal effects. These improvements are also extended to the set of semi-nonparametric Stata commands originally written by Stewart (2004, Stata Journal 4: 27–39) and De Luca (2008, Stata Journal 8: 190–220). An illustration of the new opsel and snpopsel commands is provided through an empirical application on self-reported health with selectivity due to sample attrition.
M Statistic Commands: Interpoint Distance Distribution Analysis
Authors: Tebaldi Pietro , Bonetti Marco , Pagano Marcello
Published: November 2018

We implement the commands mstat and mtest to perform inference based on the M statistic, a statistic that can be used to compare the interpoint distance distribution across groups of observations.

The analyses are based on the study of the interpoint distances between n points in a k-dimensional setting to produce a one-dimensional real-valued test statistic. The locations are distributed in a region of the plane. When we consider all ( n2) interpoint distances, the dependencies among them are difficult to express analytically, but their distribution is informative, and the M statistic can be built to summarize one aspect of this information.

The two commands can be used on a wide class of data sets to test the null hypothesis that two groups have the same (spatial) distribution. mstat and mtest return the exact M test statistic. Moreover, mtest executes a Monte Carlo–type permutation test, which returns the empirical p-value together with its confidence interval. This is the command to use in most situations, because the convergence of M to its asymptotic chi-squared distribution is slow.

Both commands can be used to obtain graphical output of the empirical density function of the interpoint distance distributions in the two groups and the two-dimensional map of the n observations in the plane.

The descriptions of the commands are accompanied by examples of applications with real and simulated data. We run the test on the Alt and Vach grave site dataset (Manjourides and Pagano, forthcoming, Statistics in Medicine) and reject the null hypothesis, in contradiction to other published analyses. We also show how to adapt the techniques to discrete datasets with more than one unit in each location. Finally, we report an extensive application on breast cancer data in Massachusetts; in the application, we show the compatibility of the M commands with Pisati's spmap package.
Impact of Interventions on Discrete Outcomes: Maximum Likelihood Estimation of the Binary Choice Models with Binary Endogenous Regressors
Authors: Lokshin Michael , Sajaia Zurab
Published: November 2018

In this article, we describe the switch_probit command, which implements the maximum likelihood method to fit the model of the binary choice with binary endogenous regressors.
Comparing Coefficients of Nested Nonlinear Probability Models
Authors: Kohler Ulrich , Karlson Kristian Bernt , Holm Anders
Published: November 2018

In a series of recent articles, Karlson, Holm, and Breen (Breen, Karlson, and Holm, 2011, http://papers.ssrn.com/sol3/papers.cfm?abstractid=1730065 ; Karlson and Holm, 2011, Research in Stratification and Social Mobility 29: 221– 237; Karlson, Holm, and Breen, 2010, http://www.yale.edu/ciqle/Breen Scaling %20effects.pdf) have developed a method for comparing the estimated coefficients of two nested nonlinear probability models. In this article, we describe this method and the user-written program khb, which implements the method. The KHB method is a general decomposition method that is unaffected by the rescaling or attenuation bias that arises in cross-model comparisons in nonlinear models. It recovers the degree to which a control variable, Z, mediates or explains the relationship between X and a latent outcome variable, Y*, underlying the nonlinear probability model. It also decomposes effects of both discrete and continuous variables, applies to average partial effects, and provides analytically derived statistical tests. The method can be extended to other models in the generalized linear model family.
A New System for Formatting Estimation Tables
Authors: Gallup John Luke
Published: November 2018

I present an entirely rewritten version of the outreg command, which creates tables from the results of Stata estimation commands and generates formatted Microsoft Word or LATEX files. My objective is to provide as complete control as is practical over the layout and formatting of the estimation tables in both file formats. outreg provides a wide range of estimation statistics (including confidence intervals and marginal effects), can control the number and arrangement of the statistics displayed, and can merge subsequent estimation results into the same table. Users can specify numeric formats, font sizes, and font types at the table cell level, as well as lines in the table and row spacing. Multiple tables can be written to the same document, making it possible to create a fully formatted statistical appendix from a do-file. I demonstrate in examples the numerous formatting options for the outreg command.
Age–Period–Cohort Models in Stata
Authors: Sasieni Peter D.
Published: November 2018

In this article, I describe and illustrate Stata programs that facilitate i) the fitting of smooth age–period–cohort models to event data and ii) the plotting of observed and fitted rates. The programs include postestimation functionality and flexibility to fit models not possible using Stata's glm command. What distinguishes this article from a recent Stata Journal article on age–period–cohort models by Rutherford, Lambert, and Thompson (2010, Stata Journal 10: 606–627) is that the emphasis here is on extrapolating the model fit to make projections into the future.
Estimating Panel Time-Series Models with Heterogeneous Slopes
Authors: Eberhardt Markus
Published: November 2018

This article introduces a new Stata command, xtmg, that implements three panel time-series estimators, allowing for heterogeneous slope coefficients across group members: the Pesaran and Smith (1995, Journal of Econometrics 68: 79–113) mean group estimator, the Pesaran (2006, Econometrica 74: 967– 1012) common correlated effects mean group estimator, and the augmented mean group estimator introduced by Eberhardt and Teal (2010, Discussion Paper 515, Department of Economics, University of Oxford). The latter two estimators further allow for unobserved correlation across panel members (cross-section dependence).
From Resultssets to Resultstables in Stata
Authors: Newson Roger B.
Published: November 2018

The listtab package supersedes the listtex package. It inputs a list of variables and outputs them as a table in one of several formats, including TEX, LATEX, HTML, Microsoft Rich Text Format, or possibly future XML-based formats. It works with a team of four other packages: sdecode, chardef, xrewide, and ingap, which are downloaded from the Statistical Software Components archive. The sdecode package is an extension of decode; it allows the user to add prefixes or suffixes and to output exponents as TEX, HTML, or Rich Text Format superscripts. It is called by another package, bmjcip, to convert estimates, confidence limits, and p-values from numeric to string. The chardef package is an extension of char define; it allows the user to define a characteristic for a list of variables, adding prefixes or suffixes. The xrewide package is an extension of reshape wide; it allows the user to store additional results in variable characteristics or local macros. The ingap package inserts gap observations into a dataset to form gap rows when the dataset is converted to a table. Together, these packages form a general toolkit to convert Stata datasets (or resultssets) to tables, complete with row labels and column labels. Examples are demonstrated using LATEX and also using the rtfutil package to create Rich Text Format documents. This article uses data from the Avon Longitudinal Study of Parents and Children, based at Bristol University, UK.
Menu-Driven X-12-ARIMA Seasonal Adjustment in Stata
Authors: Wang Qunyong , Wu Na
Published: November 2018

The X-12-ARIMA software of the U.S. Census Bureau is one of the most popular methods for seasonal adjustment; the program x12a.exe is widely used around the world. Some software also provides X-12-ARIMA seasonal adjustments by using x12a.exe as a plug-in or externally. In this article, we illustrate a menu-driven X-12-ARIMA seasonal-adjustment method in Stata. Specifically, the main utilities include how to specify the input file and run the program, how to make a diagnostics table, how to import data, and how to make graphs.
The S-Estimator of Multivariate Location and Scatter in Stata
Authors: Verardi Vincenzo , McCathie Alice
Published: November 2018

In this article, we introduce a new Stata command, smultiv, that implements the S-estimator of multivariate location and scatter. Using simulated data, we show that smultiv outperforms mcd, an alternative robust estimator. Finally, we use smultiv to perform robust principal component analysis and least-squares regression on a real dataset.
Exact and Mid-p Confidence Intervals for the Odds Ratio
Authors: Fagerland Morten W.
Published: November 2018

The odds ratio is a frequently used effect measure for two independent binomial proportions. Unfortunately, the confidence intervals that are available for it in Stata and other standard software packages are generally wider than necessary, particularly for small-sample and exact estimation. The performance of the Cornfield exact interval—the only widely available exact interval for the odds ratio—may be improved by incorporating a small modification attributed to Baptista and Pike (1977, Journal of the Royal Statistical Society, Series C 26: 214–220). A further improvement is achieved when the Baptista–Pike method is combined with the mid- p approach. In this article, I present the command merci (mid- p and exact odds-ratio confidence intervals) and its immediate version mercii, which calculate the Cornfield exact, Cornfield mid- p, Baptista–Pike exact, and Baptista–Pike mid- p confidence intervals for the odds ratio. I compare these intervals with three well-known logit intervals. I strongly recommend the Baptista– Pike mid- p interval.
A Generalized Missing-Indicator Approach to Regression with Imputed Covariates
Authors: Dardanoni Valentino , De Luca Giuseppe , Modica Salvatore , Peracchi Franco
Published: November 2018

We consider estimation of a linear regression model using data where some covariate values are missing but imputations are available to fill in the missing values. This situation generates a tradeoff between bias and precision when estimating the regression parameters of interest. Using only the subsample of complete observations does not cause bias but may imply a substantial loss of precision because the complete cases may be too few. On the other hand, filling in the missing values with imputations may cause bias. We provide the new Stata command gmi, which handles such tradeoff by using either model reduction or Bayesian model averaging techniques in the context of the generalized missing-indicator approach recently proposed by Dardanoni, Modica, and Peracchi (2011, Journal of Econometrics 162: 362–368). If multiple imputations are available, gmi can also be combined with the built-in Stata prefix mi estimate to account for extra variability due to imputation. We illustrate the use of gmi with an empirical application in the health domain, where item nonresponse is substantial.
Fitting and Modeling Cure in Population-Based Cancer Studies within the Framework of Flexible Parametric Survival Models
Authors: Andersson Therese M.-L. , Lambert Paul C.
Published: November 2018

When the mortality among a cancer patient group returns to the same level as in the general population, that is, when the patients no longer experience excess mortality, the patients still alive are considered “statistically cured”. Cure models can be used to estimate the cure proportion as well as the survival function of the “uncured”. One limitation of parametric cure models is that the functional form of the survival of the uncured has to be specified. It can sometimes be hard to find a survival function flexible enough to fit the observed data, for example, when there is high excess hazard within a few months from diagnosis, which is common among older age groups. This has led to the exclusion of older age groups in population-based cancer studies using cure models. Here we use flexible parametric survival models that incorporate cure as a special case to estimate the cure proportion and the survival of the uncured. Flexible parametric survival models use splines to model the underlying hazard function; therefore, no parametric distribution has to be specified. We have updated the stpm2 command for flexible parametric models to enable cure modeling.
Versatile Sample-Size Calculation using Simulation
Authors: Hooper Richard
Published: November 2018

I present a new Stata command, simsam, that uses simulation to determine the sample size required to achieve a given statistical power for any hypothesis test under any probability model that can be programmed in Stata. simsam returns the smallest sample size (or smallest multiple of 5, 10, or some other user-specified increment) so that the estimated power exceeds the target. The user controls the precision of the power estimate, and power is reported with a confidence interval. The sample size returned is reliable to the extent that if simsam is repeated, it will, nearly every time, give a sample size no more than one increment away.
Trial Sequential Boundaries for Cumulative Meta-Analyses
Authors: Miladinovic Branko , Hozo Iztok , Djulbegovic Benjamin
Published: November 2018

We present a new command, metacumbounds, for the estimation of trial sequential monitoring boundaries in cumulative meta-analyses. The approach is based on the Lan–DeMets method for estimating group sequential boundaries in individual randomized controlled trials by using the package ldbounds in R statistical software. Through Stata's metan command, metacumbounds plots the Lan–DeMets bounds, z-values, and p-values obtained from both fixed and random-effects cumulative meta-analyses. The analysis can be performed with count data or on the hazard scale for time-to-event data.
kmlmap: A Stata Command for Producing Google's Keyhole Markup Language
Authors: Okulicz-Kozaryn Adam
Published: November 2018

kmlmap produces a Keyhole Markup Language file by using Stata data and geographical coordinates. This file produces a map when uploaded to Google Maps. The resulting map is a so-called choropleth or thematic map, where units of analysis are colored according to values of a variable. You can click on units of analysis on the map to display more information, to zoom, and to do all other things that Google Maps can do. The units of analysis can be points or polygons.
Review of Flexible Parametric Survival Analysis Using Stata: Beyond the Cox Model by Patrick Royston and Paul C. Lambert
Authors: Orsini Nicola
Published: November 2018

In this article, I review Flexible Parametric Survival Analysis Using Stata: Beyond the Cox Model, by Patrick Royston and Paul C. Lambert (2011 [Stata Press]).
A Command for Laplace Regression
Authors: Bottai Matteo , Orsini Nicola
Published: November 2018

We present the new laplace command for estimating Laplace regression, which models quantiles of a possibly censored outcome variable given covariates. We illustrate laplace with an example from a clinical trial on survival in patients with metastatic renal carcinoma. We also report the results of a small simulation study.