# Why do we use the class mark in calculating the mean in grouped data?

In finding the sample mean for grouped data, we use the following formula:

$$\bar X = \frac{\sum {fx}}{n}$$

where:

• $\bar X$ is the sample
• $f$ is the frequency of a class
• $x$ is the class mark
• $n$ is the total frequency

Why do we use the class mark for $x$ in grouped data, unlike in raw data where $x$ is the value of the data?

In an ideal world (for your purpose), the class mark is identical to the class’s mean, i.e., $$x_i = \frac{1}{f_i}\sum_{j=1}^{f_i} y_{ij} = \frac{\sum\limits_{j=1}^{f_i} y_{ij}}{\sum\limits_{j=1}^{f_i}1} ,$$ where $x_i$ is the class mark of class $i$, $f_i$ is the (absolute) frequency of class $i$, and $y_{ij}$ is the value of the $j$-th item of class $i$. In this case, we have (with $m$ being the number of classes):
$$\bar X = \frac{1}{n} \sum_{i=1}^m f_i x_i = \frac{1}{n} \sum_{i=1}^m f_i \frac{1}{f_i}\sum_{j=1}^{f_i} y_{ij} = \frac{1}{n} \sum_{i=1}^m \sum_{j=1}^{f_i} y_{ij} = \frac{\sum\limits_{i,j} y_{ij}}{\sum\limits_{i,j} 1} .$$