bent.cable {SiZer} | R Documentation |
Fits a bent-cable model to the given data by exhaustively searching the 2-dimensional parameter space to find the maximum likelihood estimators for α and gamma.
bent.cable(x, y, grid.size=100)
x |
The independent variable |
y |
The dependent variable |
grid.size |
How many α and gamma values to examine. The total number of
parameter combinations examined is grid.size squared. |
Fit the model which is essentially a piecewise linear model with a quadratic curve of length 2gamma connecting the two linear pieces.
The reason for searching the space exhaustively is because the bent-cable model often has a likelihood surface with a very flat ridge instead of definite peak. While the exhaustive search is slow, at least it is possible to examine the contour plot of the likelihood surface.
A list of 7 elements:
log.likelihood |
A matrix of log-likelihood values. |
SSE |
A matrix of sum-of-square-error values. |
alphas |
A vector of alpha values examined. |
gammas |
A vector of gamma values examined. |
alpha |
The MLE estimate of alpha. |
gamma |
The MLE estimate of gamma. |
model |
The lm fit after alpha and gamma are known. |
Derek Sonderegger
Chiu, G. S., R. Lockhart, and R. Routledge. 2006. Bent-cable regression theory and applications. Journal of the American Statistical Association 101:542-553.
Toms, J. D., and M. L. Lesperance. 2003. Piecewise regression: a tool for identifying ecological thresholds. Ecology 84:2034-2041.
data(Arkansas) x <- Arkansas$year y <- Arkansas$sqrt.mayflies # For a more accurate estimate, increase grid.size model <- bent.cable(x,y, grid.size=20) plot(x,y) x.grid <- seq(min(x), max(x), length=200) lines(x.grid, predict(model, x.grid), col='red')