labelBouts,numeric-method {diveMove} | R Documentation |
Label each vector element or matrix row with bout membership number
Description
Identify which bout an observation belongs to.
Usage
## S4 method for signature 'numeric'
labelBouts(obj, becs, bec.method = c("standard", "seq.diff"))
## S4 method for signature 'Bouts'
labelBouts(obj, becs, bec.method = c("standard", "seq.diff"))
Arguments
obj |
Object of class |
becs |
numeric vector or matrix with values for the bout ending
criterion which should be compared against the values in x for
identifying the bouts. It needs to have the same dimensions as
|
bec.method |
character: method used for calculating the frequencies: “standard” simply uses x, while “seq.diff” uses the sequential differences method. |
Value
labelBouts
returns a numeric vector sequentially
labelling each row or element of x, which associates it with
a particular bout. unLogit
and logit
return a numeric
vector with the (un)transformed arguments.
Methods (by class)
-
numeric
: Label data on vector or matrix objects. -
Bouts
: Label data onBouts
object
Examples
## Run example to retrieve random samples for two- and three-process
## Poisson mixtures with known parameters as 'Bouts' objects
## ('xbouts2', and 'xbouts3'), as well as starting values from
## broken-stick model ('startval2' and 'startval3')
utils::example("boutinit", package="diveMove", ask=FALSE)
## 2-process
opts0 <- list(method="L-BFGS-B", lower=c(-2, -5, -10))
opts1 <- list(method="L-BFGS-B", lower=c(1e-1, 1e-3, 1e-6))
bouts2.fit <- fitMLEbouts(xbouts2, start=startval2, optim_opts0=opts0,
optim_opts1=opts1)
bec2 <- bec(bouts2.fit)
## labelBouts() expects its second argument to have the same
## dimensions as the data
labelBouts(xbouts2, becs=rep(bec2, length(xbouts2@x)))