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?
 A: 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}
.$$
So, the sample mean for grouped data is identical to the sample mean for the raw data.
Now, if you are using grouped data, you are probably not living in an ideal world anyway, e.g., you do not have access to the raw data or the raw data is so huge that using it would be computationally too expensive.
Hence you have to use what you have, i.e., the class mark.
If this was chosen well, it is a good approximation the class’s mean; if you are lucky, the two are identical.
