bluuebunny/crossref_metadata_2025 huggingface dataset:
Multivariable Modeling with Cubic Regression Splines: A Principled Approach
Authors: Royston Patrick , Sauerbrei Willi
Published: November 2018

Spline functions provide a useful and flexible basis for modeling relationships with continuous predictors. However, to limit instability and provide sensible regression models in the multivariable setting, a principled approach to model selection and function estimation is important. Here the multivariable fractional polynomials approach to model building is transferred to regression splines. The essential features are specifying a maximum acceptable complexity for each continuous function and applying a closed-test approach to each continuous predictor to simplify the model where possible. Important adjuncts are an initial choice of scale for continuous predictors (linear or logarithmic), which often helps one to generate realistic, parsimonious final models; a goodness-of-fit test for a parametric function of a predictor; and a preliminary predictor transformation to improve robustness.
File Filtering in Stata: Handling Complex Data Formats and Navigating Log Files Efficiently
Authors: Eng John
Published: November 2018

A text file filter is a program that converts one text file into another on the basis of a set of rules. For statistical applications, a text file filter can convert data embedded in a complicated text file so that Stata can read and analyze it. A text file filter can also automate the production of more user-friendly output from long Stata log files. The file command lets you use text file filters in Stata. This article reviews some key programming points for successful implementation of such filters.
Speaking Stata: Identifying Spells
Authors: Cox Nicholas J.
Published: November 2018

Spells in time series (and more generally in any kind of one-dimensional series) may be defined as sequences of observations that are homogeneous in some sense. For example, a categorical variable may remain in the same state, or values of a measured variable may satisfy the same true–false condition. Devices for working with spells in Stata include marking the start of each spell with indicator variables and tagging spells with integer codes. Panel data are easy to handle with the by: prefix. Some kinds of spell identification require two passes through the data, as when only spells of some minimum length are of interest or short gaps are tolerable within spells. Many questions concerning spells are easy to answer given careful use of by: and appropriate sort order, selection of just 1 observation from each panel or spell, and appreciation of the many functions written for egen. Gaps before, between, and after spells can also be important, and I suggest a convention for handling them.
Robust Standard Errors for Panel Regressions with Cross-Sectional Dependence
Authors: Hoechle Daniel
Published: November 2018

I present a new Stata program, xtscc, that estimates pooled ordinary least-squares/weighted least-squares regression and fixed-effects (within) regression models with Driscoll and Kraay (Review of Economics and Statistics 80: 549–560) standard errors. By running Monte Carlo simulations, I compare the finite-sample properties of the cross-sectional dependence–consistent Driscoll–Kraay estimator with the properties of other, more commonly used covariance matrix estimators that do not account for cross-sectional dependence. The results indicate that Driscoll–Kraay standard errors are well calibrated when cross-sectional dependence is present. However, erroneously ignoring cross-sectional correlation in the estimation of panel models can lead to severely biased statistical results. I illustrate the xtscc program by considering an application from empirical finance. Thereby, I also propose a Hausman-type test for fixed effects that is robust to general forms of cross-sectional and temporal dependence.
Simulation-Based Sensitivity Analysis for Matching Estimators
Authors: Nannicini Tommaso
Published: November 2018

This article presents a Stata program (sensatt) that implements the sensitivity analysis for matching estimators proposed by Ichino, Mealli, and Nannicini (Journal of Applied Econometrics, forthcoming). The analysis simulates a potential confounder to assess the robustness of the estimated treatment effects with respect to deviations from the conditional independence assumption. The program uses the commands for propensity-score matching (att*) developed by Becker and Ichino (Stata Journal 2: 358–377). I give an example by using the National Supported Work demonstration, widely known in the program evaluation literature.
Fitting Mixed Logit Models by Using Maximum Simulated Likelihood
Authors: Hole Arne Risa
Published: November 2018

This article describes the mixlogit Stata command for fitting mixed logit models by using maximum simulated likelihood.
SNP and SML Estimation of Univariate and Bivariate Binary-Choice Models
Authors: De Luca Giuseppe
Published: November 2018

We discuss the semi-nonparametric approach of Gallant and Nychka (1987, Econometrica 55: 363–390), the semiparametric maximum likelihood approach of Klein and Spady (1993, Econometrica 61: 387–421), and a set of new Stata commands for semiparametric estimation of three binary-choice models. The first is a univariate model, while the second and the third are bivariate models without and with sample selection, respectively. The proposed estimators are [Formula: see text] consistent and asymptotically normal for the model parameters of interest under weak assumptions on the distribution of the underlying error terms. Our Monte Carlo simulations suggest that the efficiency losses of the semi-nonparametric and the semiparametric maximum likelihood estimators relative to a maximum likelihood correctly specified estimator of a parametric probit are rather small. On the other hand, a comparison of these estimators in non-Gaussian designs suggests that semi-nonparametric and semiparametric maximum likelihood estimators substantially dominate the parametric probit maximum likelihood estimator.
Error-Correction–Based Cointegration Tests for Panel Data
Authors: Persyn Damiaan , Westerlund Joakim
Published: November 2018

