I understand geom_smooth() allows you to incorporate model (such as a linear regression) directly onto plot.
But how do we go about doing this with more advanced models (kNN regression, elastic net, etc.)
Do I incorporate tidy() with the fit and then somehow add it as an extra layer on the scatterplot via geom_line() ?
At the moment, I can see how to do EITHER the scatter plot or the model fit (as far as very simple techniques), but not both at the same time.
As a long workaround, I can generate predicted y's, and put them in the data set, and THEN plot the model line onto the scatter plot through an aes(x = x, y = y_predicted) in the geom_line().
Is there a more elegant way of doing this?