brokenstick: Fitting brokenstick models

Description Usage Arguments Details Value See Also Examples

Description

brokenstick is used to fit brokenstick models on two-dimensional data such as Time-Depth, Depth-Temperature or Depth-Light profiles. Brokenstick models are useful for compressing or extracting the shape of high resolution profiles.

Usage

1
2
brokenstick(x, y, npts = 6, start = NULL, na.action, allow.dup = FALSE,
  not.inj.action = c("ignore", "null", "error"), sort.data = FALSE, ...)

Arguments

x

The x data. Note that the x values have to be sorted. Can also be a list of x and y (processed by xy.coords). Alternatively, it can also be an object of class "formula".

y

The y data. (processed by xy.coords). Alternatively, if x is a 'formula', y can also be an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. If not found in data, the variables are taken from environment (formula), typically the environment from which brokenstick is called.

npts

The number of points for the brokenstick model to fit. See optBrokenstick for a version of brokenstick which figures out this number of points automatically.

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.

allow.dup

If TRUE the algorithm will not stop when duplicated breakpoints are found. The output will contain a slot called dup, a data.frame with the breakpoint number of the duplicates (dup.no) and the breakpoint number of the its clone among real breakpoints (pts.no)

not.inj.action

What should be done when f: y -> x is not injective.

sort.data

Should the data be sorted according to x values (when they are not) before fitting the broken-stick model.

...

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

Details

See bsmfit, the function called by brokenstick on each iteration to fit the model with specified points.

Value

A bsm object with (depending on eco.mem):

See Also

optBrokenstick 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
data(exses)
dv <- tdrply(identity, 1:2, no = 100, obj = exses)[[1]]

# Syntax
bsm <- brokenstick(dv$time, dv$depth)
bsm <- brokenstick(dv) # if two columns
bsm <- brokenstick(depth ~ time, dv) 
bsm <- with(dv, brokenstick(depth ~ time))

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