
Abstract Simulation studies are computational experiments used to evaluate the properties of statistical methods—typically methods for design or analysis. Used well, simulation studies are an invaluable tool. However, they are often complex, with multiple data-generating mechanisms, multiple estimands, and multiple methods of analysis. When one analyzes the results of such simulation studies, errors are often made and sometimes missed. Getting the analysis right can be delicate and time-consuming. In this article, we introduce siman , a suite of programs that offers data manipulation, exploration, visualization, and analysis of the results of complex simulation studies.
In this article, we introduce the new community-contributed commands xtdhazard and cfbinout . The former implements the own-differences instrumental-variables estimator proposed by Farbmacher and Tauchmann (2023, Econometric Reviews 42: 635-654) for dealing with time-invariant unobserved heterogeneity in the discrete-time hazard model. cfbinout is called by xtdhazard if a nonlinear discrete-time hazard model is specified. cfbinout can also be used as a standalone command that generalizes ivprobit , twostep by allowing discrete endogenous regressors and link functions that are different from the normal link, specifically logit and complementary log-log. In terms of the underlying econometric theory, cfbinout is guided by Wooldridge (2015, Journal of Human Resources 50: 420-445). We illustrate the use of xtdhazard in an empirical example.
In this article, we present two commands— ccscc and sccintreg —that conduct parameter inference in moment-inequality models, which are defined by inequality moment conditions. Such models have gained popularity in the economics literature because of the flexibility they offer. Examples include missing- data models with nonrandom missingness and game-theoretic models with multiple equilibriums. Parameters in such models often cannot be consistently estimated. Nevertheless, valid confidence intervals can be constructed by inverting a hypothesis test for the compatibility of a parameter value with the model. The ccscc command implements the computationally easy tests proposed by Cox and Shi (2023, Review of Economic Studies 90: 201-228). The sccintreg command builds on ccscc to compute marginal confidence intervals for each parameter in an interval- outcome linear regression model. We demonstrate the use of our commands in two simulation examples.
Quantile-box plots as discussed here are variations on a plot originally proposed by Emanuel Parzen in 1979. The main ideas are 1) the quantiles of a batch of data for a single variable, meaning the order statistics or ordered values, are plotted vertically as point or marker symbols against fraction of the data or plotting position plotted horizontally; 2) a box showing median and quartiles is shown either in the same space or alongside. Optional choices include 3) plotting the quantiles on a transformed scale (for example, logarithmic); 4) plotting fraction of the data on a transformed scale (for example, normal quantile); 5) adding details in the tails of the box plot (for example, spikes extending to paired percentiles or quantiles); 6) adding indications of other summary measures (for example, means or geometric means shown as extra horizontal lines); 7) showing quantile traces as connected curves rather than a series of marker symbols; 8) smoothing of quantiles to reduce minor noise; 9) plotting quartile or midgap plots instead of more conventional box plots; and 10) showing confidence intervals for any suitable measure of level (location, central tendency) instead of median-quartile boxes. Quantile-box plots provide indications of the level, spread, and shape of distributions together with indications of detailed features whenever they occur, such as outliers, spikes, and gaps without values. They do not supersede other useful displays such as histograms or density estimates, but they do not entail possibly awkward choices of bin width or start or of kernel type and bandwidth, nor do they require tuning of such choices. Quantile plots show essentially the same information as plots of the cumulative distribution or its complement, which may well be preferred by researchers as already familiar or as conventional in their field. Although quantile-box plots for individual batches may be interesting or useful, their main value often lies in comparison of two or more batches of data. While it starts from Parzen’s ideas, the discussion extends earlier and later. The history of quantile plots and box plots, usually under other names, is longer and more diverse than is often appreciated. The use of median-quartile boxes by Arthur L. Bowley around 1897 and by William C. Marshall in 1921 has escaped most reviews. In Stata terms, the community-contributed command, qplot , as updated in this issue, is a convenient workhorse for quantile and associated plots. The community- contributed commands pctilesets , quantilesets , and cisets , discussed in the previous issue (Cox, 2026, Stata Journal 26: 291–322), may be found to be convenient for calculation of quantile and other summaries. The official command egen continues to be useful for similar calculations. A strategy of divide and conquer—dividing the problem into steps of numerical calculation and graphical display—will often be helpful.
Han and Lee (2022, Economics Letters 220: art. 110882) propose a least-squares approach to correct for selectivity bias in the within-group estimator of linear panel-data models with fixed effects and sample selection. In this article, we review that estimator and introduce a command that provides a numerically stable implementation.
Researchers typically collect experimental data sequentially, allowing early outcome observations and adaptive treatment assignment to reduce exposure to inferior treatments. In this article, we review multiarmed bandit adaptive experimental designs that balance exploration and exploitation. Because adaptively collected experimental data through bandit algorithms violate standard asymptotics, inference is challenging. We implement an estimator that yields valid heteroskedasticity-robust confidence intervals in batched bandit designs and compare coverage in Monte Carlo simulations. We introduce bbandits for Stata, a community-contributed package for designing experiments via simulation, running interactive bandit experiments, and implementing and analyzing adaptively collected data. bbandits includes three common assignment algorithms— ε -first, ε-greedy, and Thompson sampling—and supports estimation, inference, and visualization.
We integrate the Java GeoTools and NetCDF libraries into Stata and introduce a new suite of commands for reading and processing geospatial raster data entirely within Stata. These commands enable Stata users to seamlessly extract data from GeoTIFF and NetCDF files, reproject geographic coordinates, match raster data with geographical locations, and compute zonal statistics. By eliminating round trips to external GIS or scripting environments, the commands streamline workflows and improve reproducibility of spatial analyses conducted in Stata. We document the command syntax and provide worked examples that illustrate typical use cases—metadata inspection, subsetting, coordinate reference systems harmonization, polygon-based aggregation, and point-based exposure estimation—demonstrating how the package supports end-to-end spatial data preparation and analysis.
Three new commands for data reduction— cisets, pctilesets , and quantilesets —are introduced with examples. Each command lists a set of results and saves those results to a separate dataset, whether of confidence intervals or of percentiles or quantiles. Immediate applications include graphical displays, illustrated by examples of confidence intervals shown in various ways and of complements and alternatives to box plots.
Finite mixture models are versatile tools for modeling unobserved population heterogeneity because they identify latent subgroups within a population from a set of observed variables. A common extension involves linking these classes to covariates or outcomes for further analysis in a stepwise fashion. However, standard methods for this task can introduce bias due to misclassification error when assigning observations to a latent class. In this article, we introduce the step3 command, which implements two bias-adjusted methods-the Bolck-Croon-Hagenaars method and the maximum likelihood approach-that address these issues by accounting for classification uncertainty. We explain the nature of the biases in standard approaches, present the theoretical foundations of these bias-adjusted methods, and provide practical implementation details using step3. Through a simulation study, we illustrate the advantages of these methods in reducing bias and improving estimation accuracy.
onlyuseful is a command that automates dataset reduction by retaining only the variables explicitly used in a Stata script. By leveraging PowerShell, it enhances reproducibility and efficiency in data management for large datasets and supports research replicability.
Spatial unit roots can lead to spurious regression results. We present an overview of the methods developed in M & uuml;ller and Watson (2024, Econometrica 92: 1661-1695) to test and correct for spatial unit roots and introduce a suite of commands (spur) implementing these techniques. Our commands exactly replicate results in M & uuml;ller and Watson (2024) using the same data as Chetty et al. (2014, Quarterly Journal of Economics 129: 1553-1623). As a guide for applied researchers, we provide a practical algorithm for regression analysis using these methods and a simulated illustration in Stata.
In this article, we introduce the package crossq , a user-friendly tool for estimating and visualizing the cross-quantilogram, which is a method that captures quantile dependence between two series and tests for directional predictability. The package includes three core commands: crossq_main estimates the cross-quantilogram coefficients using unconditional or conditional approaches; crossq_qstat performs quantile-based directional predictability tests using Box- Pierce and Ljung-Box-type Q statistics; and crossq_plot visualizes the results with confidence intervals or heatmaps across quantile combinations. Additional features include the partial cross-quantilogram, stationary bootstrap inference, and flexible customization options for estimation, testing, and visualization. These make the package suitable for a wide range of empirical applications in both time- series and cross-sectional contexts.
In this article, we present the cgmstats package for the analysis of continuous glucose monitoring (CGM) data. The use of wearable CGMs is growing rapidly. The latest generation of CGM systems do not require fingerstick calibration, are minimally invasive, and are frequently used in research studies. CGM sensors are typically worn for up to 2 weeks and record interstitial glucose measurements every minute to every 15 minutes, depending on the sensor used. CGM systems generate hundreds of measurements per day and thousands of measurements in one person over a single wear. There is a need for tools that allow researchers to efficiently organize and summarize the wealth of data on glucose patterns produced by CGM systems. The cgmstats package generates CGM summary measures for data from a variety of CGM systems and allows the user to flexibly define ranges and generate data visualizations. In this article, we provide an overview of the cgmstats package and examples of its use. The cgmstats package supports rigorous and reproducible analyses of CGM data.
Debugging code can be time-consuming, frustrating, and even dismaying, but it is essential for almost any Stata project that is at all original or challenging. In this column, I provide advice on debugging and a variety of examples, structured around a series of simple tips. Read the help. Look at the code. Note or even create error messages. Debug actively. Simplify the problem first, complicate later. Attend to detail. Try to think like Stata. Try to think like the programmer. Find a Stata friend. Ask the Stata community.
For the analysis of survival data obtained from cancer registries, it is common to use the relative survival framework, which incorporates expected mortality rates rather than relying on cause-of-death information. The relative survival framework enables comparisons between population groups where the effect of mortality due to the cancer is isolated to enable fair comparisons when there is differential other-cause mortality between the groups being compared. The stpp command provides nonparametric estimates of marginal relative survival and a range of other nonparametric estimates, including all-cause survival and crude probabilities of death and also recently developed reference-adjusted measures. In addition, it enables (age) standardization to be performed using both traditional standardization and the individual weighting approach. The genindweights command simplifies the process of calculating individual weights.
In this article, I present the ownchild command, which calculates age-specific fertility rates using an advanced version of the own-children method, originally proposed by Grabill and Cho (1965, Demography 2: 50-73). ownchild provides a graphical representation of average fertility patterns by age over the last 15 years, generates weighted estimates for population subgroups, enhances accuracy by restricting calculations to biological connections between children and their mothers, and delivers 15 reproductive measures. These measures include total and net fertility rates, mean age at childbearing, the percentage of teenage pregnancies, the proportion of childless women, the percentage of unmatched children, and the replacement level of fertility. I demonstrate the capabilities of ownchild using 2010 Brazilian Census microdata sourced from Integrated Public Use Microdata Series-International to calculate fertility rates by race.