say I have the following code using basic plot function.
plot(mydata$x1,mydata$y,xlab="x1",ylab="y",type="n")
abline(lm(y~x1,data=mydata))`
abline(lm(y~x2,data=mydata),lty=2)'
This will show two regression lines in a single graph, one is y=p*x1, one is y=p*x2 (p are parameters)
since I am using different x for the same y, how can I show the two regression lines together using ggplot2? I tried to define two geom_smooth. But the results are not correct.
geom_smooth(aes(y=y,x=x1))+gemo_smooth(aes(y=y,x=x2))