# Calculating Average Waiting Time

I am trying to calculate average wait time for one of the projects that I am working on. The way the project works is that there are pathways that students follow and each pathway has several steps. At each step students get a challenge, or challenge sets or they earn a badge. Students can earn multiple badges (at different steps) within the same pathway.

My task is to calculate the average time the students have to wait in a pathway to earn a badge, and to find out whether it has some effect on the success of the pathway or not.

Below is the example that will help understand my question.

PathwayID    TotalSteps    BadgeEarned@Step
1            4                2
4
2            7                3
5
7
3            5                2
4
4            9                4
6
8


They way I am calculating the average wait time right now, is by dividing the average of BadgeEarned@Step by total number of steps in that pathway. So according to these calculations, Average Wait time for the pathways will be below.

PathwayID    AvgWaitTime
1            0.75
2            0.71
3            0.60
4            0.67


Wait Time for Pathway 4 appears to be smaller than wait time for Pathway 1, which is not actually the case, as in pathway 4, students have to wait longer until they even earn their first badge. Right now the way I am calculating the average wait time, there is some bias toward the pathways with more number of steps. I will appreciate if someone can give me an idea to calculate average wait time, that is not biased by the length of the pathway.

First, you have to decide what units of time are you going to use. Is each step the same amount of time? So an 8-step project takes twice as long as a 4-step project? Or the pathways take the same amount of time regardless of the number of steps. For now, let's assume that you are counting steps as time.

I assume a student cannot earn a badge in step 4 before earning a badge in step 2. So the average time (in terms of the number of steps) to earn the first badge is just the time of the first badge.

Now if you want to take into account multiple badges, than you could consider the average time (steps) between badges. So you would average the time to the first badge, the time to the second badge after the first badge, etc.

PathwayID    TotalSteps    BadgeEarned@Step TimeSinceLastBadge
1            4                2               2
4               2
2            7                3               3
5               2
7               2
3            5                2               2
4               2
4            9                4               4
6               2
8               2


The averages would be:

PathwayID    AvgWaitTime AvgTimeBetween
1            0.75          2
2            0.71          2.33
3            0.60          2
4            0.67          2.67


If you count completion as a "badge" (success), then you could add another row at the end of each pathway to incorporate any long badgeless periods at the end of the pathway.

• Thanks so much for your response @Aniko. I was thinking of a similar solution (i.e. calculate AvgTimeBetween), but could not figure out how to incorporate the badgeless periods. In this situation Pathway 5 and 4 will have a badgeless period of 1. Do you suggest I should add that 1 to the AvgTimeBetween to calculate the AvgWaitingTime? Thanks. – nasia jaffri Aug 28 '14 at 14:53
• Yes, I think that would be a good idea. – Aniko Aug 28 '14 at 16:54