bluuebunny/crossref_metadata_2025 huggingface dataset:
Estimating Parameters of Dichotomous and Ordinal Item Response Models with Gllamm
Authors: Zheng Xiaohui , Rabe-Hesketh Sophia
Published: November 2018

Item response theory models are measurement models for categorical responses. Traditionally, the models are used in educational testing, where responses to test items can be viewed as indirect measures of latent ability. The test items are scored either dichotomously (correct–incorrect) or by using an ordinal scale (a grade from poor to excellent). Item response models also apply equally for measurement of other latent traits. Here we describe the one- and two-parameter logit models for dichotomous items, the partial-credit and rating scale models for ordinal items, and an extension of these models where the latent variable is regressed on explanatory variables. We show how these models can be expressed as generalized linear latent and mixed models and fitted by using the user-written command gllamm.
Modeling of the Cure Fraction in Survival Studies
Authors: Lambert Paul C.
Published: November 2018

Cure models are a special type of survival analysis model where it is assumed that there are a proportion of subjects who will never experience the event and thus the survival curve will eventually reach a plateau. In population-based cancer studies, cure is said to occur when the mortality (hazard) rate in the diseased group of individuals returns to the same level as that expected in the general population. The cure fraction is of interest to patients and a useful measure to monitor trends and differences in survival of curable disease. I will describe the strsmix and strsnmix commands, which fit the two main types of cure fraction model, namely, the mixture and nonmixture cure fraction models. These models allow incorporation of the expected background mortality rate and thus enable the modeling of relative survival when cure is a possibility. I give an example to illustrate the commands.
Profile Likelihood for Estimation and Confidence Intervals
Authors: Royston Patrick
Published: November 2018

Normal-based confidence intervals for a parameter of interest are inaccurate when the sampling distribution of the estimate is nonnormal. The technique known as profile likelihood can produce confidence intervals with better coverage. It may be used when the model includes only the variable of interest or several other variables in addition. Profile-likelihood confidence intervals are particularly useful in nonlinear models. The command pllf computes and plots the maximum likelihood estimate and profile likelihood–based confidence interval for one parameter in a wide variety of regression models.
An Exact and a Monte Carlo Proposal to the Fisher–Pitman Permutation Tests for Paired Replicates and for Independent Samples
Authors: Kaiser Johannes
Published: November 2018

This article concerns the nonparametric Fisher–Pitman tests for paired replicates and independent samples. After outlining the theory of exact tests, I derive Monte Carlo simulations for both of them. Simulations can be useful if one deals with many observations because of the complexity of the algorithms in regard to sample sizes. The tests are designed to be a more powerful alternative to the Wilcoxon signed-rank test and the Wilcoxon–Mann–Whitney rank-sum test if the observations are given on at least an interval scale. The results gained by Monte Carlo versions of the tests are accurate enough in comparison to the exact versions. Finally, I give examples for using both supplemented tests.
Production Function Estimation in Stata Using the Olley and Pakes Method
Authors: Yasar Mahmut , Raciborski Rafal , Poi Brian
Published: November 2018

Productivity is often computed by approximating the weighted sum of the inputs from the estimation of the Cobb–Douglas production function. Such estimates, however, may suffer from simultaneity and selection biases. Olley and Pakes (1996, Econometrica 64: 1263–1297) introduced a semiparametric method that allows us to estimate the production function parameters consistently and thus obtain reliable productivity measures by controlling for such biases. This study first reviews this method and then introduces a Stata command to implement it. We show that when simultaneity and selection biases are not controlled for, the coefficients for the variable inputs are biased upward and the coefficients for the fixed inputs are biased downward.
Contour-Enhanced Funnel Plots for Meta-Analysis
Authors: Palmer Tom M. , Sutton Alex J. , Peters Jaime L. , Moreno Santiago G.
Published: November 2018

Funnel plots are commonly used to investigate publication and related biases in meta-analysis. Although asymmetry in the appearance of a funnel plot is often interpreted as being caused by publication bias, in reality the asymmetry could be due to other factors that cause systematic differences in the results of large and small studies, for example, confounding factors such as differential study quality. Funnel plots can be enhanced by adding contours of statistical significance to aid in interpreting the funnel plot. If studies appear to be missing in areas of low statistical significance, then it is possible that the asymmetry is due to publication bias. If studies appear to be missing in areas of high statistical significance, then publication bias is a less likely cause of the funnel asymmetry. It is proposed that this enhancement to funnel plots should be used routinely for meta-analyses where it is possible that results could be suppressed on the basis of their statistical significance.
Semiparametric Analysis of Case–control Genetic Data in the Presence of Environmental Factors
Authors: Marchenko Yulia V. , Carroll Raymond J. , Lin Danyu Y. , Amos Christopher I. , Gutierrez Roberto G.
Published: November 2018

