[R] piecewise linear regression

Thomas Lumley tlumley at u.washington.edu
Sat Nov 10 22:54:58 CET 2001

On Sat, 10 Nov 2001, Jonathan Baron wrote:

> We sent questionnaires to lots of folks.  The questionnaires
> differed in word count (wc).  For each questionnaire, I know wc
> and whether the questionnaire was returned or not (status).  It
> looks like there is a fixed rate of return when wc is below a
> break point, and the rate of return falls off linearly after
> that.
> I want to do a piecewise linear regression with two pieces
> meeting at a common breakpoint.  I think it is important that I
> don't specify the breakpoint in advance (although, if I get
> desperate, I'll do that).

One simple approach is a grid search for the best breakpoint. Since the
model with specified breakpoint is linear it's very easy and quick to
try a fairly fine grid of possible breakpoints.

The problem with more sophisticated approaches is that if the two slopes
are equal or the breakpoint is at either end of the data the problem is
not identifiable, so bad luck or bad data can make a Newton-type search
break down.


r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list