cross_rate: Crossing rate

View source: R/Analyses_functions_2.R

cross_rateR Documentation

Crossing rate

Description

Computes the rate at which a time series crosses a specific constant level for the provided time interval or its sub-interval.

Usage

cross_rate(X, A, subI = NULL, plot = FALSE)

Arguments

X

Data frame where the first column is a numeric time sequence t and the second one is the values of the time series X(t).

A

Constant level as a numeric value.

subI

Time sub-interval as a vector, where the lower bound is the first element and the upper bound is the second. Optional: If provided crossing rate for the sub-interval is returned, otherwise the whole time interval is considered.

plot

Logical: If TRUE, the time series, the constant level and crossing points are plotted in interactive sessions.

Value

The crossing rate, which gives average number of crossings per time unit.

See Also

cross_T, cross_mean

Examples

t <- seq(0, 1, length = 100)
TS <- data.frame("t" = t, "X(t)" = rnorm(100))
cross_rate(TS, 0.1, subI = c(0.2, 0.8), plot = TRUE)

Rmfrac documentation built on Sept. 10, 2025, 10:31 a.m.