bent.cable {SiZer} | 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 \alpha
and \gamma
.
Description
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 \alpha
and \gamma
.
Usage
bent.cable(x, y, grid.size = 100)
Arguments
x |
The independent variable |
y |
The dependent variable |
grid.size |
How many |
Details
Fit the model which is essentially a piecewise linear model with a
quadratic curve of length 2\gamma
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:
- 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 afteralpha
andgamma
are known.
Author(s)
Derek Sonderegger
References
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.
See Also
Examples
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')