In the past decade, many statistical methods have been proposed for the analysis of case–control genetic data with an emphasis on haplotype-based disease association studies. Most of the methodology has concentrated on the estimation of genetic (haplotype) main effects. Most methods accounted for environmental and gene–environment interaction effects by using prospective-type analyses that may lead to biased estimates when used with case–control data. Several recent publications addressed the issue of retrospective sampling in the analysis of case–control genetic data in the presence of environmental factors by developing efficient semiparametric statistical methods. This article describes the new Stata command haplologit, which implements efficient profile-likelihood semiparametric methods for fitting gene–environment models in the very important special cases of a rare disease, a single candidate gene in Hardy–Weinberg equilibrium, and independence of genetic and environmental factors.
Speaking Stata: Distinct Observations
Authors: Cox Nicholas J. , Longton Gary M.
Published: November 2018

Distinct observations are those different with respect to one or more variables, considered either individually or jointly. Distinctness is thus a key aspect of the similarity or difference of observations. It is sometimes confounded with uniqueness. Counting the number of distinct observations may be required at any point from initial data cleaning or checking to subsequent statistical analysis. We review how far existing commands in official Stata offer solutions to this issue, and we show how to answer questions about distinct observations from first principles by using the by prefix and the egen command. The new distinct command is offered as a convenience tool.
Review of Stata Par La Pratique: Statistiques, Graphiques et éléments De Programmation, by Éric Cahuzac and Christophe Bontemps
Authors: Terracol Antoine
Published: November 2018

This article reviews Stata par la pratique, by Éric Cahuzac and Christophe Bontemps.
Speaking Stata: Rowwise
Authors: Cox Nicholas J.
Published: November 2018

Stata's main data model treats observations in rows and variables in columns quite differently, but rowwise problems also arise that require working against the grain. This column shows how to exploit existing functions and egen functions when they exist and apply to such problems. It offers advice on how to build your own loops, egen functions, or programs when needed. Mata provides especially convenient tools for constructing many such functions and programs, centered on putting selected data into matrices and then processing each observation as a separate vector. Two programs, rowsort and rowranks, are formally published with this column.
A Menu-Driven Facility for Sample-Size Calculation in Novel Multiarm, Multistage Randomized Controlled Trials with a Time-to-Event Outcome
Authors: Barthel Friederike M.-S. , Royston Patrick , Parmar Mahesh K. B.
Published: November 2018

We present menu- and command-driven Stata programs for the calculation of sample size, number of events, and trial duration for a novel type of clinical trial design with a time-to-event outcome and two or more experimental arms. The approach is based on terminating accrual of patients to inferior experimental treatment arms at an early stage in the trial, allowing through to the next stage only treatments that show a predefined degree of advantage against the control treatment. The first stage of testing uses an intermediate outcome measure for the definitive (primary) outcome rather than with the primary outcome itself. The experimental arms are compared pairwise with the control arm according to the intermediate outcome measure. Arms that survive the comparison enter the next stage of patient accrual, culminating in comparisons against control on the primary outcome measure.

The features supported include unequal patient allocation, target hazard ratios that may differ from 1 under the null hypothesis, and the ability to stop patient recruitment at a specified time after trial initiation. The computations of sample size and power are based on the asymptotic mean and variance of the log hazard-ratio under the null and alternative hypotheses. The overall operating characteristics are computed from the intermediate and final stage significance levels and power, and the correlation between the log hazard-ratios on the intermediate and primary outcome measures at the different stages. We illustrate the approach with the design of a United Kingdom Medical Research Council six-arm trial in prostate cancer in which the intermediate outcome is failure-free survival and the primary outcome is overall survival.
Bootstrap Assessment of the Stability of Multivariable Models
Authors: Royston Patrick , Sauerbrei Willi
Published: November 2018

Assessing the instability of a multivariable model is important but is rarely done in practice. Model instability occurs when selected predictors—and for multivariable fractional polynomial modeling, selected functions of continuous predictors—are sensitive to small changes in the data. Bootstrap analysis is a useful technique for investigating variations among selected models in samples drawn at random with replacement. Such samples mimic datasets that are structurally similar to that under study and that could plausibly have arisen instead. The bootstrap inclusion fraction of a candidate variable usefully indicates the importance of the variable. We describe Stata tools for stability analysis in the context of the mfp command for multivariable model building. We offer practical guidance and illustrate the application of the tools to a study in prostate cancer.
A Conversation with Kit Baum
Authors: Cox Nicholas J.
Published: November 2018

As explained in the Editorial announcements at the start of this issue, the Stata Journal will be featuring various interviews with selected members of the Stata community in 2010, Stata's 25th anniversary year. In this issue, we start with an online interview, dated October 14, 2009, of Christopher F. “Kit” Baum, an economics professor at Boston College. Kit has been highly active as a Stata user since the 1990s, contributing as an author and associate editor to this journal and its predecessor, the Stata Technical Bulletin; as a much-downloaded Stata program author; as an author of two notable Stata-based texts; as a frequent participant on Statalist and at Users Group meetings in both the United States and several European countries; and as founder and maintainer for more than a decade of the SSC archive, which now contains many hundred user-written Stata packages. In this interview, he comments on how he got into Stata and adds his own speculations for the future.
Riskplot: A Graphical aid to Investigate the Effect of Multiple Categorical Risk Factors
Authors: Falcaro Milena , Pickles Andrew
Published: November 2018

