[R] segmented regression
Huntsinger, Reid
reid_huntsinger at merck.com
Tue Feb 25 18:27:21 CET 2003
This can be done by hand, for example by using linear regression to
find the minimum residual sum-of-squares for fixed x(0), then using
an optimizer (for non-differentiable objective fns) to minimize over x(0).
You may want to have a look at polymars in the polspline package. It will
fit linear splines in multiple variables, with multiple knots (your x(0)).
Reid Huntsinger
-----Original Message-----
From: Kurt Sys [mailto:kurt.sys at rug.ac.be]
Sent: Tuesday, February 25, 2003 12:01 PM
To: r-help at stat.math.ethz.ch
Subject: [R] segmented regression
Hello all,
I'm trying to find out how to perform a 'segmented regression'. I have some
data and the 'classical' model used is:
y(t) = a + bx(t) + cx(t)^2 + u(t) for x(t) < x(0)
y(t) = a + bx(0) + cx(0)^2 + d(x(t) - x(0)) + u(t) for x(t) > x(0)
and u(t) = rho.u(t-1) + eps
(It's a model using an ARIMA-model, in this case AR(1)-process)
The parameters to estimate here are: a, b, c, d and x(0) (with the last one,
the most important one). u(t) is estimated using the rho of the AR(1).
How can I use such a 'segmented formula' or 'segmented model' in R or how do
I perform such a regression (nonlinear or restricted maximum likelihood)?
thanks in advance,
Kurt
______________________________________________
R-help at stat.math.ethz.ch mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help
------------------------------------------------------------------------------
More information about the R-help
mailing list