# Binning Methods for Data Smoothing

Smoothing by bin means

Unsorted data for price in dollars

Before sorting: 8 16, 9, 15, 21, 21, 24, 30, 26, 27, 30, 34

First of all, sort the data

After Sorting: 8, 9, 15, 16, 21, 21, 24, 26, 27, 30, 30, 34

Smoothing the data by equal frequency bins

Bin 1: 8, 9, 15, 16

Bin 2: 21, 21, 24, 26,

Bin 3: 27, 30, 30, 34

Smoothing by bin means

For Bin 1:

(8+ 9 + 15 +16 / 4)  = 12

(4 indicating the  total values like 8, 9 , 15, 16)

Bin 1 = 12, 12, 12, 12

For Bin 2:

(21 +  21 + 24 + 26 / 4) =  23

Bin 2 = 23, 23, 23, 23

For Bin 3:

(27 + 30 + 30 +  34 / 4) = 30

Bin 3 =  30, 30, 30, 30

Smoothing by bin boundaries

How to smooth data by bin boundaries?

You need to pick the minimum and maximum value. Put the minimum on the left side and maximum on the right side.

Now, what will happen to the middle values?

Middle values in bin boundaries move to its closest neighbor value with less distance.
Unsorted data for price in dollars:

Before sorting: 8 16, 9, 15, 21, 21, 24, 30, 26, 27, 30, 34

First of all, sort the data

After sorting: 8, 9, 15, 16, 21, 21, 24, 26, 27, 30, 30, 34

Smoothing the data by equal frequency bins

Bin 1: 8, 9, 15, 16

Bin 2: 21, 21, 24, 26,

Bin 3: 27, 30, 30, 34

Smooth data after bin Boundary

Before bin Boundary:  Bin 1: 8, 9, 15, 16

Here, 1 is the minimum value and 16 is the maximum value.9 is near to 8, so 9 will be treated as 8. 15 is more near to 16 and farther away from 8. So, 15 will be treated as 16.

After  bin Boundary:  Bin 1: 8, 8, 16, 16

Before bin Boundary:  Bin 2: 21, 21, 24, 26,

After  bin Boundary:  Bin 2: 21, 21, 26, 26,

Before bin Boundary:  Bin 3: 27, 30, 30, 34

After  bin Boundary:  Bin 3: 27, 27, 27, 34

Example of binning for data smoothing

Sorted data for Age:   3, 7, 8, 13, 22, 22,  22,  26, 26, 28, 30, 37

Sorted Data