Using Stata to Create Boxplots

preview_player
Показать описание
Boxplots use quantile information based on a continuous measure to visualize the distribution. Learn how to use Stata to create boxplots in this video.
Рекомендации по теме
Комментарии
Автор

Wonderful and concise presentation, I really enjoyed the amount of effort that went into helping the viewer follow along and this helped me with my term project. Thanks!

randomcommentteen
Автор

What is the best way to make a 5-variable box plot on a 5-year panel?

roseaniparente
Автор

Hi Alan, can you explain how to include the values of your box blot? That is, it would be nice to the the actual value for the median, Q1-Q4...

mar
Автор

how do I determine the order of the boxes in the box plot?

roseanipereiraparente
Автор

Great video there, thanks. How do I include a bar for the mean please?

georgewang
Автор

Hi Alan, could share the link for your codes and data set you used in your illustrations. thanks

AbdulahadSapai
Автор

/*
Using Stata to Create Boxplots - The middle part
*/


/* Basic boxplot examples */


graph box realrinc, name(box1, replace)
graph box realrinc, nooutsides name(box1, replace) // Box regions cover the middle 50%.


graph box realrinc, over(marital) name(box3, replace) // Graph box plots for each category in the marital status.
graph box realrinc, nooutsides over(marital) name(box3, replace)


/* Using multiple -over()- options */


graph hbox agewed, over(divorce) over(sex) name(box1, replace) nooutsides // hbox: horizontal box plot
graph hbox agewed, over(sex) over(divorce) name(box2, replace) nooutsides // Choose the graph that best fits your story.
graph hbox agewed, over(sex) over(divorce) name(box2, replace) nooutsides asy // as y bear. Take the first variable as an outcome variable.


/* Relabeling */
#delimit ;
graph hbox agewed, over(sex, relabel(1 "Men" 2 "Women")) // Put -relabel- within -over-.
over(divorce, relabel(1 "Divorced" 2 "Not divorced"))
nooutsides
name(box4, replace);
#delimit cr


/* Example of a polished graphic */
#delimit ;
graph hbox agewed, over(sex, relabel(1 "Men" 2 "Women"))
over(divorce, relabel(1 "Divorced" 2 "Not divorced") axis(noline))
nooutsides asy
title("Age When First Married by Gender and Ever Divorced", span)
ytitle("Age")
note("Source: General Social Survey, 2006")
ymtick(10(5)40)
legend(col(1) ring(0) position(1))
graphregion(color(white))
name(box4, replace);
#delimit cr

librarystudyntour