Description Usage Arguments Value See Also Examples
View source: R/funs_brokenstick.r
optBrokenstick
is similar to brokenstick
except that a
cost function can be used to determine the optimal number of points.
1 2  optBrokenstick(x, y = NULL, threshold, cost = max_dist_cost, npmin = 2,
npmax = Inf, start = NULL, na.action, ...)

x 
The x data. Note that the 
y 
The y data. 
threshold 
A threshold value for the cost function to be used instead of the minimum. If provided the search of a local minimum in the cost function is abandoned. 
cost 
The cost function to use. Some are included in the package such as

npmin 
Minimun number of points. 
npmax 
Maximum number of points. 
start 
Some starting points to start the algorithm with. 
na.action 
A function which indicates what should happen when the data
contain 
... 
Further arguments to be passed to 
Same as brokenstick
with the value of the cost function.
brokenstick
and predict.bsm
, residuals.bsm
,
update.bsm
, summary.bsm
,
coef.bsm
, plot.bsm
, as.data.frame.bsm
for other functions with a S3 method for bsm
objects.
1 2 3 4 5 6 7 8 9 10 11 12 13  data(exses)
dv < tdrply(identity, 1:2, no = 90, obj = exses)[[1]]
bsm_6p < brokenstick(dv, npts = 6)
plot(bsm_6p, data = TRUE)
bsm_30m < optBrokenstick(dv, threshold = 30, cost = max_dist_cost)
plot(bsm_30m, add = TRUE, col = 2, lty = 2, enumerate = TRUE,
col.pts = (bsm_30m$pts.no > 5) + 1)
bsm_5m < optBrokenstick(dv, threshold = 5, cost = max_dist_cost)
plot(bsm_5m, add = TRUE, col = 3, lty = 3, enumerate = TRUE,
col.pts = (bsm_5m$pts.no > max(bsm_30m$pts.no)) + (bsm_5m$pts.no > 5) + 1)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.