I am working with a dataset containing the average grades for the oral and written exams respectively for a number of subjects. The dataset also contains the number of students on the basis of which the average has been calculated.
For each subject I have calculated the weighted average of the average of the grades from oral and the written exams. I have calculated the weighted average as follows:
$$\frac{A}{C} \cdot X + \frac{B}{C}\cdot Y =W $$
where A and B are the number of students who took the oral and written exam respectively. C is the total number of students. X and Y are the average grade for the oral and written exam respectively. W is the weighted average.
However, I also need to calculate the average of the weighted averages across time, and this is where the problem arises. I am assuming that the average of the weighted average should also be weighted, and my best guess on how to calculate this is derived from the formula above and goes as follows:
$$\frac{C_{year1}}{C_{year1}+C_{year2}+C_{year3}} \cdot W_{year1} + \frac{C_{year2}}{C_{year1}+C_{year2}+C_{year3}}\cdot W_{year2}+ \frac{C_{year3}}{C_{year1}+C_{year2}+C_{year3}}\cdot W_{year3} $$
where C is the total number of students each year. W is the weighted average for each year.
Could anyone tell me whether or not that calculation is correct? And if it is not, how can I calculate the weighted average of a weighted average?