bent.cable | R Documentation |
Fits a bent-cable model to the given data 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 γ.
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
|
Fit the model which is essentially a piecewise linear model with a quadratic curve of length 2γ 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.
@return A list of 7 elements:
A matrix of log-likelihood values.
A matrix of sum-of-square-error values.
A vector of alpha values examined.
A vector of gamma values examined.
The MLE estimate of alpha.
The MLE estimate of gamma.
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.
piecewise.linear
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')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.