plot_confidently
allows users to visualize the mean and confidence interval of a specified variable, with options for up to two levels of disaggregation. This command has been jointly developed with Kabira Namit.
plot_confidently varlist [IF] [IN], [over(varname)] [by(varname)] [graphopts()] [scale]]
over(varname)
: This specifies the first of up to two grouping variables. varname must be a labelled factor variable.by(varname)
: This specifies the second grouping variable. varname must be a labelled factor variable.graphopts(string)
: Allows the user to pass any Stata graph options into the program. For example, a custom title, subtitle and/or note (or make changes to the axis labels, ticks and so on). Must be specified as a string enclosed in quotation marks. See examples below.scale
: Allows the user to scale the Y-Axis to the percentage scale. Useful for visualizing percentages, proportions and rates.
ssc install plot_confidently, replace
sysuse auto.dta, clear
label define quality 1 "Poor" 2 "Fair" 3 "Average" 4 "Good" 5 "Excellent"
lab val rep78 quality
gen pct_score = runiform()*100
lab var pct_score "Percentage Score"`
plot_confidently price
plot_confidently price, over(rep78)
plot_confidently price, over(rep78) by(foreign)
plot_confidently pct_score, scale
plot_confidently price, over(rep78) by(foreign) graphopts(msymbol(S) xtitle("My X-Axis"))
plot_confidently price if foreign == 0, over(rep78)
We would like to thank Ben Jann, who developed coefplot, which our command builds on. We are grateful to Prabhmeet Kaur for creating an early iteration of the program, which was the inspiration for plot_confidently. We would also like to thank Professor Iram Siraj and Sakshi Hallan for feedback and support in the development stages of plot_confidently. All errors are our own.
Zaeen de Souza, Frontline Impact
[email protected]
Kabira Namit, World Bank
[email protected]