## 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:

The command for this is as follows:

**graph hbar A B, over(tag)**

The output of this command will look like a following graph:

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:

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:

**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...