Using the function bent.cable in the SiZer package in R, one can fit a "bent cable model" in R.
Here is an example of how I used it and the plot it made.
model.bc.mean=bent.cable(flow.new.sum.dat$l2Flow,flow.new.sum.dat$TCTmean,grid.size =200) x.grid <- seq(min(flow.new.sum.dat$TCTmean), max(flow.new.sum.dat$TCTmean), length=77)
x.grid looks like 0.00100 , 0.2485, 0.4961,...., 18.56, 18.816
plot(flow.new.sum.dat$l2Flow,flow.new.sum.dat$TCTmean) lines(x.grid, predict(model.bc.mean, x.grid), col='red')
The question I have now is how to derive confidence bounds for this model. Using the standard predict function does not work, nor does using predict.nls. Basically I want to derive confidence intervals for the above regression line. Any ideas/packages/suggestions? Thanks