This article describes a new Stata command called xtwest, which implements the four error-correction–based panel cointegration tests developed by Westerlund (2007). The tests are general enough to allow for a large degree of heterogeneity, both in the long-run cointegrating relationship and in the short-run dynamics, and dependence within as well as across the cross-sectional units.
Implementing Double-robust Estimators of Causal Effects
Authors: Emsley Richard , Lunt Mark , Pickles Andrew , Dunn Graham
Published: November 2018

This article describes the implementation of a double-robust estimator for pretest–posttest studies (Lunceford and Davidian, 2004, Statistics in Medicine 23: 2937–2960) and presents a new Stata command (dr) that carries out the procedure. A double-robust estimator gives the analyst two opportunities for obtaining unbiased inference when adjusting for selection effects such as confounding by allowing for different forms of model misspecification; a double-robust estimator also can offer increased efficiency when all the models are correctly specified. We demonstrate the results with a Monte Carlo simulation study, and we show how to implement the double-robust estimator on a single simulated dataset, both manually and by using the dr command.
Creating Print-ready Tables in Stata
Authors: Lokshin Michael , Sajaia Zurab
Published: November 2018

This article describes the new Stata command xml_tab, which outputs the results of estimation commands and Stata matrices directly into tables in XML format. The XML files can be opened with Microsoft Excel or OpenOffice Calc, or they can be linked with Microsoft Word files. By using XML, xml_tab allows Stata users to apply a rich set of formatting options to the elements of output tables.
kountry: A Stata Utility for Merging Cross-country Data from Multiple Sources
Authors: Raciborski Rafal
Published: November 2018

This article describes kountry, a data-management command that can be used to translate one country-coding scheme into another, to recode country names into a “standardized form”, and to generate geographic-region variables. Users can build a custom dictionary through a helper command, kountryadd, that “teaches” kountry new name variations. The dictionary can be protected from an accidental overwriting through two helper commands: kountrybackup and kountryrestore.
Review of a Visual Guide to Stata Graphics, Second Edition by Michael N. Mitchell
Authors: Merryman Scott
Published: November 2018

This article reviews A Visual Guide to Stata Graphics, Second Edition by Michael N. Mitchell.
The Blinder–Oaxaca Decomposition for Linear Regression Models
Authors: Jann Ben
Published: November 2018

The counterfactual decomposition technique popularized by Blinder (1973, Journal of Human Resources, 436–455) and Oaxaca (1973, International Economic Review, 693–709) is widely used to study mean outcome differences between groups. For example, the technique is often used to analyze wage gaps by sex or race. This article summarizes the technique and addresses several complications, such as the identification of effects of categorical predictors in the detailed decomposition or the estimation of standard errors. A new command called oaxaca is introduced, and examples illustrating its usage are given.
The Blinder–Oaxaca Decomposition for Nonlinear Regression Models
Authors: Sinning Mathias , Hahn Markus , Bauer Thomas K.
Published: November 2018

In this article, a general Blinder–Oaxaca decomposition for nonlinear models is derived, which allows the difference in an outcome variable between two groups to be decomposed into several components. We show how, using nldecompose, this general decomposition can be applied to different models with discrete and limited dependent variables. We further demonstrate how the standard errors of the estimated components can be calculated by using Stata's bootstrap command as a prefix.
Demand-System Estimation: Update
Authors: Poi Brian P.
Published: November 2018

The nlsur command is better suited to demand-system estimation than the suite of ado-files provided in Poi (2002, Stata Journal 2: 403–410) because it is faster and requires only one ancillary ado-file. This article replicates the results presented in Poi (2002) by using nlsur instead of ml.
Methods for Estimating Adjusted Risk Ratios
Authors: Cummings Peter
Published: November 2018

The risk ratio can be a useful statistic for summarizing the results of cross-sectional, cohort, and randomized trial studies. I discuss several methods for estimating adjusted risk ratios and show how they can be executed in Stata, including 1) Mantel–Haenszel and inverse-variance stratified methods; 2) generalized linear regression with a log link and binomial distribution; 3) generalized linear regression with a log link, normal distribution, and robust variance estimator; 4) Poisson regression with a robust variance estimator; 5) Cox proportional hazards regression with a robust variance estimator; 6) standardized risk ratios from logistic, probit, complementary log-log, and log-log regression; and 7) a substitution method. Advantages and drawbacks are noted for some methods.
Updated Tests for Small-study Effects in Meta-analyses
Authors: Harbord Roger M. , Harris Ross J. , Sterne Jonathan A. C.
Published: November 2018

