[R] Piecewise

Joe Waddell joecwaddell at gmail.com
Wed Mar 25 21:08:49 CET 2009

I am a biologist (relatively new to R) analyzing data which we predict 
to fit a power function.  I was wondering if anyone knew a way to model 
piecewise functions in R, where across a range of values (0-x) the data 
is modeled as a power function, and across another range (x-inf) it is a 
linear function.  This would be predicted by one of our hypotheses, and 
we would like to find the AICs and weights for a piecewise function as 
described, compared with a power function across the entire range.

I have looked into the polySpline function, however it appears to use 
only polynomials, instead of the nls models I have been using.  Thanks 
in advance for any help you might be able to offer.

-Joe Waddell

More information about the R-help mailing list