[R] piece wise functions
Thomas W Blackwell
tblackw at umich.edu
Mon Apr 21 16:23:55 CEST 2003
A practical approach would be to use gam() and its friends
in package mgcv. This implements Generalized Additive Models
(Hastie & Tibshirani, 1990). The fit will be smoother than
you would get with an explicit piece-wise linear regression,
but it's already implemented.
If you really care about estimating the boundaries between
distinct regions of the fit, that's a research question, in
my humble opinion, and you are cast onto the stormy sea of
statistical literature for that. That's a difficult problem.
Start with gam() and eyeball the boundaries ?
Others will have better ideas. Maybe packages "GRASS",
"grasper" or "geoR" have something to offer ?
- tom blackwell - u michigan medical school - ann arbor -
On Mon, 21 Apr 2003, Casiano Rodriguez Leon wrote:
> I have a multidimensional piece-wise regression linear problem, i.e.
> to find not only the regression coefficients for each "interval" but
> also the beginning and ends of the intervals.
> To simplify it to the one dimensional case and
> two intervals, the problem is to find A_0, A_1, ... A_p and "C"
> from the given sample, assuming the curve is like this:
> A_0*f_0(x)+A_1*f_1(x)+ ... + A_p*f_p(x) with x < C
> A_0'*f_0(x)+A_1'*f_1(x)+ ... + A_p'*f_p(x) with x >= C
> Functions f_1, f_2, ... f_p are known.
> Is there anything in R for that?
> I have tried to use nonlinear (nls package) regression, "forcing" with
> the "nls" function the shape of the surface, but it does not work.
> By the way, the cofficients A_i have to be positive, but I suppose this is
> another question.
> casiano at ull.es
More information about the R-help