I have the following data, which produced the following plot.
Predictor_Variable <- c(rnorm(1000, 0, 25), rnorm(1000, 20, 2), rnorm(100, 20, 10))
Response_Variable <- c(rnorm(1000, 0, 2), rnorm(1000, 0, 25), rnorm(100, 0, 10))
Data_Frame <- data.frame(Predictor_Variable = Predictor_Variable, Response_Variable = Response_Variable)
plot(Response_Variable ~ Predictor_Variable, Data_Frame, main = 'Example Plot', xlab = 'Predictor Variable', ylab = 'Response Variable')
I need to fit a vertical line to the points on the plot that extend vertically up and down from the horizontal axis. This vertical portion is not perfectly centered, so I can't simply take the average of the values.
Is there a nice, programmatic way of finding this vertical line?
