bent.cable: Fits a bent-cable model to the given data Fits a bent-cable...

View source: R/bent.cable.R

bent.cableR 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 γ.

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 α and γ.

Usage

bent.cable(x, y, grid.size = 100)

Arguments

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.

Details

Fit the model which is essentially a piecewise linear model with a quadratic curve of length 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 after alpha and gamma 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

piecewise.linear

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')


SiZer documentation built on July 10, 2022, 1:05 a.m.