[R] How to find the interception point of two linear fitted model in R?

FMH kagba2006 at yahoo.com
Wed Oct 21 19:09:57 CEST 2009


Dear All,

Let have 10 pair of observations, as shown below.

######################
x <- 1:10
y <- c(1,3,2,4,5,10,13,15,19,22)
plot(x,y)
######################


Two fitted  models, with ranges of [1,5] and [5,10], can be easily fitted separately by lm function as shown below:

#######################
mod1 <- lm(y[1:5] ~ x[1:5])
mod2 <- lm(y[5:10] ~ x[5:10])
#######################

I'm looking for the interception points between these two straight lines from these fitted models, mod1 and mod2. 

Could someone advice me the way to do it?

Thank you
Fir 







More information about the R-help mailing list