Truncate Regression Lines when Standard Error is Exceeded

I am developing a Shiny application that has a knobs and sliders to adjust ranges for selected data.

The output is to be a scatter plot with something resembling a quantile plot. So its pretty wide open, however its pretty difficult to handle each scenario that a user might tweak. It could easily produce spurious fittings with outliers and all. gg_quantile and or geom_smooth are very nice functions, however it is known that outside of certain ranges the quantile lines converge for example.

Is there any way to truncate the lines when the standard error drops, so that it doesn't look like I am trying to fit a regression with a single outlier point? I can truncate the data, but that just makes the next point an outlier. You can see the standard error is enormous, why draw the line there?

I don't think a reprex is necessary here.

You could use this to zoom into an area:
Cartesian coordinates — coord_cartesian • ggplot2 (tidyverse.org)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.