In this article, we describe a command, riskplot, aiming to provide a visual aid to assess the strength, importance, and consistency of risk factor effects. The plotted form is a dendrogram that branches out as it moves from left to right. It displays the mean of some score or the absolute risk of some outcome for a sample that is progressively disaggregated by a sequence of categorical risk factors. Examples of the application of the new command are drawn from the analysis of depression and fluid intelligence in a sample of elderly men and women.
Centering and Reference Groups for Estimates of Fixed Effects: Modifications to Felsdvreg
Authors: Mihaly Kata , McCaffrey Daniel F. , Lockwood J. R. , Sass Tim R.
Published: November 2018

Availability of large, multilevel longitudinal databases in various fields including labor economics (with workers and firms observed over time) and education research (with students and teachers observed over time) has increased the application of panel-data models with multiple levels of fixed-effects. Existing software routines for fitting fixed-effects models were not designed for applications in which the primary interest is obtaining estimates of any of the fixed-effects parameters. Such routines typically report estimates of fixed effects relative to arbitrary holdout units. Contrasts to holdout units are not ideal in cases where the fixed-effects parameters are of interest because they can change capriciously, they do not correspond to the structural parameters that are typically of interest, and they are inappropriate for empirical Bayes (shrinkage) estimation. We develop an improved parameterization of fixed-effects models using sum-to-zero constraints that provides estimates of fixed effects relative to mean effects within well-defined reference groups (e.g., all firms of a given type or all teachers of a given grade) and provides standard errors for those estimates that are appropriate for shrinkage estimation. We implement our parameterization in a Stata routine called felsdvregdm by modifying the felsdvreg routine designed for fitting high-dimensional fixed-effects models. We demonstrate our routine with an example dataset from the Florida Education Data Warehouse.
Analyzing Longitudinal Data in the Presence of Informative Dropout: The Jmre1 Command
Authors: Pantazis Nikos , Touloumi Giota
Published: November 2018

Many studies in various research areas have designs that involve repeated measurements over time of a continuous variable across a group of subjects. A frequent and serious problem in such studies is the occurrence of missing data. In many cases, missing data are caused by an event that leads to a premature termination of the series of repeated measurements on some subjects. When the probability of the occurrence of this event is related to the subject-specific underlying trend of the variable of interest, this missingness process is called informative censoring or informative dropout. Standard likelihood-based methods (for example, linear mixed models) fail to give consistent estimates. In such cases, one needs to apply methods that simultaneously model the observed data and the missingness process. In this article, we review a method proposed by Touloumi et al. (1999, Statistics in Medicine 18: 1215–1233) to adjust for informative dropout in longitudinal data analysis. We also present the jmre1 command, which can be used to fit the proposed model. The estimation method combines the restricted iterative generalized least-squares method with a nested expectation-maximization algorithm. The method is implemented mainly using Stata's matrix programming language, Mata. Our example is derived from the epidemiology of the HIV infection.
Multivariate Outlier Detection in Stata
Authors: Verardi Vincenzo , Dehon Catherine
Published: November 2018

Before implementing any multivariate statistical analysis based on empirical covariance matrices, it is important to check whether outliers are present because their existence could induce significant biases. In this article, we present the minimum covariance determinant estimator, which is commonly used in robust statistics to estimate location parameters and multivariate scales. These estimators can be used to robustify Mahalanobis distances and to identify outliers. Verardi and Croux (1999, Stata Journal 9: 439–453; 2010, Stata Journal 10: 313) programmed this estimator in Stata and made it available with the mcd command. The implemented algorithm is relatively fast and, as we show in the simulation example section, outperforms the methods already available in Stata, such as the Hadi method.
Review of Multivariable Model-building: A Pragmatic Approach to Regression Analysis Based on Fractional Polynomials for Modeling Continuous Variables, by Royston and Sauerbrei
Authors: Dupont William D.
Published: November 2018

This article reviews Multivariable Model-building: A Pragmatic Approach to Regression Analysis Based on Fractional Polynomials for Modeling Continuous Variables, by Patrick Royston and Willi Sauerbrei.
An Introduction to Maximum Entropy and Minimum Cross-entropy Estimation Using Stata
Authors: Wittenberg Martin
Published: November 2018

Maximum entropy and minimum cross-entropy estimation are applicable when faced with ill-posed estimation problems. I introduce a Stata command that estimates a probability distribution using a maximum entropy or minimum cross-entropy criterion. I show how this command can be used to calibrate survey data to various population totals.
Bacon: An Effective way to Detect Outliers in Multivariate Data Using Stata (and Mata)
Authors: Weber Sylvain
Published: November 2018

