I have two linear fits that I’ve gotten from lm calls in my R script. For instance…
fit1 <- lm(y1 ~ x1)
fit2 <- lm(y2 ~ x2)
I’d like to find the (x,y) point at which these two lines (fit1 and fit2) intersect, if they intersect at all.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
One way to avoid the geometry is to re-parameterize the equations as:
in terms of their intersection point
(x0, y0)and then perform the fit of both at once usingnlsso that the returned values ofx0andy0give the result:EDIT: Note that the lines
xx<-...andyy<-...are new and thenlsline has been specified in terms of those and corrected.