Last data update: 2014.03.03

R: Interevents (or interarrivals) from events dates
interevtR Documentation

Interevents (or interarrivals) from events dates

Description

Compute intervent durations from events dates

Usage

   interevt(date,
            skip = NULL, noskip = NULL)

Arguments

date

A POSIXct vector containing the date(time) of the events.

skip

A data.frame containing two POSIXct columns start and end describing the periods to skip over.

noskip

A data.frame like skip but where the periods define the NON skipped part of the events.

Details

Interevents are the time differences between successive dates. When the date argument contains occurrence times T[i] for successive events of an homogeneous Poisson process, interevents T[i] - T[i-1] are mutually independent with the same exponential distribution.

When some time intervals are skipped independently from the event point process, we may consider the interevents T[i] - T[i-1] between two non-skipped events such that the time interval (T[i-1], T[i]) does not contains any skipped interval. These interevents still are mutually independent with the same exponential distribution. When skip or noskip is not NULL the computation therefore only retains couples of two successive datetimes "falling" in the same non-skipped period, which number can therefore be associated with the interevent.

Value

A list mainly containing a interevt data.frame.

interevt

Data.frame. Each row describes a retained interevent through a period integer giving the "noskip" period, a start and end POSIXct and a duration in days.

noskip

Only when skip or noskip args have been given. A data.frame containing broadly the same information as the noskip arg is it was given or the information deduced from the skip arg if given.

axis

When needed, a list with some material to build an axis with uneven ticks as in the gof.date with skip.action = "omit".

Note

Only one of the two arguments skip and noskip should be given in the call. In each case, the rows of the returned data.frame objects describe periods in chronological order. That is: start at row 2 must be after the end value of row 1 and so on.

Note that there are usually less interevents than dates since two successive dates will be retained for an interevent only when they are not separated by missing period. As a limit case, there can be no interevents if the noskip periods contain only one date from the date vector.

Author(s)

Yves Deville

See Also

gof.date for goodness-of-fit diagnostics for dates of events expplot for diagnostics concerning the exponential distribution.

Examples

## Use Brest data
ie <- interevt(date = Brest$OTdata$date, skip = Brest$OTmissing)

expplot(ie$interevt$duration, rate = 1 / mean(ie$interevt$duration),
  main = "No threshold")

## keep only data over a threshold
ind1 <- Brest$OTdata$Surge >= 35
ie1 <- interevt(Brest$OTdata$date[ind1], skip = Brest$OTmissing)
expplot(ie1$interevt$duration, main = "Threshold = 35")

## increase threshold
ind2 <- Brest$OTdata$Surge >= 55
ie2 <- interevt(date = Brest$OTdata$date[ind2], skip = Brest$OTmissing)
expplot(ie2$interevt$duration, main = "Threshold = 55 cm")

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(Renext)
Loading required package: evd
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/Renext/interevt.Rd_%03d_medium.png", width=480, height=480)
> ### Name: interevt
> ### Title: Interevents (or interarrivals) from events dates
> ### Aliases: interevt
> 
> ### ** Examples
> 
> ## Use Brest data
> ie <- interevt(date = Brest$OTdata$date, skip = Brest$OTmissing)
> 
> expplot(ie$interevt$duration, rate = 1 / mean(ie$interevt$duration),
+   main = "No threshold")
> 
> ## keep only data over a threshold
> ind1 <- Brest$OTdata$Surge >= 35
> ie1 <- interevt(Brest$OTdata$date[ind1], skip = Brest$OTmissing)
> expplot(ie1$interevt$duration, main = "Threshold = 35")
> 
> ## increase threshold
> ind2 <- Brest$OTdata$Surge >= 55
> ie2 <- interevt(date = Brest$OTdata$date[ind2], skip = Brest$OTmissing)
> expplot(ie2$interevt$duration, main = "Threshold = 55 cm")
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>