In a plot(x,y) is there any way to plot a line/curve/function that would split **at every x (see DWins comment) ** the observations in 2 halfs? So that **at arround every x (see DWins comment) ** the same number of observations are above and below this line/curve/function? Is there any way to get the (x,y) coordinates or the function of this line/curve/function?
As regressing the data is problematic due to outliers/non-normality etc etc, i though a programming method might provide a viable solution without resorting to complicated regression methods.
Thanks a lot
First generate some test data:
Now assuming the data is sorted by
xcalculate the median at eachxand plot: