I'm trying to take the money earned over several days - each with unique hours worked and dollars earned per hour (hrs and $/hr). What I've done is multiply each days' # of hours by its rate to get the money earned for each day. From there, I totaled the money earned, and found the percentage for the money earned each day over the total.
With this information, I'm trying to find out how I can find the average rate of pay, weighting the different days based on their rates and hours.
I tried finding the weight for each day by multiplying each days rate by its percentage earned of the total money. With these values I added them up, and then divided by the total amount of days. This seems wildly off. I then tried to simply add up the weighted values. This gets the correct value (total money/total hours), but only when all of the rates are the same. How can I set up an equation to find the weights of each and use these weights to find the average rate of pay?
I've got this setup in excel, so if I need to paste in the relevant parts of the document I can.
Let's say there are $n$ days, for which $h_i$ is the number of hours worked and $r_i$ is the number of dollars per hour for that day for $i \in \Bbb{N}$. $h_i$ is the weight on each day because days with more hours affect the average rate of pay more. Therefore, to find the weighted sum, we simply need to sum up all of the $r_i$s with a weight of $h_i$, which can be expressed as: $$\sum_{i=1}^n r_ih_i$$ Then, to find the weighted average, we need to divide this weighted sum by the total number of hours. The total number of hours is the sum of all $h_i$, or: $$\sum_{i=1}^n h_i$$ Thus, we just need to divide the first part by the second part: $$\frac{\sum_{i=1}^n r_ih_i}{\sum_{i=1}^n h_i}$$ Notice that this is exactly the same as total money divided by total hours. However, we are just looking at this process differently by looking at the $r_i$s as our objects and the $h_i$s as our weights.