Learn R Programming

GeoLight (version 2.0.0)

changeLight: Residency analysis using a changepoint model

Description

Function to discriminate between periods of residency and movement based on consecutive sunrise and sunset data. The calculation is based on a changepoint model (R Package changepoint: cpt.mean) to find multiple changepoints within the data.

Usage

changeLight(tFirst, tSecond, type, twl, quantile = 0.9, rise.prob = NA, set.prob = NA, days = 5, plot = TRUE, summary = TRUE)

Arguments

tFirst
vector of sunrise/sunset times (e.g. 2008-12-01 08:30).
tSecond
vector of of sunrise/sunset times (e.g. 2008-12-01 17:30).
type
vector of either 1 or 2, defining tFirst as sunrise or sunset respectively.
twl
data.frame containing twilights and at least tFirst, tSecond and type (alternatively give each parameter separately).
quantile
probability threshold for stationary site selection. Higher values (above the defined quantile of all probabilities) will be considered as changes in the behavior. Argmuent will only be considered if either rise.prob and/or set.prob remain unspecified.
rise.prob
the probability threshold for sunrise: greater or equal values indicates changes in the behaviour of the individual.
set.prob
the probability threshold for sunset: higher and equal values indicates changes in the behaviour of the individual.
days
a threshold for the length of stationary period. Periods smaller than "days" will not be considered as a residency period
plot
logical, if TRUE a plot will be produced
summary
logical, if TRUE a summary of the results will be printed

Value

A list with probabilities for sunrise and sunset the user settings of the probabilities and the resulting stationary periods given as a vector, with the residency sites as positiv numbers in ascending order (0 indicate movement/migration).

Details

The cpt.mean from the R Package changepoint is a function to find a multiple changes in mean for data where no assumption is made on their distribution. The value returned is the result of finding the optimal location of up to Q changepoints (in this case as many as possible) using the cumulative sums test statistic.

References

Taylor, Wayne A. (2000) Change-Point Analysis: A Powerful New Tool For Detecting Changes.

M. Csorgo, L. Horvath (1997) Limit Theorems in Change-Point Analysis. Wiley.

Chen, J. and Gupta, A. K. (2000) Parametric statistical change point analysis. Birkhauser.

See Also

changepoint, cpt.mean

Examples

Run this code
data(hoopoe2)
  hoopoe2$tFirst <- as.POSIXct(hoopoe2$tFirst, tz = "GMT")
  hoopoe2$tSecond <- as.POSIXct(hoopoe2$tSecond, tz = "GMT")
residency <- changeLight(hoopoe2, quantile=0.9)

Run the code above in your browser using DataLab