Stata tip 157: Adding extra lines to graphs
(2024)
Journal Article
Cox, N. J. (2024). Stata tip 157: Adding extra lines to graphs. The Stata Journal, 24(3), 546-550. https://doi.org/10.1177/1536867x241276116
Dr Nicholas Cox's Outputs (108)
Stata tip 156: Concentration and diversity measures using egen (2024)
Journal Article
Cox, N. J. (2024). Stata tip 156: Concentration and diversity measures using egen. The Stata Journal, 24(3), 535-545. https://doi.org/10.1177/1536867x241276115
Speaking Stata: Quantile–quantile plots, generalized (2024)
Journal Article
Cox, N. J. (2024). Speaking Stata: Quantile–quantile plots, generalized. The Stata Journal, 24(3), 514-534. https://doi.org/10.1177/1536867x241276114Quantile-quantile plots in the precise sense of scatterplots showing corresponding quantiles of two variables have long been supported by official command qqplot. That command is generalized here in several ways in a new command, qqplotg. In this art... Read More about Speaking Stata: Quantile–quantile plots, generalized.
Speaking Stata: The joy of sets: Graphical alternatives to Euler and Venn diagrams (2024)
Journal Article
Cox, N. J., & Morris, T. P. (2024). Speaking Stata: The joy of sets: Graphical alternatives to Euler and Venn diagrams. The Stata Journal, 24(2), 329-361. https://doi.org/10.1177/1536867x241258010Membership of overlapping or intersecting sets may be recorded in a bundle of (0, 1) indicator variables. Annotated Euler or Venn diagrams may be used to show graphically the frequencies of subsets so defined, but beyond just a few sets such diagrams... Read More about Speaking Stata: The joy of sets: Graphical alternatives to Euler and Venn diagrams.
Speaking Stata: Finding the denominator: Minimum sample size from percentages (2023)
Journal Article
Cox, N. J. (2023). Speaking Stata: Finding the denominator: Minimum sample size from percentages. The Stata Journal, 23(4), 1086-1095. https://doi.org/10.1177/1536867x231212453Percentage breakdowns for a series of classes or categories are sometimes reported without a specification of class frequencies or even the total sample size. This column surveys the problem of estimating the minimum sample size and class frequencies... Read More about Speaking Stata: Finding the denominator: Minimum sample size from percentages.
Speaking Stata: Replacing missing values: The easiest problems (2023)
Journal Article
Cox, N. J. (2023). Speaking Stata: Replacing missing values: The easiest problems. The Stata Journal, 23(3), 884-896. https://doi.org/10.1177/1536867x231196519Missing values are common in real datasets, and what to do about them is a large and challenging question. This column focuses on the easiest problems in which a researcher is clear, or at least highly confident, about what missing values should be i... Read More about Speaking Stata: Replacing missing values: The easiest problems.
Stata tip 151: Puzzling out some logical operators (2023)
Journal Article
Cox, N. J. (2023). Stata tip 151: Puzzling out some logical operators. The Stata Journal, 23(1), https://doi.org/10.1177/1536867x231162009The logical operators & (“and”) and | (“or”) can sometimes be tricky in statistical software such as Stata. They are extremely useful, so you need to understand thoroughly how they work. Any trickiness arises mostly in translating from ordinary langu... Read More about Stata tip 151: Puzzling out some logical operators.
Speaking Stata: Automating axis labels: Nice numbers and transformed scales (2022)
Journal Article
Cox, N. J. (2022). Speaking Stata: Automating axis labels: Nice numbers and transformed scales. The Stata Journal, 22(4), 975-995. https://doi.org/10.1177/1536867x221141058Two common problems with graph axis labels are to decide in advance on some “nice” numbers to use on one or both axes and to show particular labels on some transformed scale. In this column, I discuss the nicelabels and mylabels commands, which addre... Read More about Speaking Stata: Automating axis labels: Nice numbers and transformed scales.
Stata tip 148: Searching for words within strings (2022)
Journal Article
Cox, N. J. (2022). Stata tip 148: Searching for words within strings. The Stata Journal, 22(4), 998-1003. https://doi.org/10.1177/1536867x221141068
Speaking Stata: The largest five - A tale of tail values (2022)
Journal Article
Cox, N. J. (2022). Speaking Stata: The largest five - A tale of tail values. The Stata Journal, 22(2), 446-459. https://doi.org/10.1177/1536867x221106436How do you work with the largest five, or smallest five, or any other fixed number of values in a tail of a distribution? In this column, I give examples of problems and code for basic calculations as a prelude to graphics, tables, and more detailed... Read More about Speaking Stata: The largest five - A tale of tail values.
Stata tip 145: Numbering weeks within months (2022)
Journal Article
Cox, N. J. (2022). Stata tip 145: Numbering weeks within months. The Stata Journal, 22(1), https://doi.org/10.1177/1536867x221083928
Speaking Stata: Loops in parallel (2021)
Journal Article
Cox, N. J. (2021). Speaking Stata: Loops in parallel. The Stata Journal, 21(4), https://doi.org/10.1177/1536867x211063415This column is a tutorial discussing looping in parallel using foreach and forvalues. Such looping may use not only local macros defined for the purpose but also other devices, including the gettoken command and ways to increment and decrement other... Read More about Speaking Stata: Loops in parallel.
Stata tip 144: Adding variable text to graphs that use a by() option (2021)
Journal Article
Cox, N. J. (2021). Stata tip 144: Adding variable text to graphs that use a by() option. The Stata Journal, 21(4), https://doi.org/10.1177/1536867x211063413
Speaking Stata: Ordering or ranking groups of observations (2021)
Journal Article
Cox, N. J. (2021). Speaking Stata: Ordering or ranking groups of observations. The Stata Journal, 21(3), 818-837. https://doi.org/10.1177/1536867x211045582Results for categorical variables may often be clearer if those variables are reordered or reranked, say, according to some measure of absolute or relative frequency or according to summaries of some other variable. Some graphical and tabulation comm... Read More about Speaking Stata: Ordering or ranking groups of observations.
Stata tip 141: Adding marginal spike histograms to quantile and cumulative distribution plots (2021)
Journal Article
Cox, N. J. (2021). Stata tip 141: Adding marginal spike histograms to quantile and cumulative distribution plots. The Stata Journal, 21(3), 838-846. https://doi.org/10.1177/1536867x211045583
Speaking Stata: Front-and-back plots to ease spaghetti and paella problems (2021)
Journal Article
Cox, N. J. (2021). Speaking Stata: Front-and-back plots to ease spaghetti and paella problems. The Stata Journal, 21(2), 539-554. https://doi.org/10.1177/1536867x211025838The spaghetti problem arises in graphics when multiple time series or other functional traces show mostly a tangled mess. The related paella problem (often experienced but not usually named as such) arises for multiple patterns combined in scatterplo... Read More about Speaking Stata: Front-and-back plots to ease spaghetti and paella problems.
Stata tip 140: Shorter or fewer category labels with graph bar (2021)
Journal Article
Cox, N. J. (2021). Stata tip 140: Shorter or fewer category labels with graph bar. The Stata Journal, 21(1), 263 - 271. https://doi.org/10.1177/1536867x211000032
Stata tip 139: The by() option of graph can work better than graph combine (2020)
Journal Article
Cox, N. J. (2020). Stata tip 139: The by() option of graph can work better than graph combine. The Stata Journal, 20(4), 1016 - 1027. https://doi.org/10.1177/1536867x20976341
Speaking Stata: Loops, again and again (2020)
Journal Article
Cox, N. J. (2020). Speaking Stata: Loops, again and again. The Stata Journal, 20(4), https://doi.org/10.1177/1536867x20976340Two commands in official Stata, foreach and forvalues, provide structures for looping through lists of values (variable names, numbers, arbitrary text) and repeating commands using members of those lists in turn. These commands may be used interactiv... Read More about Speaking Stata: Loops, again and again.
Fan‐surface evidence for debris‐flow avulsion controls and probabilities, Saline Valley, California (2019)
Journal Article
Haas, T., Densmore, A., Hond, T., & Cox, N. (2019). Fan‐surface evidence for debris‐flow avulsion controls and probabilities, Saline Valley, California. Journal of Geophysical Research: Earth Surface, 124(5), 1118-1138. https://doi.org/10.1029/2018jf004815Debris‐flow fans form by shifts of the active channel, termed avulsions. Field and experimental evidence suggest that debris‐flow avulsions may be induced by depositional lobes that locally plug a channel or super‐elevation of the channel bed above t... Read More about Fan‐surface evidence for debris‐flow avulsion controls and probabilities, Saline Valley, California.