Identifying outliers in multivariate data is computationally intensive. The bacon command, presented in this article, allows one to quickly identify outliers, even on large datasets of tens of thousands of observations. bacon constitutes an attractive alternative to hadimvo, the only other command available in Stata for the detection of outliers.
Metaan: Random-effects Meta-analysis
Authors: Kontopantelis Evangelos , Reeves David
Published: November 2018

This article describes the new meta-analysis command metaan, which can be used to perform fixed- or random-effects meta-analysis. Besides the standard DerSimonian and Laird approach, metaan offers a wide choice of available models: maximum likelihood, profile likelihood, restricted maximum likelihood, and a permutation model. The command reports a variety of heterogeneity measures, including Cochran's Q, I2, H2M, and the between-studies variance estimate [Formula: see text]. A forest plot and a graph of the maximum likelihood function can also be generated.
Visualization of Social Networks in Stata Using Multidimensional Scaling
Authors: Corten Rense
Published: November 2018

I describe and illustrate the use of multidimensional scaling methods for visualizing social networks in Stata. The procedure is implemented in the netplot command. I discuss limitations of the approach and sketch possibilities for improvement.
Right-censored Poisson Regression Model
Authors: Raciborski Rafal
Published: November 2018

I present the rcpoisson command for right-censored count-data models with a constant (Terza 1985, Economics Letters 18: 361–365) and variable censoring threshold (Caudill and Mixon 1995, Empirical Economics 20: 183–196). I show the effects of censoring on estimation results by comparing the censored Poisson model with the uncensored one.
Eq5d: A command to Calculate Index Values for the EQ-5D Quality-of-life Instrument
Authors: Ramos-Goñi Juan Manuel , Rivero-Arias Oliver
Published: November 2018

The eq5d command computes an index value using the individual mobility, self care, usual activities, pain or discomfort, and anxiety or depression responses from the EuroQol EQ-5D quality-of-life instrument. The command calculates index values using value sets from eight countries: the United Kingdom, the United States, Spain, Germany, the Netherlands, Denmark, Japan, and Zimbabwe.
Simon's Minimax and Optimal and Jung's Admissible Two-stage Designs with or without Curtailment
Authors: Kunz Cornelia U. , Kieser Meinhard
Published: November 2018

This article describes a new Stata command called simontwostage, which calculates the critical values and sample sizes for two-stage designs for phase II oncology trials. Options are provided to determine the minimax and optimal designs proposed by Simon (1989, Controlled Clinical Trials 10: 1–10) and admissible designs described by Jung et al. (2004, Statistics in Medicine 23: 561–569). Furthermore, nonstochastic and stochastic curtailment rules can be implemented in both stages of the trial, and the properties of the curtailed designs can be examined.
GMM Estimation of the Covariance Structure of Longitudinal Data on Earnings
Authors: Doris Aedín , O'Neill Donal , Sweetman Olive
Published: November 2018

In this article, we discuss generalized method of moments estimation of the covariance structure of longitudinal data on earnings, and we introduce and illustrate a Stata program that facilitates the implementation of the generalized method of moments approach in this context. The program, gmmcovearn, estimates a variety of models that encompass those most commonly used by labor economists. These include models where the permanent component of earnings follows a random growth or random walk process and where the transitory component can follow either an AR(1) or an ARMA(1,1) process. In addition, time-factor loadings and cohort-factor loadings may be incorporated in the transitory and permanent components.
A Robust Instrumental-Variables Estimator
Authors: Desbordes Rodolphe , Verardi Vincenzo
Published: November 2018

