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.

No comments: