How to fit two separate curves through points?

You can group the points by eye in this case:

ggplot(DF, aes(x = X, y = Y, 
               colour=ifelse((Y >= 33.5 & X < 15000) | Y > 33.5 , "high", "low"))) +
  geom_point(alpha = 0.6) +
  geom_smooth(method = "lm") +
  scale_x_continuous(labels = scales::comma) +
  labs(colour="")

Rplot06

4 Likes