sojourn: Estimated sojourn measure

View source: R/Analyses_functions_1.R

sojournR Documentation

Estimated sojourn measure

Description

Computes the estimated sojourn measure for a time series X(t) greater or lower than the constant level A for the provided time interval or its sub-interval.

Usage

sojourn(X, A, N = 10000, level = "greater", 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.

N

Number of steps on the time interval (or time sub-interval) used for computations. Default set to 10000.

level

A vector of character strings which specifies which sojourn measure required for X, "greater" or "lower" than A. Default set to "greater".

subI

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

plot

Logical: If TRUE, the time series, constant level (in blue) and the sojourn measure (in red) are plotted in interactive sessions.

Value

Estimated sojourn measure.

See Also

exc_Area

Examples

t <- seq(0, 1, length = 1000)
TS <- data.frame("t" = t,"X(t)" = rnorm(1000))
sojourn(TS, 0.8, level = 'lower',subI = c(0.5, 0.8), plot = TRUE)

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