Hooooow do I find the medians of each group of data in a scatterplot in order to draw a regression line?
Step 1: Count the number of data points on the scatterplot (N)
Step 2 : Split the data into 3 groups (LOWER, MIDDLE, UPPER) according to their x-values, allowing for 3 scenarios
Scenario 1: If N is exactly divisible by 3, split the data into 3 equal groups
Scenario 2: if N/3 leaves a remainder of 1 (eg 13/3), add the extra point in the MIDDLE group (eg 4 5 4)
Scenario 3: if N/3 leaves a remainder of 2 (eg 14/3), add the extra points in the outer groups, ie LOWER and UPPER (eg 5 4 5)
Step 3: Draw vertical lines so that the 3 groups are clearly separated.
Step 4: Find the medians of the three groups (XL, YL), (XM, YM), (XU, YU) in the normal manner, ie if the group contains an odd number of points, the median is the value of the middle point of the group, and if the group contains an even number of points, the median is the average of the 2 middle values.
The process for finding the medians is:
For each geoup find the median of the x-value first. You will have no problem finding XL, XM, XU because the x-values are already in ascending order.
BUT, the y-values may require REORDERING before their median value is determined.