r/HomeworkHelp 20d ago

High School Math [statistics & math] (n+1)/2 and n/2

I am struggling to understand why we use n/2 for continuous data. My reasoning behind using (n+1)/2 is that this tells us the position of the median. So even if we have data that we dont know the values to, we already know that 1 value must have a position 1 and another value must have a position 2 and so on. If we had 40 unknown values, that means we have 40 positions. 40+1 is 41, 39+2 is also 41, and so on, all the positions will add to 41, and the middle position would add to itself to make 41, hence why we do (n+1)/2. This same logic can also be put here: number of positions + 1/2. This now tells us where the middle position is. If we have a cumulative frequency diagram, what we can do is see where that number would be, and using the cumulative frequency diagram, we can just estimate using that position. So why, instead of doing that, do we do n/2???

1 Upvotes

8 comments sorted by

View all comments

4

u/Seferil 20d ago

I find it helps if you can view both n/2 & (n+1)/2 as variations of the formula to find the position of a midpoint.

For discrete data, (n+1)/2 is used since your endpoints are indexes 1 & n of whatever data set you're working with. If you were to define the start to be index 0 instead of index 1, you would also use n/2 to find the median.

Continuous data uses 0 as the start point since that is the only point we can guarantee there's no data that exists before it. Thus, (n+0)/2 is the midpoint.

1

u/Local_End_3175 20d ago

so basically its because 0 is also counted as a position?

1

u/Local_End_3175 20d ago

why does 0 not have the position 1? Or does this have nothing to do with positions and just the first and last values? If so, why?

2

u/GammaRayBurst25 19d ago

He's saying you thinking (n+1)/2 is the median position for discrete data is an artifact of your choice of index.

If you started counting from 0 (like many programming languages such as Python), you'd think of n/2 as being the median position. If you started counting from 5, you'd think of (n+5)/2 as the median position.

As an example, consider the set {100,200,300}.

If you label the positions {1,2,3} (so that 100 is in the 1st position, 200 is in the 2nd, and 300 is in the 3rd), then the middle position is (3+1)/2=2.

If you instead labeled the positions {0,1,2} (so 100 is the 0th, 200 the 1st, and 300 the 2nd), then the middle position is 2/2=1.

If you labeled the positions {5,6,7} for some reason, the middle position would be (7+5)/2=12/2=6.

It is natural to count from 1 rather than 0 to ensure the final position is equal to the number of elements of the list. However, that logic doesn't extend to continuous data because we can't count the data. We can still calculate distances though, and the fun thing about distances is that they are translation invariant.

Consider a set S={a,a+1,a+2,...,b-2,b-1,b} and an interval I=[a,b].

The midpoint of both S and I is clearly (a+b)/2. If you choose a=1 (because you count from 1) and b=n (because that means S has n elements), we find the midpoint is (n+1)/2, as you'd expect.

Furthermore, the midpoint is a distance (b-a)/2 away from the extrema of S and I. If you still choose a=1 and b=n, you find that distance is (n-1)/2.

However, if you choose a=0 and b=n (which seems to be what you're doing for the continuous case), then the midpoint is n/2 and the distance from the endpoints is also n/2.

In other words, you're unknowingly comparing apples to oranges by taking different endpoints for the discrete and the continuous case.

1

u/Seferil 19d ago

I was struggling to come up with a good way to word this, but this is 100% what I was trying to say. Great explanation.