[R] Interception point between two lines

Uwe Ligges ligges at statistik.tu-dortmund.de
Tue Jan 5 14:45:55 CET 2010



On 05.01.2010 14:37, FMH wrote:
> Dear All,
>
> Let mod2 and mod3 are two regression equations representing two distinct lines and i'm keen to find the intreception point between these two lines and the following are part of the codes.
>
>
>           m1<- as.matrix(rbind(coef(mod2), coef(mod3)))
>           a<- cbind(c(1,1), -m1[, 2])
>           b<- m1[,1]
>           c<- solve(a=a,b=b)
>
>   Unfortunately, there is an error message given as stated below and i don't understand what it meants for.
>
>
> ' Error in drop(.Call("La_dgesv", a, as.matrix(b), tol, PACKAGE = "base")) :
> system is computationally singular: reciprocal condition number = 1.14557e-16'
>
>
> Could anybody advice me on this matter?

Yes, you cannot compute the intersection if it is (numerically) non 
existant, i.e. coef(mod2), coef(mod3) are almost linear dependent and 
the regression lines are almost parallel.


Uwe Ligges




> Thank you
> Fir
>
>
>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list