optBrokenstick: Fitting automatic brokenstick models

Description Usage Arguments Value See Also Examples

Description

optBrokenstick is similar to brokenstick except that a cost function can be used to determine the optimal number of points.

Usage

1
2
optBrokenstick(x, y = NULL, threshold, cost = max_dist_cost, npmin = 2,
  npmax = Inf, start = NULL, na.action, ...)

Arguments

x

The x data. Note that the x values have to be sorted. Can also be a list of x and y data as returned by xy.coords.

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 max_dist_cost, dist_per_pt_cost, rss_cost, dzi_cost etc. Feel free to use a custom one.

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 NAs. The default is set by the na.action setting of options, and is na.fail if that is unset. The "factory-fresh" default is na.omit. Another possible value is NULL, no action. Value na.exclude can be useful.

...

Further arguments to be passed to bsmfit such as eco.mem.

Value

Same as brokenstick with the value of the cost function.

See Also

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.

Examples

 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)

SESman/rbl documentation built on May 9, 2019, 11:10 a.m.