filmov
tv
Introductory Stata 36: Graphs For Single Continuous Variable (Cumulative Density Plots)
![preview_player](https://i.ytimg.com/vi/Ccya0n5TdpY/sddefault.jpg)
Показать описание
In the previous video, we visualized the distribution of a single continuous variable using the "kdensity" command. In this video, we draw the cumulative density plots. It is also known as the cumulative density function (CDF).
Let's continue to use the dataset I created about the US workers. You can download it from the link below.
#cumul #CumulativeDensity #IntroductoryStata
******************************
*36. Cumulative Density Plots*
******************************
capture log close
set showbaselevels on
*use a dataset I created
describe
summarize
*cumulative density
cumul hwage, generate(chwage)
graph twoway (line chwage hwage, sort)
graph twoway (line chwage hwage, sort ytitle(Cumulative Density) ylabel(0(0.1)1,grid) xlabel(,grid))
*cumulative density with shaded area
graph twoway (line chwage hwage, sort recast(area) color(%30) ytitle(Cumulative Density) ylabel(0(0.1)1,grid) xlabel(,grid))
*multiple cumulative densities
generate hwage1=hwage if parent_married==1
generate hwage2=hwage if parent_married==0
cumul hwage1, generate(chwage1)
cumul hwage2, generate(chwage2)
stack chwage1 hwage1 chwage2 hwage2, into(c wage) wide clear
graph twoway (line chwage1 chwage2 wage, sort ytitle(Cumulative Density) ylabel(,grid) xlabel(,grid))
log close
Let's continue to use the dataset I created about the US workers. You can download it from the link below.
#cumul #CumulativeDensity #IntroductoryStata
******************************
*36. Cumulative Density Plots*
******************************
capture log close
set showbaselevels on
*use a dataset I created
describe
summarize
*cumulative density
cumul hwage, generate(chwage)
graph twoway (line chwage hwage, sort)
graph twoway (line chwage hwage, sort ytitle(Cumulative Density) ylabel(0(0.1)1,grid) xlabel(,grid))
*cumulative density with shaded area
graph twoway (line chwage hwage, sort recast(area) color(%30) ytitle(Cumulative Density) ylabel(0(0.1)1,grid) xlabel(,grid))
*multiple cumulative densities
generate hwage1=hwage if parent_married==1
generate hwage2=hwage if parent_married==0
cumul hwage1, generate(chwage1)
cumul hwage2, generate(chwage2)
stack chwage1 hwage1 chwage2 hwage2, into(c wage) wide clear
graph twoway (line chwage1 chwage2 wage, sort ytitle(Cumulative Density) ylabel(,grid) xlabel(,grid))
log close