This article describes an updated version of the metabias command, which provides statistical tests for funnel plot asymmetry. In addition to the previously implemented tests, metabias implements two new tests that are recommended in the recently updated Cochrane Handbook for Systematic Reviews of Interventions (Higgins and Green 2008). The first new test, proposed by Harbord, Egger, and Sterne (2006, Statistics in Medicine 25: 3443–3457), is a modified version of the commonly used test proposed by Egger et al. (1997, British Medical Journal 315: 629–634). It regresses Z/[Formula: see text] against [Formula: see text], where Z is the efficient score and V is Fisher's information (the variance of Z under the null hypothesis). The second new test is Peters’ test, which is based on a weighted linear regression of the intervention effect estimate on the reciprocal of the sample size. Both of these tests maintain better control of the false-positive rate than the test proposed by Egger at al., while retaining similar power.
Robust Regression in Stata
Authors: Verardi Vincenzo , Croux Christophe
Published: November 2018

In regression analysis, the presence of outliers in the dataset can strongly distort the classical least-squares estimator and lead to unreliable results. To deal with this, several robust-to-outliers methods have been proposed in the statistical literature. In Stata, some of these methods are available through the rreg and qreg commands. Unfortunately, these methods resist only some specific types of outliers and turn out to be ineffective under alternative scenarios. In this article, we present more effective robust estimators that we implemented in Stata. We also present a graphical tool that recognizes the type of detected outliers.
Fitting and Interpreting Cragg's Tobit Alternative using Stata
Authors: Burke William J.
Published: November 2018

In this article, I introduce the user-written command craggit, which simultaneously fits both tiers of Cragg's (1971, Econometrica 39: 829–844) “two-tier” (sometimes called “two-stage” or “double-hurdle”) alternative to tobit for corner-solution models. A key limitation to the tobit model is that the probability of a positive value and the actual value, given that it is positive, are determined by the same underlying process (i.e., the same parameters). Cragg proposed a more flexible alternative that allows these outcomes to be determined by separate processes through the incorporation of a probit model in the first tier and a truncated normal model in the second. Also, tobit is nested in craggit, making the latter a popular choice among “two-tier” models. In the article, I also present postestimation syntax to facilitate the understanding and interpretation of results.
Creating Synthetic Discrete-response Regression Models
Authors: Hilbe Joseph M.
Published: November 2018

The development and use of synthetic regression models has proven to assist statisticians in better understanding bias in data, as well as how to best interpret various statistics associated with a modeling situation. In this article, I present code that can be easily amended for the creation of synthetic binomial, count, and categorical response models. Parameters may be assigned to any number of predictors (which are shown as continuous, binary, or categorical), negative binomial heterogeneity parameters may be assigned, and the number of levels or cut points and values may be specified for ordered and unordered categorical response models. I also demonstrate how to introduce an offset into synthetic data and how to test synthetic models using Monte Carlo simulation. Finally, I introduce code for constructing a synthetic NB2-logit hurdle model.
Speaking Stata: The Statsby Strategy
Authors: Cox Nicholas J.
Published: November 2018

The statsby command collects statistics from a command yielding r-class or e-class results across groups of observations and yields a new reduced dataset. statsby is commonly used to graph such data in comparisons of groups; the subsets and total options of statsby are particularly useful in this regard. In this article, I give examples of using this approach to produce box plots and plots of confidence intervals.
Computing Murphy-Topel-corrected Variances in a Heckprobit Model with Endogeneity
Authors: Muro Juan , Suáarez Cristina , del Mar Zamora María
Published: November 2018

We outline a fairly simple method to obtain in Stata Murphy-Topel-corrected variances for a two-step estimation of a heckprobit model with endogeneity in the main equation. The procedure uses predict's score option and the powerful matrix tool accum in Stata and builds on previous works by Hardin (2002, Stata Journal 2: 253–266) and Hole (2006, Stata Journal 6: 521–529).
Comparing the Predictive Powers of Survival Models Using Harrell's C or Somers’ D
Authors: Newson Roger B.
Published: November 2018

Medical researchers frequently make statements that one model predicts survival better than another, and they are frequently challenged to provide rigorous statistical justification for those statements. Stata provides the estat concordance command to calculate the rank parameters Harrell's C and Somers’ D as measures of the ordinal predictive power of a model. However, no confidence limits or p-values are provided to compare the predictive power of distinct models. The somersd package, downloadable from Statistical Software Components, can provide such confidence intervals, but they should not be taken seriously if they are calculated in the dataset in which the model was fit. Methods are demonstrated for fitting alternative models to a training set of data, and then measuring and comparing their predictive powers by using out-of-sample prediction and somersd in a test set to produce statistically sensible confidence intervals and p-values for the differences between the predictive powers of different models.
Simsum: Analyses of Simulation Studies Including Monte Carlo Error
Authors: White Ian R.
Published: November 2018

A new Stata command, simsum, analyzes data from simulation studies. The data may comprise point estimates and standard errors from several analysis methods, possibly resulting from several different simulation settings. simsum can report bias, coverage, power, empirical standard error, relative precision, average model-based standard error, and the relative error of the standard error. Monte Carlo errors are available for all of these estimated quantities.
Estimation of Hurdle Models for Overdispersed Count Data
Authors: Farbmacher Helmut
Published: November 2018

