Statistical calculations in graphs
The command for statistical calculations in graphs is as follows:
Graph bar A B, over (Tag)
The result of this command will look like a following graph:
![](https://static.packt-cdn.com/products/9781782173175/graphics/B00646_03_23.jpg)
The command for this is as follows:
graph hbar A B, over(tag)
The output of this command will look like a following graph:
![](https://static.packt-cdn.com/products/9781782173175/graphics/B00646_03_24.jpg)
You can also perform median-related calculations and plot the medians accordingly. Here is the code to achieve this:
graph hbar (median) A B, over(Tag)
The following is the output you get after performing median calculations:
![](https://static.packt-cdn.com/products/9781782173175/graphics/B00646_03_25.jpg)
We can perform and create the independent kernel density plot by leveraging the kdensity
code:
kdensity A
The output of this command will look like the following graph:
![](https://static.packt-cdn.com/products/9781782173175/graphics/B00646_03_26.jpg)
Kernel density estimation, which is also known as KDE, is a nonparametric tool that's used to plot the graphs of a selected variable. This is also part of a data-smoothing exercise and is heavily used in economics, signal processing, and the consumer packaged goods (CPG) industry in order to find various...