changeLight: Residency analysis using a changepoint model

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/GeoLight.R

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

1
2
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

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.

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).

Note

The sunrise and/or sunset times shown in the graph (if plot=TRUE) represent hours of the day. However if one or both of the twilight events cross midnight during the recording period the values will be formed to avoid discontinuity.

Author(s)

Simeon Lisovski & Tamara Emmenegger

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

1
2
3
4
data(hoopoe2)
  hoopoe2$tFirst <- as.POSIXct(hoopoe2$tFirst, tz = "GMT")
  hoopoe2$tSecond <- as.POSIXct(hoopoe2$tSecond, tz = "GMT")
residency <- changeLight(hoopoe2, quantile=0.9)

Example output

Loading required package: maps

Probability threshold(s):
 
	Sunrise:  0.02133	Sunset:  0.01307
 
 
Migration schedule table:
 
  Site             Arrival           Departure Days     P.start        P.end
1    a 2008-07-15 23:34:00 2008-07-24 23:32:30  9.0 0.000000000 0.0000000000
2    b 2008-07-31 00:15:00 2008-08-19 12:26:00 19.5 0.010500257 0.0000000000
3    c 2008-08-25 00:25:30 2008-09-01 12:20:00  7.5 0.005555556 0.0069958848
4    d 2008-09-12 12:27:30 2008-10-02 12:28:00 20.0 0.000000000 0.0009259259
5    e 2008-10-03 12:22:30 2008-10-19 12:26:00 16.0 0.004629630 0.0010204082
6    f 2008-10-20 12:22:00 2008-11-15 00:13:30 25.5 0.003776042 0.0055555556
7    g 2008-11-16 00:21:30 2008-12-03 12:35:30 17.5 0.005555556 0.0061983471
8    h 2008-12-09 00:31:30 2008-12-18 12:32:00  9.5 0.000000000 0.0107060185
9    i 2008-12-19 12:41:00                <NA>   NA 0.000000000 0.0000000000
  Days.1   P.start.1
1    9.0 0.000000000
2   19.5 0.010500257
3    7.5 0.005555556
4   20.0 0.000000000
5   16.0 0.004629630
6   25.5 0.003776042
7   17.5 0.005555556
8    9.5 0.000000000
9     NA 0.000000000

GeoLight documentation built on May 1, 2019, 8 p.m.