The classical instrumental-variables estimator is extremely sensitive to the presence of outliers in the sample. This is a concern because outliers can strongly distort the estimated effect of a given regressor on the dependent variable. Although outlier diagnostics exist, they frequently fail to detect atypical observations because they are themselves based on nonrobust (to outliers) estimators. Furthermore, they do not take into account the combined influence of outliers in the first and second stages of the instrumental-variables estimator. In this article, we present a robust instrumental-variables estimator, initially proposed by Cohen Freue, Ortiz-Molina, and Zamar (2011, Working paper: http://www.stat.ubc.ca/∼ruben/website/cv/cohen-zamar.pdf ), that we have programmed in Stata and made available via the robivreg command. We have improved on their estimator in two different ways. First, we use a weighting scheme that makes our estimator more efficient and allows the computations of the usual identification and overidentifying restrictions tests. Second, we implement a generalized Hausman test for the presence of outliers.
Apportionment Methods
Authors: Kohler Ulrich , Zeh Janina
Published: November 2018

Apportionment methods are used to translate a set of positive natural numbers into a set of smaller natural numbers while keeping the proportions between the numbers very similar. The methods are used to allocate seats in a chamber proportionally to the number of votes for a party in an election or proportionally to regional populations. In this article, we describe six apportionment methods and the user-written egen function apport(), which implements these methods.
A Generalized Hosmer–Lemeshow Goodness-of-Fit Test for Multinomial Logistic Regression Models
Authors: Fagerland Morten W. , Hosmer David W.
Published: November 2018

Testing goodness of fit is an important step in evaluating a statistical model. For binary logistic regression models, the Hosmer–Lemeshow goodness-of-fit test is often used. For multinomial logistic regression models, however, few tests are available. We present the mlogitgof command, which implements a goodness-of-fit test for multinomial logistic regression models. This test can also be used for binary logistic regression models, where it gives results identical to the Hosmer–Lemeshow test.
Tools to Simulate Realistic Censored Survival-Time Distributions
Authors: Royston Patrick
Published: November 2018

Simulation of realistic censored survival times is challenging. Most research studies use highly simplified models, such as the exponential, that do not adequately reflect the patterns of time to event and censoring seen in real datasets. In this article, I present a general method of simulating such data based on flexible parametric survival models (Royston and Parmar, 2002, Statistics in Medicine 21: 2175–2197). A key component of the approach is modeling not only the time to event but also the time to censoring. I illustrate the methods in data from clinical trials and from a prognostic study. I also describe a new Stata program, stsurvsim, that does the necessary calculations.
A Programmer's Command to Build Formatted Statistical Tables
Authors: Gallup John Luke
Published: November 2018

The frmttable command is a tool for experienced users and programmers to create formatted tables from statistics and write them to Word or LATEX files. My objective is to provide as much control over the layout and formatting of the statistical tables as possible in both file formats while keeping the syntax simple. Users can create rectangular tables with any configuration of data and text; specify numeric formats, font sizes, and font types at the table cell level; specify row spacing; and place lines in or around the table. A complex table can be built by merging or appending new statistics to an existing table, and multiple tables can be included in the same document, making it possible to create a fully formatted statistical appendix from a single do-file. In this article, I provide examples of the ways in which programmers call frmttable to create formatted tables of statistics.
Modeling Underdispersed Count Data with Generalized Poisson Regression
Authors: Harris Tammy , Yang Zhao , Hardin James W.
Published: November 2018

We present motivation and new Stata commands for modeling count data. While the focus of this article is on modeling data with underdispersion, the new command for fitting generalized Poisson regression models is also suitable as an alternative to negative binomial regression for overdispersed data.
Speaking Stata: Matrices as Look-Up Tables
Authors: Cox Nicholas J.
Published: November 2018

Matrices in Stata can serve as look-up tables. Because Stata will accept references to matrix elements within many commands, most notably generate and replace, users can access and use values from a table in either vector or full matrix form. Examples are given for entry of small datasets, recoding of categorical variables, and quantile-based or similar binning of counted or measured variables. In the last case, the device grants easy exploration of the consequences of different binning conventions and the instability of bin allocation.
Stata as a Numerical Tool for Scientific Thought Experiments: A Tutorial with Worked Examples
Authors: Wimberley Theresa , Parner Erik , Støvring Henrik
Published: November 2018

Thought experiments based on simulation can be used to explain the impact of the chosen study design, statistical analysis strategy, or the sensitivity of results to fellow researchers. In this article, we demonstrate with two examples how to implement quantitative thought experiments in Stata. The first example uses a large-sample approach to study the impact on the estimated effect size of dichotomizing an exposure variable at different values. The second example uses simulations of datasets of realistic size to illustrate the necessity of using sampling fractions as inverse probability weights in statistical analysis for protection against bias in a complex sampling design. We also give a brief outline of the general steps needed for implementing quantitative thought experiments in Stata. We demonstrate how Stata provides programming facilities for conveniently implementing such thought experiments, with the advantage of saving researchers time, speculation, and debate as well as improving communication in interdisciplinary research groups.
Within and between Estimates in Random-Effects Models: Advantages and Drawbacks of Correlated Random Effects and Hybrid Models
Authors: Schunck Reinhard
Published: November 2018

Correlated random-effects (Mundlak, 1978, Econometrica 46: 69–85; Wooldridge, 2010, Econometric Analysis of Cross Section and Panel Data [MIT Press]) and hybrid models (Allison, 2009, Fixed Effects Regression Models [Sage]) are attractive alternatives to standard random-effects and fixed-effects models because they provide within estimates of level 1 variables and allow for the inclusion of level 2 variables. I discuss these models, give estimation examples, and address some complications that arise when interaction effects are included.
Regression Anatomy, Revealed
Authors: Filoso Valerio
Published: November 2018

The regression anatomy theorem (Angrist and Pischke, 2009, Mostly Harmless Econometrics: An Empiricist's Companion [Princeton University Press]) is an alternative formulation of the Frisch–Waugh–Lovell theorem (Frisch and Waugh, 1933, Econometrica 1: 387–401; Lovell, 1963, Journal of the American Statistical Association 58: 993–1010), a key finding in the algebra of ordinary least-squares multiple regression models. In this article, I present a command, reganat, to implement graphically the method of regression anatomy. This addition complements the built-in Stata command avplot in the validation of linear models, producing bidimensional scatterplots and regression lines obtained by controlling for the other covariates, along with several fine-tuning options. Moreover, I provide 1) a fully worked-out proof of the regression anatomy theorem and 2) an explanation of how the regression anatomy and the Frisch–Waugh–Lovell theorems relate to partial and semipartial correlations, whose coefficients are informative when evaluating relevant variables in a linear regression model.
A Menu-Driven Facility for Sample-Size Calculations in Cluster Randomized Controlled Trials
Authors: Hemming Karla , Marsh Jen
Published: November 2018

We introduce the Stata menu-driven command clustersampsi, which calculates sample sizes, detectable differences, and power for cluster randomized controlled trials. The command permits continuous, binary, and rate outcomes (with normal approximations) for comparisons of two-sided tests in two equal-sized arms. The command allows for specification of the number of clusters available, or the cluster size, or the average cluster size along with an estimate of the variation of cluster sizes. When the number of clusters available is insufficient to detect the required difference at the prespecified power, clustersampsi will return the minimum number of clusters required under the prespecified design along with the minimum detectable difference and maximum achievable power (both for the pre-specified number of clusters). Cluster heterogeneity can be parameterized by using either the intracluster correlation or the coefficient of variation. The command is illustrated via examples.
Estimating Geweke's (1982) Measure of Instantaneous Feedback
Authors: Dicle Mehmet F. , Levendis John
Published: November 2018

In this article, we describe the gwke82 command, which implements a measure of instantaneous feedback for two time series following Geweke (1982, Journal of the American Statistical Association 77: 304–313).
Two-Stage Nonparametric Bootstrap Sampling with Shrinkage Correction for Clustered Data
Authors: Ng Edmond S.-W. , Grieve Richard , Carpenter James R.
Published: November 2018

This article describes a new Stata command, tsb, for performing a stratified two-stage nonparametric bootstrap resampling procedure for clustered data. Estimates for uncertainty around the point estimate, such as standard error and confidence intervals, are derived from the resultant bootstrap samples. A shrinkage estimator proposed for correcting possible overestimation due to second-stage sampling is implemented as default. Although this command is written with cost effectiveness analyses alongside cluster trials in mind, it is applicable to the analysis of continuous endpoints in cluster trials more generally. The use of this command is exemplified with a case study of a cost effectiveness analysis undertaken alongside a cluster randomized trial. We also report bootstrap confidence interval coverage by using data from a published simulation study.
Joint Modeling of Longitudinal and Survival Data
Authors: Crowther Michael J. , Abrams Keith R. , Lambert Paul C.
Published: November 2018

The joint modeling of longitudinal and survival data has received remarkable attention in the methodological literature over the past decade; however, the availability of software to implement the methods lags behind. The most common form of joint model assumes that the association between the survival and the longitudinal processes is underlined by shared random effects. As a result, computationally intensive numerical integration techniques such as adaptive Gauss–Hermite quadrature are required to evaluate the likelihood. We describe a new user-written command, stjm, that allows the user to jointly model a continuous longitudinal response and the time to an event of interest. We assume a linear mixed-effects model for the longitudinal submodel, allowing flexibility through the use of fixed or random fractional polynomials of time. Four choices are available for the survival submodel: the exponential, Weibull or Gompertz proportional hazard models, and the flexible parametric model (stpm2). Flexible parametric models are fit on the log cumulative-hazard scale, which has direct computational benefits because it avoids the use of numerical integration to evaluate the cumulative hazard. We describe the features of stjm through application to a dataset investigating the effect of serum bilirubin level on time to death from any cause in 312 patients with primary biliary cirrhosis.
Maximum Likelihood and Generalized Spatial Two-Stage Least-Squares Estimators for a Spatial-Autoregressive Model with Spatial-Autoregressive Disturbances
Authors: Drukker David M. , Prucha Ingmar R. , Raciborski Rafal
Published: November 2018

We describe the spreg command, which implements a maximum likelihood estimator and a generalized spatial two-stage least-squares estimator for the parameters of a linear cross-sectional spatial-autoregressive model with spatial-autoregressive disturbances.
Semiparametric Fixed-Effects Estimator
Authors: Libois François , Verardi Vincenzo
Published: November 2018

In this article, we describe the Stata implementation of Baltagi and Li's (2002, Annals of Economics and Finance 3: 103–116) series estimator of partially linear panel-data models with fixed effects. After a brief description of the estimator itself, we describe the new command xtsemipar. We then simulate data to show that this estimator performs better than a fixed-effects estimator if the relationship between two variables is unknown or quite complex.
Bonferroni and Holm Approximations for Šidák and Holland–Copenhaver q-Values
Authors: Newson Roger B.
Published: November 2018

I describe the use of the Bonferroni and Holm formulas as approximations for Šidák and Holland–Copenhaver formulas when issues of precision are encountered, especially with q-values corresponding to very small p-values.
Fitting the Generalized Multinomial Logit Model in Stata
Authors: Gu Yuanyuan , Hole Arne Risa , Knox Stephanie
Published: November 2018

In this article, we describe the gmnl Stata command, which can be used to fit the generalized multinomial logit model and its special cases.
Computing Adjusted Risk Ratios and Risk Differences in Stata
Authors: Norton Edward C. , Miller Morgen M. , Kleinman Lawrence C.
Published: November 2018

In this article, we explain how to calculate adjusted risk ratios and risk differences when reporting results from logit, probit, and related nonlinear models. Building on Stata's margins command, we create a new postestimation command, adjrr, that calculates adjusted risk ratios and adjusted risk differences after running a logit or probit model with a binary, a multinomial, or an ordered outcome. adjrr reports the point estimates, delta-method standard errors, and 95% confidence intervals and can compute these for specific values of the variable of interest. It automatically adjusts for complex survey design as in the fit model. Data from the Medical Expenditure Panel Survey and the National Health and Nutrition Examination Survey are used to illustrate multiple applications of the command.
A Short Guide and a Forest Plot Command (Ipdforest) for One-Stage Meta-Analysis
Authors: Kontopantelis Evangelos , Reeves David
Published: November 2018

In this article, we describe a new individual patient data meta-analysis postestimation command, ipdforest. The command produces a forest plot following a one-stage meta-analysis with xtmixed or xtmelogit. (These commands have been renamed in Stata 13 to mixed and meqrlogit, respectively; ipdforest is currently not compatible with the new names.) The overall effect is obtained from the preceding mixed-effects regression and the study effects from linear or logistic regressions on each study, which are executed within ipdforest. Individual patient data meta-analysis models with Stata are discussed.
Financial Portfolio Selection using the Multifactor Capital Asset Pricing Model and Imported Options Data
Authors: Dicle Mehmet F.
Published: November 2018

Diversification and portfolio selection are integral parts of a finance curriculum. In this article, a multifactor capital asset pricing model is fit for components of the Dow Jones Composite Index using data from Yahoo! Finance. Along with the capital asset pricing model's Beta, other statistics that are common criteria for portfolio selection are calculated: historic standard deviation (total risk), total return, average daily return, and Sharpe and Treynor measures. Two new commands are introduced, fetchcomponents and fetchportfolio, that automate the entire process. A third new command, fetchyahoooptions, is provided to download and parse equity options data from Yahoo! Finance webpages and, optionally, to calculate the implied volatilities for the downloaded options.
Stochastic Frontier Analysis using Stata
Authors: Belotti Federico , Daidone Silvio , Ilardi Giuseppe , Atella Vincenzo
Published: November 2018

This article describes sfcross and sfpanel, two new Stata commands for the estimation of cross-sectional and panel-data stochastic frontier models. sfcross extends the capabilities of the frontier command by including additional models (Greene, 2003, Journal of Productivity Analysis 19: 179–190; Wang, 2002, Journal of Productivity Analysis 18: 241–253) and command functionalities, such as the possibility of managing complex survey data characteristics. Similarly, sfpanel allows one to fit a much wider range of time-varying inefficiency models compared with the xtfrontier command, including the model of Cornwell, Schmidt, and Sickles (1990, Journal of Econometrics 46: 185–200); the model of Lee and Schmidt (1993, in The Measurement of Productive Efficiency: Techniques and Applications), a production frontier model with flexible temporal variation in technical efficiency; the flexible model of Kumbhakar (1990, Journal of Econometrics 46: 201–211); the inefficiency effects model of Battese and Coelli (1995 Empirical Economics 20: 325–332); and the “true” fixed- and random-effects models of Greene (2005a, Journal of Econometrics 126: 269–303). A brief overview of the stochastic frontier literature, a description of the two commands and their options, and examples using simulated and real data are provided.
Cmpute: A Tool to Generate or Replace a Variable
Authors: Royston Patrick
Published: November 2018

I provide a new programming tool, cmpute, to manage conveniently the creation of a new variable or the replacement of an existing variable interactively or within a Stata program.
Group2: Generating the Finest Partition that is Coarser than Two Given Partitions
Authors: Pauliac Christian H. Salas
Published: November 2018

In this article, I develop a useful interpretation of the function group() based on partitions belonging to mathematical set theory, an interpretation that in turn engenders a related command here called group2. In the context of the partitioning of sets, while the function group() creates a variable that generates the coarsest partition that is finer than the finest partition generated by the variables used as arguments, the group2 command will create a variable that generates the finest partition that is coarser than the coarsest partition generated by the variables used as arguments. This latter operation has proven very useful in several problems of database management. An introduction of this new command in the context of mathematical partitions is provided, and two examples of its application are presented.
Estimating Adjusted Associations between Random Effects from Multilevel Models: The Reffadjust Package
Authors: Palmer Tom M. , Macdonald-Wallis Corrie M. , Lawlor Debbie A. , Tilling Kate
Published: November 2018

We describe a method to estimate associations between random effects from multilevel models. We provide two new postestimation commands, reffadjustsim and reffadjust4nlcom, which are distributed as the reffadjust package. These commands produce the estimates and their associated confidence intervals. The commands are used after official Stata multilevel model estimation commands mixed, meqrlogit, and meqrpoisson (formerly named xtmixed, xtmelogit, and xtmepoisson, respectively, before Stata 13) and with models fit in the MLwiN statistical software package via the runmlwin command. We demonstrate our commands with several simulated datasets and for a bivariate outcome model investigating the relationship between weight and mean arterial pressure in pregnant women using data from the Avon Longitudinal Study of Parents and Children. Our method and commands help to improve the interpretability of estimated random-effects variance components from multilevel models.
Estimating Marginal Treatment Effects using Parametric and Semiparametric Methods
Authors: Brave Scott , Walstrum Thomas
Published: November 2018

We describe the new command margte, which computes marginal and average treatment effects for a model with a binary treatment and a continuous outcome given selection on unobservables and returns. Marginal treatment effects differ from average treatment effects in instances where the impact of treatment varies within a population in correlation with unobserved characteristics. Both parametric and semiparametric estimation methods can be used with margte, and we provide evidence from a Monte Carlo simulation for when each is preferable.
From Stata to aML
Authors: Ayllón Sara
Published: November 2018

In this article, I explain how to exploit Stata to run multilevel multiprocess regressions with applied maximum likelihood (aML). I show how a single do-file can prepare the dataset, write the control files, input the starting values, and run the regressions without the need to manually open the aML's Command Prompt window. If desired, results can be brought back to Stata for postestimation. I also provide an example that illustrates how well Stata and aML work together.
Note on Lilien and Modified Lilien Index
Authors: Ansari Muhammad Rashid , Mussida Chiara , Pastore Francesco
Published: November 2018

This article is a companion to the Lilien (lilien) and modified Lilien commands for computing relative indices in Stata. In this article, we illustrate the main features of the commands with an application to the structural determinants of regional unemployment.
Application of Multiple Imputation using the Two-Fold Fully Conditional Specification Algorithm in Longitudinal Clinical Data
Authors: Welch Catherine , Bartlett Jonathan , Petersen Irene
Published: November 2018

Electronic health records of longitudinal clinical data are a valuable resource for health care research. One obstacle of using databases of health records in epidemiological analyses is that general practitioners mainly record data if they are clinically relevant. We can use existing methods to handle missing data, such as multiple imputation (MI), if we treat the unavailability of measurements as a missing-data problem. Most software implementations of MI do not take account of the longitudinal and dynamic structure of the data and are difficult to implement in large databases with millions of individuals and long follow-up. Nevalainen, Kenward, and Virtanen (2009, Statistics in Medicine 28: 3657–3669) proposed the two-fold fully conditional specification algorithm to impute missing data in longitudinal data. It imputes missing values at a given time point, conditional on information at the same time point and immediately adjacent time points. In this article, we describe a new command, twofold, that implements the two-fold fully conditional specification algorithm. It is extended to accommodate MI of longitudinal clinical records in large databases.
Review of Introduction to Time Series Using Stata by Sean Becketti
Authors: Masterov Dimitriy V.
Published: November 2018

In this article, I review Introduction to Time Series Using Stata by Sean Becketti (2013 [Stata Press]).
Space-Filling Location Selection
Authors: Bia Michela , Van Kerm Philippe
Published: November 2018

In this article, we describe an implementation of a space-filling location-selection algorithm. The objective is to select a subset from a list of locations so that the spatial coverage of the locations by the selected subset is optimized according to a geometric criterion. Such an algorithm designed for geographical site selection is useful for determining a grid of points that “covers” a data matrix as needed in various nonparametric estimation procedures.
Review of An Introduction to Stata for Health Researchers, Fourth Edition, by Juul and Frydenberg
Authors: Linden Ariel
Published: November 2018

In this article, I review An Introduction to Stata for Health Researchers, Fourth Edition, by Svend Juul and Morten Frydenberg (2014 [Stata Press]).
Plotting Regression Coefficients and other Estimates
Authors: Jann Ben
Published: November 2018

Graphical display of regression results has become increasingly popular in presentations and in scientific literature because graphs are often much easier to read than tables. Such plots can be produced in Stata by the marginsplot command (see [R] marginsplot). However, while marginsplot is versatile and flexible, it has two major limitations: it can only process results left behind by margins (see [R] margins), and it can handle only one set of results at a time. In this article, I introduce a new command called coefplot that overcomes these limitations. It plots results from any estimation command and combines results from several models into one graph. The default behavior of coefplot is to plot markers for coefficients and horizontal spikes for confidence intervals. However, coefplot can also produce other types of graphs. I illustrate the capabilities of coefplot by using a series of examples.