boutinit: Fit "broken stick" model to log frequency data for...

boutinit,data.frame-methodR Documentation

Fit "broken stick" model to log frequency data for identification of bouts of behaviour

Description

Fits "broken stick" model to the log frequencies modelled as a function of x (well, the midpoints of the binned data), using chosen value(s) to separate the two or three processes.

Usage

## S4 method for signature 'data.frame'
boutinit(obj, x.break, plot = TRUE, ...)

## S4 method for signature 'Bouts'
boutinit(obj, x.break, plot = TRUE, ...)

Arguments

obj

Object of class Bouts or data.frame.

x.break

Numeric vector of length 1 or 2 with x value(s) defining the break(s) point(s) for broken stick model, such that x < x.break[1] is 1st process, and x >= x.break[1] & x < x.break[2] is 2nd one, and x >= x.break[2] is 3rd one.

plot

logical, whether to plot results or not.

...

arguments passed to plot (must exclude type).

Value

(2,N) matrix with as many columns as the number of processes implied by x.break (i.e. length(x.break) + 1). Rows are named a and lambda, corresponding to starting values derived from broken stick model. A plot is produced as a side effect if argument plot is TRUE.

Methods (by class)

  • data.frame: Fit "broken-stick" model on data.frame object

  • Bouts: Fit "broken-stick" model on Bouts object

Author(s)

Sebastian P. Luque spluque@gmail.com

Examples

## 2-process
utils::example("rmixexp", package="diveMove", ask=FALSE)
## 'rndproc2' is a random sample vector from the example
xbouts2 <- boutfreqs(rndprocs2, 5)  # Bouts class result
(startval2 <- boutinit(xbouts2, 80))

## 3-process
## 'rndproc3' is a random sample vector from the example
xbouts3 <- boutfreqs(rndprocs3, 5)
(startval3 <- boutinit(xbouts3, c(75, 220)))

diveMove documentation built on Nov. 10, 2022, 5:11 p.m.