Learn R Programming

diveMove (version 1.6.2)

fitNLSbouts,data.frame-method: Fit mixture of Poisson Processes to Log Frequency data via Non-linear Least Squares regression

Description

Methods for modelling a mixture of 2 or 3 random Poisson processes to histogram-like data of log frequency vs interval mid points. This follows Sibly et al. (1990) method.

Usage

# S4 method for data.frame
fitNLSbouts(obj, start, maxiter, ...)

# S4 method for Bouts fitNLSbouts(obj, start, maxiter, ...)

Value

nls object resulting from fitting this model to data.

Arguments

obj

Object of class Bouts, or data.frame with named components lnfreq (log frequencies) and corresponding x (mid points of histogram bins).

start, maxiter

Arguments passed to nls.

...

Optional arguments passed to nls.

Methods (by class)

  • data.frame: Fit NLS model on data.frame

  • Bouts: Fit NLS model on Bouts object

Author

Sebastian P. Luque spluque@gmail.com

References

Sibly, R.; Nott, H. and Fletcher, D. (1990) Splitting behaviour into bouts Animal Behaviour 39, 63-69.

See Also

fitMLEbouts for a better approach; boutfreqs; boutinit

Examples

Run this code
## 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
bout2.fit <- fitNLSbouts(xbouts2, start=startval2, maxiter=500)
summary(bout2.fit)
bec(bout2.fit)

## 3-process
## The problem requires using bound constraints, which is available
## via the 'port' algorithm
l_bnds <- c(100, 1e-3, 100, 1e-3, 100, 1e-6)
u_bnds <- c(5e4, 1, 5e4, 1, 5e4, 1)
bout3.fit <- fitNLSbouts(xbouts3, start=startval3, maxiter=500,
                         lower=l_bnds, upper=u_bnds, algorithm="port")
plotBouts(bout3.fit, xbouts3)

Run the code above in your browser using DataLab