Monday, May 14, 2012

Finding intersection of two regression lines using R


Suppose m1 and m2 are 2 regression models created using lm() in R, then try
cm <- rbind(coef(m1),coef(m2)) # Coefficient matrix
c(-solve(cbind(cm[,2],-1)) %*% cm[,1])
which would give you the point of intersection.

1 comment:

Unknown said...

What about the error in this intersection point?