Hurdle models based on the zero-truncated Poisson-lognormal distribution are rarely used in applied work, although they incorporate some advantages compared with their negative binomial alternatives. I present a command that enables Stata users to estimate Poisson-lognormal hurdle models. I use adaptive Gauss–Hermite quadrature to approximate the likelihood function, and I evaluate the performance of the estimator in Monte Carlo experiments. The model is applied to the number of doctor visits in a sample of the U.S. Medical Expenditure Panel Survey.
Speaking Stata: MMXI and all That: Handling Roman Numerals within Stata
Authors: Cox Nicholas J.
Published: November 2018

The problem of handling Roman numerals in Stata is used to illustrate issues arising in the handling of classification codes in character string form and their numeric equivalents. The solutions include Stata programs and Mata functions for conversion from numeric to string and from string to numeric. Defining acceptable input and trapping and flagging incorrect or unmanageable inputs are key concerns in good practice. Regular expressions are especially valuable for this problem.
Multivariate Random-effects Meta-regression: Updates to Mvmeta
Authors: White Ian R.
Published: November 2018

An extension of mvmeta, my program for multivariate random-effects meta-analysis, is described. The extension handles meta-regression. Estimation methods available are restricted maximum likelihood, maximum likelihood, method of moments, and fixed effects. The program also allows a wider range of models (Riley's overall correlation model and structured between-studies covariance); better estimation (using Mata for speed and correctly allowing for missing data); and new postestimation facilities (I-squared, standard errors and confidence intervals for between-studies standard deviations and correlations, and identification of the best intervention). The program is illustrated using a multiple-treatments meta-analysis.
Nonparametric Bounds for the Causal Effect in a Binary Instrumental-Variable Model
Authors: Palmer Tom M. , Ramsahai Roland R. , Didelez Vanessa , Sheehan Nuala A.
Published: November 2018

Instrumental variables can be used to make inferences about causal effects in the presence of unmeasured confounding. For a model in which the instrument, intermediate/treatment, and outcome variables are all binary, Balke and Pearl (1997, Journal of the American Statistical Association 92: 1172–1176) derived nonparametric bounds for the intervention probabilities and the average causal effect. We have implemented these bounds in two commands: bpbounds and bpboundsi. We have also implemented several extensions to these bounds. One of these extensions applies when the instrument and outcome are measured in one sample and the instrument and intermediate are measured in another sample. We have also implemented the bounds for an instrument with three categories, as is common in Mendelian randomization analyses in epidemiology and for the case where a monotonic effect of the instrument on the intermediate can be assumed. In each case, we calculate the instrumental-variable inequality constraints as a check for gross violations of the instrumental-variable conditions. The use of the commands is illustrated with a re-creation of the original Balke and Pearl analysis and with a Mendelian randomization analysis. We also give a simulated example to demonstrate that the instrumental-variable inequality constraints can both detect and fail to detect violations of the instrumental-variable conditions.
Scrambled Halton Sequences in Mata
Authors: Kolenikov Stanislav
Published: November 2018

In this article, I discuss the need for Halton sequences and discuss the Mata implementation of scrambling of Halton sequences, providing several examples of scrambling procedures.
Fitting Nonparametric Mixed Logit Models via Expectation-Maximization Algorithm
Authors: Pacifico Daniele
Published: November 2018

In this article, I provide an illustrative, step-by-step implementation of the expectation-maximization algorithm for the nonparametric estimation of mixed logit models. In particular, the proposed routine allows users to fit straightforwardly latent-class logit models with an increasing number of mass points so as to approximate the unobserved structure of the mixing distribution.
Diagnostics for Multiple Imputation in Stata
Authors: Eddings Wesley , Marchenko Yulia
Published: November 2018

Our new command midiagplots makes diagnostic plots for multiple imputations created by mi impute. The plots compare the distribution of the imputed values with that of the observed values so that problems with the imputation model can be corrected before the imputed data are analyzed. We include an example and suggest extensions to other diagnostics.
Easy Demand-System Estimation with Quaids
Authors: Poi Brian P.
Published: November 2018

Previously, to fit an almost-ideal demand system in Stata, one would have to use the nlsur command and write a function evaluator program as described in [R] nlsur and Poi (2008, Stata Journal 8: 554–556). In this article, I introduce the command quaids, which obviates the need for any programming by the user. The command fits Deaton and Muellbauer's (1980b, American Economic Review 70: 312–326) original almost-ideal demand-system model as well as Banks, Blundell, and Lewbel's (1997, Review of Economics and Statistics 79: 527–539) quadratic variant. Demographic variables can also be included in the model. Postestimation tools calculate expenditure and price elasticities.
Sensible Parameters for Univariate and Multivariate Splines
Authors: Newson Roger B.
Published: November 2018

The package bspline, downloadable from Statistical Software Components, now has three commands. The first, bspline, generates a basis of Schoenberg B-splines. The second, frencurv, generates a basis of reference splines whose parameters in the regression model are simply values of the spline at reference points on the X axis. The recent addition, flexcurv, is an easy-to-use version of frencurv that generates reference splines with automatically generated, sensibly spaced knots. frencurv and flexcurv now have the additional option of generating an incomplete basis of reference splines, with the reference spline for a baseline reference point omitted or set to 0. This incomplete basis can be completed by adding the standard unit vector to the design matrix and can then be used to estimate differences between values of the spline at the remaining reference points and the value of the spline at the baseline reference point. Reference splines therefore model continuous factor variables as indicator variables (or “dummies”) model discrete factor variables. The method can be extended in a similar way to define factor-product bases, allowing the user to estimate factor-combination means, subset-specific effects, or even factor interactions involving multiple continuous or discrete factors.
Kernel-Smoothed Cumulative Distribution Function Estimation with Akdensity
Authors: Van Kerm Philippe
Published: November 2018

In this article, I describe estimation of the kernel-smoothed cumulative distribution function with the user-written package akdensity, with formulas and an example.
Review of Interpreting and Visualizing Regression Models Using Stata by Michael N. Mitchell
Authors: Acock Alan C.
Published: November 2018

In this article, I review Interpreting and Visualizing Regression Models Using Stata, by Michael Mitchell (2012a [Stata Press]).
A Command to Calculate Age-Standardized Rates with Efficient Interval Estimation
Authors: Consonni Dario , Coviello Enzo , Buzzoni Carlotta , Mensi Carolina
Published: November 2018

In this article, we illustrate the command distrate, which calculates age-standardized rates with efficient interval estimation by using formulas developed by Tiwari, Clegg, and Zou (2006, Statistical Methods in Medical Research 15: 547–569) as a modification of the method proposed by Fay and Feuer (1997, Statistics in Medicine 16: 791–801). This method is currently used in the Surveillance, Epidemiology, and End Results Program of the National Cancer Institute in Bethesda, Maryland; the Italian Association of Cancer Registries (Associazione Italiana Registro Tumori, AIRTUM); and the Lombardy Mesothelioma and Sinonasal Cancer Registry in Northern Italy. The command produces a compact output and allows for the possibility of specifying a rate multiplier, for instance, x100,000 or x1,000,000. Furthermore, rates and confidence limits can be easily exported to an external dataset for further processing (for example, for making graphs). The command distrate is a useful addition to the official Stata command dstdize.
HTML Output in Stata
Authors: Quintó Llorenç , Sanz Sergi , De Lazzari Elisa , Aponte John J.
Published: November 2018

In this article, we present a suite of basic commands that facilitate the production of HTML files in Stata. Creating HTML files in Stata allows for the programmatic production of formatted statistical reports that users can easily open without proprietary software, a feature long desired by many Stata statisticians.
Sar: Automatic Generation of Statistical Reports using Stata and Microsoft Word for Windows
Authors: Magno Giovanni L. Lo
Published: November 2018

The output provided by most Stata commands is plain text not suitable to be presented or published. After the numerical and graphical outputs are obtained, the user has to copy them into a word processor to complete the editing process. Some Stata commands help you to obtain well-formatted output, especially tabulated results in LATEX or other formats, but they are not a complete solution nor are they friendly tools. Stata automatic report (Sar) is an easy-to-use macro for Microsoft Word for Windows that allows a powerful integration between Stata and Word. With Sar, the user can retrieve numerical results and graphs from Stata and automatically insert them into a well-formatted Word document, exploiting all the functions of Word. This process is managed by Word while Stata is executed in the background. Sar requires Stata commands and some specific Sar commands to be written in ordinary Word comments. Thus the report is well documented, and this can encourage the sharing of the workflow of data analysis and the reproducibility of the research. With Sar, the user can create an automatic report, that is, a Word document that can be automatically updated if data have changed. Sar works only on Windows systems.
Doubly Robust Estimation in Generalized Linear Models
Authors: Orsini Nicola , Bellocco Rino , Sjölander Arvid
Published: November 2018

A common aim of epidemiological research is to assess the association between a particular exposure and a particular outcome, controlling for a set of additional covariates. This is often done by using a regression model for the outcome, conditional on exposure and covariates. A commonly used class of models is the generalized linear models. The model parameters are typically estimated through maximum likelihood. If the model is correct, then the maximum likelihood estimator is consistent but may otherwise be inconsistent. Recently, a new class of estimators known as doubly robust estimators has been proposed. These estimators use two regression models, one for the outcome and one for the exposure, and are consistent if either model is correct, not necessarily both. Thus doubly robust estimators give the analyst two chances instead of only one to make valid inference. In this article, we describe a new Stata command, drglm, that implements the most common doubly robust estimators for generalized linear models.
A Command for Estimating Spatial-Autoregressive Models with Spatial-Autoregressive Disturbances and Additional Endogenous Variables
Authors: Drukker David M. , Prucha Ingmar R. , Raciborski Rafal
Published: November 2018

We describe the spivreg command, which estimates the parameters of linear cross-sectional spatial-autoregressive models with spatial-autoregressive disturbances, where the model may also contain additional endogenous variables as well as exogenous variables. spivreg uses results and the literature cited in Kelejian and Prucha (1998, Journal of Real Estate Finance and Economics 17: 99–121; 1999, International Economic Review 40: 509–533; 2004, Journal of Econometrics 118: 27–50; 2010, Journal of Econometrics 157: 53–67); Arraiz et al. (2010, Journal of Regional Science 50: 592–614); and Drukker, Egger, and Prucha (2013, Econometric Reviews 32: 686–733).
Importing U.S. Exchange Rate Data from the Federal Reserve and Standardizing Country Names across Datasets
Authors: Dicle Betul , Levendis John , Dicle Mehmet F.
Published: November 2018

fxrates is a command to import historical U.S. exchange rate data from the Federal Reserve and to calculate the daily change of the exchange rates. Because many cross-country datasets use different spellings and conventions for country names, we also introduce a second command, countrynames, to convert country names to a common naming standard.
Generating Manhattan Plots in Stata
Authors: Cook Daniel E. , Ryckman Kelli R. , Murray Jeffrey C.
Published: November 2018

Genome-wide association studies hold the potential for discovering genetic causes for a wide range of diseases, traits, and behaviors. However, the incredible amount of data handling, advanced statistics, and visualization have made conducting these studies difficult for researchers. Here we provide a tool, manhattan, for helping investigators easily visualize genome-wide association studies data in Stata.
Exact Wilcoxon Signed-Rank and Wilcoxon Mann–Whitney Ranksum Tests
Authors: Harris Tammy , Hardin James W.
Published: November 2018

We present new Stata commands for carrying out exact Wilcoxon one-sample and two-sample comparisons of the median. Nonparametric tests are often used in clinical trials, in which it is not uncommon to have small samples. In such situations, researchers are accustomed to making inferences by using exact statistics. The ranksum and signrank commands in Stata provide only asymptotic results, which assume normality. Because large-sample results are unacceptable in many clinical trials studies, these researchers must use other software packages. To address this, we have developed new commands for Stata that provide exact statistics in small samples. Additionally, when samples are large, we provide results based on the Student's t distribution that outperform those based on the normal distribution.
Estimation of Multivalued Treatment Effects under Conditional Independence
Authors: Cattaneo Matias D. , Drukker David M. , Holland Ashley D.
Published: November 2018

This article discusses the poparms command, which implements two semiparametric estimators for multivalued treatment effects discussed in Cattaneo (2010, Journal of Econometrics 155: 138–154). The first is a properly reweighted inverse-probability weighted estimator, and the second is an efficient-influence-function estimator, which can be interpreted as having the double-robust property. Our implementation jointly estimates means and quantiles of the potential-outcome distributions, allowing for multiple, discrete treatment levels. These estimators are then used to estimate a variety of multivalued treatment effects. We discuss pre- and postestimation approaches that can be used in conjunction with our main implementation. We illustrate the program and provide a simulation study assessing the finite-sample performance of the inference procedures.
Marginscontplot: Plotting the Marginal Effects of Continuous Predictors
Authors: Royston Patrick
Published: November 2018

I provide a new tool (marginscontplot) for plotting the marginal effect of continuous covariates in regression models. The plots may be univariate or according to levels or user-selected values of a second covariate. Nonlinear relationships involving transformed covariates may be plotted on the original scale.
Calibrating Survey Data using Iterative Proportional Fitting (Raking)
Authors: Kolenikov Stanislav
Published: November 2018

In this article, I introduce the ipfraking package, which implements weight-calibration procedures known as iterative proportional fitting, or raking, of complex survey weights. The package can handle a large number of control variables and trim the weights in various ways. It also provides diagnostic tools for the weights it creates. I provide examples of its use and a suggested workflow for creating raked replicate weights.
Sample Size and Power Calculations for Trials and Quasi-Experimental Studies with Clustering
Authors: Batistatou Evridiki , Roberts Chris , Roberts Steve
Published: November 2018

This article considers the estimation of power and sample size in experimental and quasi-experimental intervention studies, where there is clustering of subjects within one or both intervention arms, for both continuous and binary outcomes. A new command, clsampsi, which has a wide range of options, calculates the power and sample size needed (that is, the number of clusters and cluster size) by using the noncentral F distribution as described by Moser, Stevens, and Watts (1989, Communications in Statistics—Theory and Methods 18: 3963–3975). For comparative purposes, this command can also produce power and sample-size estimates on the basis of existing methods that use a normal approximation.
Strel2: A Command for Estimating Excess Hazard and Relative Survival in Large Population-Based Studies
Authors: Hills Michael , Rachet Bernard , Falcaro Milena
Published: November 2018

In this article, we describe strel2, a Stata command for the estimation of excess hazard and relative survival in large population-based datasets. strel2 implements the maximum-likelihood estimation approach developed by Estève et al. (1990, Statistics in Medicine 9: 529–538) and assumes that the excess hazard is a piecewise constant function. Categorical covariates can be incorporated into the model, allowing the user to obtain interval- and covariate-specific estimates of the quantities of interest. Although alternative and more powerful commands for relative survival exist, strel2 is a simple tool that is particularly convenient for users who may not have strong statistical skills and want to analyze very large datasets.
Obtaining Critical Values for Test of Markov Regime Switching
Authors: Bostwick Valerie K. , Steigerwald Douglas G.
Published: November 2018

For Markov regime-switching models, a nonstandard test statistic must be used to test for the possible presence of multiple regimes. Carter and Steigerwald (2013, Journal of Econometric Methods 2: 25–34) derive the analytic steps needed to implement the Markov regime-switching test proposed by Cho and White (2007, Econometrica 75: 1671–1720). We summarize the implementation steps and address the computational issues that arise. We then introduce a new command to compute regime-switching critical values, rscv, and present it in the context of empirical research.
Estimation of Multiprocess Survival Models with cmp
Authors: Bartus Tamás , Roodman David
Published: November 2018

Multilevel multiprocess hazard models are routinely used by demographers to control for endogeneity and selection effects. These models consist of multilevel proportional hazards equations, and possibly probit equations, with correlated random effects. Although Stata currently lacks a specialized command for fitting systems of multilevel proportional hazards models, systems of seemingly unrelated lognormal survival models can be fit with the user-written cmp command (Roodman 2011, Stata Journal 11: 159–206). In this article, we describe multiprocess survival models and demonstrate theoretical and practical aspects of estimation. We also illustrate the application of the cmp command using examples related to demographic research. The examples use a dataset shipped with the statistical software aML.
Lee (2009) Treatment-Effect Bounds for Nonrandom Sample Selection
Authors: Tauchmann Harald
Published: November 2018

Nonrandom sample selection may render estimated treatment effects biased even if assignment of treatment is purely random. Lee (2009, Review of Economic Studies, 76: 1071–1102) proposes an estimator for treatment-effect bounds that limit the possible range of the treatment effect. In this approach, the lower and upper bound correspond to extreme assumptions about the missing information that are consistent with the observed data. In contrast to conventional parametric approaches to correcting for sample-selection bias, Lee's bounds estimator rests on very few assumptions. I introduce the new command leebounds, which implements the estimator in Stata. The command allows for several options, such as tightening bounds by using covariates.
Generating Univariate and Multivariate Nonnormal Data
Authors: Lee Sunbok
Published: November 2018

Because the assumption of normality is common in statistics, the robustness of statistical procedures to the violation of the normality assumption is often of interest. When one examines the impact of the violation of the normality assumption, it is important to simulate data from a nonnormal distribution with varying degrees of skewness and kurtosis. Fleishman (1978, Psychometrika 43: 521–532) developed a method to simulate data from a univariate distribution with specific values for the skewness and kurtosis. Vale and Maurelli (1983, Psychometrika 48: 465–471) extended Fleishman's method to simulate data from a multivariate nonnormal distribution. In this article, I briefly introduce these two methods and present two new commands, rnonnormal and rmvnonnormal, for simulating data from the univariate and multivariate nonnormal distributions.
Modeling Heaped Count Data
Authors: Cummings Tammy H. , Hardin James W. , McLain Alexander C. , Hussey James R. , Bennett Kevin J. , Wingood Gina M.
Published: November 2018

We present motivation and new commands for modeling heaped count data. These data may appear when subjects report counts that are rounded or favor multiples (digit preference) of a certain outcome, such as the number of cigarettes reported. The new commands for fitting count regression models (Poisson, generalized Poisson, negative binomial) are also accompanied by real-world examples comparing the heaped regression model with the usual regression model as well as the heaped zero-inflated model with the usual zero-inflated model.
Transition Matrix for a Bivariate Normal Distribution in Stata
Authors: Savegnago Marco
Published: November 2018

trabinor calculates the population transition matrix between two discretized variables when the original continuous variables follow a bivariate normal distribution. The user can specify the five parameters of bivariate normal and how to discretize the two variables by choosing either a given number of quantiles or a set of absolute boundaries.
Speaking Stata: Species of Origin
Authors: Cox Nicholas J.
Published: November 2018

Counting and measurement scales often have natural origins that deserve respect in analysis. In other problems, we should feel free to shift or translate the origin or to rotate a periodic scale. Examples with environmental data focus on trends in time and seasonal cycles. Several small tips are bundled together on working with noncalendar years in Stata.
Graphlog: Creating Log Files with Embedded Graphics
Authors: Hansen Martin Rune
Published: November 2018

In this note, I describe the user-written command graphlog. Stata's built-in log command lacks the ability to include graphics in log files. graphlog embeds graphics in a Stata log file and saves the result to a PDF file. This improves the documentation of the work done.
A Note on Adding Objects to an Existing Twoway Graph
Authors: Jann Ben
Published: November 2018

In Stata, graphs are usually generated by one call to the graph command. Sometimes, however, it would be convenient to be able to add objects to a graph after the graph has been created. In this article, I provide a command called addplot that offers such functionality for twoway graphs, capitalizing on an undocumented feature of Stata's graphics system.
Regression Analysis of Censored Data Using Pseudo-observations: An Update
Authors: Overgaard Morten , Andersen Per K. , Parner Erik T.
Published: November 2018

We present updated versions of the stpsurv, stpci, and stpmean commands, which were introduced in Parner and Andersen (2010, Stata Journal 10: 408–422), along with a new command, stplost. The commands generate pseudo-observations of the survival function, the cumulative incidence function under competing risks, the restricted mean survival-time function, and the cause-specific lost-lifetime function. The pseudo-observations can be used to assess the effects of covariates on their respective functions at different times by fitting generalized linear models to the pseudo-observations. The updated commands feature new options, an increase in computational speed, and the ability to handle survival data with delayed entry.
The Berry–Levinsohn–Pakes Estimator of the Random-coefficients Logit Demand Model
Authors: Vincent David W.
Published: November 2018

In this article, I describe the algorithm proposed by Berry, Levinsohn, and Pakes (1995, Econometrica 63: 841–890) to fit the random-parameters logit demand model from product market shares. I present a new command, blp, for this estimator.
Complete Automation of a Participant Characteristics Table
Authors: Lirette Seth T.
Published: November 2018

Most published research that contains real-world data displays a table of participant characteristics, baseline characteristics, or demographics. I present a program, partchart, that provides automatic output of the participant characteristics table in multiple formats and gives the user control over formatting, thus facilitating complete reproducibility.
Mfpa: Extension of mfp Using the ACD Covariate Transformation for Enhanced Parametric Multivariable Modeling
Authors: Royston Patrick , Sauerbrei Willi
Published: November 2018

In a recent article, Royston (2015, Stata Journal 15: 275–291) introduced the approximate cumulative distribution (ACD) transformation of a continuous covariate x as a route toward modeling a sigmoid relationship between x and an outcome variable. In this article, we extend the approach to multivariable modeling by modifying the standard Stata program mfp. The result is a new program, mfpa, that has all the features of mfp plus the ability to fit a new model for user-selected covariates that we call FP1( p1, p2). The FP1( p1, p2) model comprises the best-fitting combination of a dimension-one fractional polynomial (FP1) function of x and an FP1 function of ACD ( x). We describe a new model-selection algorithm called function-selection procedure with ACD transformation, which uses significance testing to attempt to simplify an FP1( p1, p2) model to a submodel, an FP1 or linear model in x or in ACD ( x). The function-selection procedure with ACD transformation is related in concept to the FSP (FP function-selection procedure), which is an integral part of mfp and which is used to simplify a dimension-two (FP2) function. We describe the mfpa command and give univariable and multivariable examples with real data to demonstrate its use.
Speaking Stata: Truth, Falsity, Indication, and Negation
Authors: Cox Nicholas J.
Published: November 2018

Many problems in Stata call for selection of observations according to true or false conditions, indicator variables flagging the same, groupwise calculations, or a prearranged sort order. The example of finding the first (earliest) and last nonmissing value in panel or longitudinal data is used to explain and explore these devices and how they may be used together. Negating an indicator variable has the special virtue that selected observations may be sorted easily to the top of the dataset.
Implementing Weighted-average Estimation of Substance Concentration Using Multiple Dilutions
Authors: Xu Ying , Milligan Paul , Remarque Edmond J. , Cheung Yin Bun
Published: November 2018

In medicine and chemistry, immunoassays are often used to measure substance concentration. These tests use an S-shaped standard curve to map the observed optical responses to the underlying concentration. The enzyme-linked immunosorbent assay is one such test that is commonly used to measure antibody concentration in vaccine and infectious disease research. The enzyme-linked immunosorbent assay and other immunoassays usually involve a series of doubling or tripling dilutions of the test samples so that some of the diluted samples fall within the near-linear range in the center of the standard curve. The dilution that falls within or is nearest to the center of the near-linear range may then be selected for statistical analysis. This common practice of using one dilution does not fully use the information from multiple dilutions and reduces accuracy. We describe a recently proposed weighted-average estimation approach for analyzing multiple-dilution data (Cheung et al. 2015, Journal of Immunological Methods 417: 115–123), and we present the new wavemid command, which carries out the approach. We also present the new command midreshape, which processes raw data in text format exported from some microplate readers into analyzable data format. We use data from an experimental study of malaria vaccine candidates to demonstrate use of the two commands.
Partial Credit Model: Estimations and Tests of Fit with Pcmodel
Authors: Hamel Jean-François , Sébille Véronique , Challet-Bouju Gaëlle , Hardouin Jean-Benoit
Published: November 2018

The partial credit and rating scale models are classical models from item response theory; they belong to the generalized linear latent and mixed model family and allow one to analyze questionnaires such as patient-reported outcomes. Few goodness-of-fit testing procedures have been proposed for such models, and few computer programs implement such tests. Here we describe two tests: the R1m test (which tests the overall adequacy of the model to the data) and the Si test (which evaluates the contribution of each item to a possible lack of fit). We also propose two commands: pcmodel, which implements partial credit or rating scale models, and pcmtest, which tests the adequacy of such models to the data.