| Title: | Simulation and Statistical Analysis of Multifractional Processes |
|---|---|
| Description: | Simulation of several fractional and multifractional processes. Includes Brownian and fractional Brownian motions, bridges and Gaussian Haar-based multifractional processes (GHBMP). Implements the methods from Ayache, Olenko and Samarakoon (2026) <doi:10.1016/j.matcom.2026.01.033> for simulation of GHBMP. Estimation of Hurst functions and local fractal dimension. Clustering realisations based on the Hurst functions. Several functions to estimate and plot geometric statistics of the processes and time series. Provides a 'shiny' application for interactive use of the functions from the package. |
| Authors: | Andriy Olenko [aut] (ORCID: <https://orcid.org/0000-0002-0917-7000>), Nemini Samarakoon [aut, cre] (ORCID: <https://orcid.org/0009-0000-2107-1973>) |
| Maintainer: | Nemini Samarakoon <[email protected]> |
| License: | GPL-3 |
| Version: | 1.0.0 |
| Built: | 2026-05-17 05:18:01 UTC |
| Source: | https://github.com/nemini-s/rmfrac |
A collection of tools for simulating, analysing and visualising multifractional processes and time series. The package includes estimation techniques for the Hurst function, Local Fractal Dimension and several other geometric statistics. It provides highly customisable plotting functions for simulated realisations, user-provided time series and their statistics.
Simulation of Brownian motion, fractional Brownian motion, fractional Gaussian noise, Brownian bridge and fractional Brownian bridge.
Simulation of Gaussian Haar-based multifractional process (GHBMP).
Estimation of Hurst function and Local Fractal Dimension.
Customisable plotting functions for GHBMP and user provided time series with estimates of Hurst function and Local Fractal Dimension.
Estimation and visualisation of geometric statistics using realisations of stochastic processes and time series. Clustering based on the Hurst function. Estimating sojourn measure, excursion area, etc.
An interactive Shiny application that provides options to explore and visualise the core functionalities of the package through simulations and user-provided time series.
Andriy Olenko ORCID [email protected]
Nemini Samarakoon ORCID [email protected]
Useful links:
This function simulates a realisation of the Brownian bridge over the
time interval [0,t_end] which has the initial value x_start and terminates
at x_end with N time steps.
Bbridge(x_end, t_end, x_start = 0, N = 1000, plot = FALSE)Bbridge(x_end, t_end, x_start = 0, N = 1000, plot = FALSE)
x_end |
Value of the process at the terminating time point. |
t_end |
Terminal time point. |
x_start |
Value of the process at the initial time point. |
N |
Number of time steps on the interval |
plot |
Logical: If |
A data frame where the first column is t and second
column is simulated values of the realisation of Brownian bridge.
Bianchi, S., Frezza, M., Pianese, A., Palazzo, A.M. (2022). Modelling H-Volatility with Fractional Brownian Bridge. In: Corazza, M., Perna, C., Pizzi, C., Sibillo, M. (eds) Mathematical and Statistical Methods for Actuarial Sciences and Finance. MAF 2022. Springer, Cham. doi:10.1007/978-3-030-99638-3_16.
Bbridge(x_end = 2, t_end = 1, plot = TRUE)Bbridge(x_end = 2, t_end = 1, plot = TRUE)
This function simulates a realisation of the Brownian motion over the
time interval [t_start,t_end] with N time steps and initial value x_start.
Bm(x_start = 0, t_start = 0, t_end = 1, N = 1000, plot = FALSE)Bm(x_start = 0, t_start = 0, t_end = 1, N = 1000, plot = FALSE)
x_start |
Value of the process at the initial time point (additive constant mean). |
t_start |
Initial time point. |
t_end |
Terminal time point. |
N |
Number of time steps on the interval |
plot |
Logical: If |
A data frame where the first column is t and second
column is simulated values of the realisation of Brownian motion with added constant mean.
GHBMP, FBm, FGn, Bbridge, FBbridge
Bm(t_end = 2, plot = TRUE)Bm(t_end = 2, plot = TRUE)
Computes the theoretical covariance matrix of a Gaussian Haar-based multifractional process.
cov_GHBMP( t, H, J = 8, theta = NULL, plot = FALSE, num.cores = availableCores(omit = 1) )cov_GHBMP( t, H, J = 8, theta = NULL, plot = FALSE, num.cores = availableCores(omit = 1) )
t |
Time point or time sequence on the interval |
H |
Hurst function |
J |
Positive integer. For large J values could be rather time consuming. Default is set to 8. |
theta |
Optional: Smoothing parameter. |
plot |
Logical: If TRUE, a 3D surface plot of the covariance function is plotted in interactive sessions. |
num.cores |
Number of cores to set up the clusters for parallel computing. |
To make it comparable with the empirical covariance function the same smoothing parameter
theta can be used if needed.
An matrix, where is the length of t.
Ayache, A., Olenko, A. and Samarakoon, N. (2026). On construction, properties and simulation of Haar-based multifractional processes. Mathematics and Computers in Simulation. 246:311-332. doi:10.1016/j.matcom.2026.01.033.
t <- seq(0, 1, by = 0.01) H <- function(t) {return(0.5 - 0.4 * sin(6 * 3.14 * t))} #Smoothed covariance function cov_GHBMP(t, H, theta = 0.1, plot = TRUE) #Non-smoothed covariance function cov_GHBMP(t, H, plot = TRUE)t <- seq(0, 1, by = 0.01) H <- function(t) {return(0.5 - 0.4 * sin(6 * 3.14 * t))} #Smoothed covariance function cov_GHBMP(t, H, theta = 0.1, plot = TRUE) #Non-smoothed covariance function cov_GHBMP(t, H, plot = TRUE)
Computes the mean duration between crossings of a time series at a specified constant level for the provided time interval or its sub-interval.
cross_mean(X, A, subI = NULL, plot = FALSE)cross_mean(X, A, subI = NULL, plot = FALSE)
X |
Data frame where the first column is a numeric time sequence |
A |
Constant level as a numeric value. |
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 mean crossing times for the sub-interval is returned, otherwise the whole time interval is considered. |
plot |
Logical: If |
The estimated mean time between crossings.
t <- seq(0, 1, length = 100) TS <- data.frame("t" = t, "X(t)" = rnorm(100)) cross_mean(TS, 0.1, subI = c(0.2, 0.8), plot = TRUE)t <- seq(0, 1, length = 100) TS <- data.frame("t" = t, "X(t)" = rnorm(100)) cross_mean(TS, 0.1, subI = c(0.2, 0.8), plot = TRUE)
Computes the rate at which a time series crosses a specific constant level for the provided time interval or its sub-interval.
cross_rate(X, A, subI = NULL, plot = FALSE)cross_rate(X, A, subI = NULL, plot = FALSE)
X |
Data frame where the first column is a numeric time sequence |
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 |
The crossing rate, which gives average number of crossings per time unit.
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)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)
Computes the estimated value(s), in which a time series crosses a specific
constant level for the provided time interval or its sub-interval.
cross_T(X, A, subI = NULL, plot = FALSE, vline = FALSE)cross_T(X, A, subI = NULL, plot = FALSE, vline = FALSE)
X |
Data frame where the first column is a numeric time sequence |
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 estimated crossing times of the sub-interval is returned, otherwise the whole time interval is considered. |
plot |
Logical: If |
vline |
Logical: If |
The estimated crossing times at a given level.
t <- seq(0, 1, length = 100) TS <- data.frame("t" = t, "X(t)" = rnorm(100)) cross_T(TS, 0.1, subI = c(0.2, 0.8), plot = TRUE, vline = TRUE)t <- seq(0, 1, length = 100) TS <- data.frame("t" = t, "X(t)" = rnorm(100)) cross_T(TS, 0.1, subI = c(0.2, 0.8), plot = TRUE, vline = TRUE)
Computes the empirical covariance function of a process, for each pair of time points in the time sequence using M realisations of the process.
est_cov(X, theta = 0.1, plot = FALSE)est_cov(X, theta = 0.1, plot = FALSE)
X |
A data frame where the first column is the numeric time sequence and the remaining columns are the values of each realisation of the process. |
theta |
Smoothing parameter. |
plot |
Logical: If TRUE, a 3D surface plot of the covariance function is plotted in interactive sessions. |
The smoothing parameter theta can help to better visualise changes between
neighbour estimated values.
An matrix, where is the number of time points.
Each element represents the estimated value of covariance function for the
corresponding time points. Time points are arranged in ascending order.
#Matrix of empirical covariance estimates of the GHBMP with Hurst function H. t <- seq(0, 1, by = (1/2)^8) H <- function(t) {return(0.5 - 0.4 * sin(6 * 3.14 * t))} #Only 5 realisations of GHBMP are used in this example to reduce the computational time. X.t <- replicate(5, GHBMP(t, H), simplify = FALSE) X <- do.call(rbind, lapply(X.t, function(df) df[, 2])) Data <- data.frame(t, t(X)) cov.mat <- est_cov(Data, theta = 0.2, plot = TRUE) cov.mat#Matrix of empirical covariance estimates of the GHBMP with Hurst function H. t <- seq(0, 1, by = (1/2)^8) H <- function(t) {return(0.5 - 0.4 * sin(6 * 3.14 * t))} #Only 5 realisations of GHBMP are used in this example to reduce the computational time. X.t <- replicate(5, GHBMP(t, H), simplify = FALSE) X <- do.call(rbind, lapply(X.t, function(df) df[, 2])) Data <- data.frame(t, t(X)) cov.mat <- est_cov(Data, theta = 0.2, plot = TRUE) cov.mat
Computes the excursion area where a time series is greater or lower than the
constant level A for the provided time interval or its sub-interval.
exc_Area(X, A, N = 10000, level = "greater", subI = NULL, plot = FALSE)exc_Area(X, A, N = 10000, level = "greater", subI = NULL, plot = FALSE)
X |
Data frame where the first column is a numeric time sequence |
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 whether the excursion
area is required for |
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 excursion area for the sub-interval is returned, otherwise the whole time interval is considered. |
plot |
Logical: If |
Excursion area.
t <- seq(0, 1, length = 1000) TS <- data.frame("t" = t, "X(t)" = rnorm(1000)) exc_Area(TS, 0.8, level = 'lower', subI = c(0.5, 0.8), plot = TRUE)t <- seq(0, 1, length = 1000) TS <- data.frame("t" = t, "X(t)" = rnorm(1000)) exc_Area(TS, 0.8, level = 'lower', subI = c(0.5, 0.8), plot = TRUE)
This function simulates a realisation of the fractional Brownian bridge
for a provided Hurst parameter over the time interval [0,t_end],
which has the initial value x_start and terminates at x_end with N time steps.
FBbridge(H, x_end, t_end, x_start = 0, N = 1000, plot = FALSE)FBbridge(H, x_end, t_end, x_start = 0, N = 1000, plot = FALSE)
H |
Hurst parameter which lies between 0 and 1. |
x_end |
Value of the process at the terminating time point. |
t_end |
Terminal time point. |
x_start |
Value of the process at the initial time point. |
N |
Number of time steps on the interval |
plot |
Logical: If |
A data frame where the first column is t and second
column is simulated values of the realisation of fractional Brownian bridge.
Bianchi, S., Frezza, M., Pianese, A., Palazzo, A.M. (2022). Modelling H-Volatility with Fractional Brownian Bridge. In: Corazza, M., Perna, C., Pizzi, C., Sibillo, M. (eds) Mathematical and Statistical Methods for Actuarial Sciences and Finance. MAF 2022. Springer, Cham. doi:10.1007/978-3-030-99638-3_16.
FBbridge(H = 0.5, x_end = 2, t_end = 1, plot = TRUE)FBbridge(H = 0.5, x_end = 2, t_end = 1, plot = TRUE)
This function simulates a realisation of the fractional Brownian motion over
the time interval [t_start,t_end] for a provided Hurst parameter, which has
the initial value x_start.
FBm(H, x_start = 0, t_start = 0, t_end = 1, N = 1000, plot = FALSE)FBm(H, x_start = 0, t_start = 0, t_end = 1, N = 1000, plot = FALSE)
H |
Hurst parameter which lies between 0 and 1. |
x_start |
Value of the process at the initial time point (additive constant mean). |
t_start |
Initial time point. |
t_end |
Terminal time point. |
N |
Number of time steps on the interval |
plot |
Logical: If |
A data frame where the first column is t and second
column is simulated values of the realisation of fractional Brownian motion
with added constant mean.
Banna, O., Mishura, Y., Ralchenko, K., & Shklyar, S. (2019). Fractional Brownian motion: Approximations and Projections. John Wiley & Sons. doi:10.1002/9781119476771.app3.
FGn, Bm, GHBMP, Bbridge, FBbridge
FBm(H = 0.5, plot = TRUE)FBm(H = 0.5, plot = TRUE)
This function simulates a realisation of the fractional Gaussian noise over the
time interval [t_start,t_end] for a provided Hurst parameter.
FGn(H, t_start = 0, t_end = 1, N = 1000, plot = FALSE)FGn(H, t_start = 0, t_end = 1, N = 1000, plot = FALSE)
H |
Hurst parameter which lies between 0 and 1. |
t_start |
Initial time point. |
t_end |
Terminal time point. |
N |
Number of time steps on the interval |
plot |
Logical: If |
A data frame where the first column is t and second
column is simulated values of the realisation of fractional Gaussian noise.
Banna, O., Mishura, Y., Ralchenko, K., & Shklyar, S. (2019). Fractional Brownian motion: Approximations and Projections. John Wiley & Sons. doi:10.1002/9781119476771.app3.
FBm, Bm, GHBMP, Bbridge, FBbridge
FGn(H = 0.5,plot = TRUE)FGn(H = 0.5,plot = TRUE)
This function simulates a realisation of a Gaussian Haar-based multifractional process at any
time point or time sequence on the interval .
GHBMP(t, H, J = 15, num.cores = availableCores(omit = 1))GHBMP(t, H, J = 15, num.cores = availableCores(omit = 1))
t |
Time point or time sequence on the interval |
H |
Hurst function which depends on |
J |
Positive integer. |
num.cores |
Number of cores to set up the clusters for parallel computing. |
The following formula defined in Ayache, A., Olenko, A. & Samarakoon, N. (2026) was used in simulating Gaussian Haar-based multifractional process.
where
with .
is the Haar mother wavelet, and are positive integers, is time, is the Hurst function and
is a sequence of independent Gaussian random variables.
For simulations, the truncated version of this formula with first summation up to J is used.
A data frame of class "mp" where the first column is time moments t and second column is simulated values of .
See Examples for the usage of constant, time-varying, piecewise or step Hurst functions.
Ayache, A., Olenko, A. and Samarakoon, N. (2026). On construction, properties and simulation of Haar-based multifractional processes. Mathematics and Computers in Simulation. 246:311-332. doi:10.1016/j.matcom.2026.01.033.
Hurst, plot.mp, Bm, FBm,
FGn, Bbridge, FBbridge
#Constant Hurst function t <- seq(0, 1, by = (1/2)^10) H <- function(t) {return(0.4 + 0*t)} GHBMP(t, H) #Linear Hurst function t <- seq(0, 1, by = (1/2)^10) H <- function(t) {return(0.2 + 0.45*t)} GHBMP(t, H) #Oscillating Hurst function t <- seq(0, 1, by = (1/2)^10) H <- function(t) {return(0.5 - 0.4 * sin(6 * 3.14 * t))} GHBMP(t, H) #Piecewise Hurst function t <- seq(0, 1, by = (1/2)^10) H <- function(x) { ifelse(x >= 0 & x <= 0.8, 0.375 * x + 0.2, ifelse(x > 0.8 & x <= 1,-1.5 * x + 1.7, NA)) } GHBMP(t, H)#Constant Hurst function t <- seq(0, 1, by = (1/2)^10) H <- function(t) {return(0.4 + 0*t)} GHBMP(t, H) #Linear Hurst function t <- seq(0, 1, by = (1/2)^10) H <- function(t) {return(0.2 + 0.45*t)} GHBMP(t, H) #Oscillating Hurst function t <- seq(0, 1, by = (1/2)^10) H <- function(t) {return(0.5 - 0.4 * sin(6 * 3.14 * t))} GHBMP(t, H) #Piecewise Hurst function t <- seq(0, 1, by = (1/2)^10) H <- function(x) { ifelse(x >= 0 & x <= 0.8, 0.375 * x + 0.2, ifelse(x > 0.8 & x <= 1,-1.5 * x + 1.7, NA)) } GHBMP(t, H)
H_LFD
For user provided time series creates objects of class "H_LFD" with the
Hurst function estimated using Hurst, local fractal dimension
estimated using LFD and smoothed estimated Hurst function and LFD added.
H_LFD(X, N = 100, Q = 2, L = 2)H_LFD(X, N = 100, Q = 2, L = 2)
X |
Data frame where the first column is a numeric time sequence |
N |
Argument used for the estimation of Hurst functions and LFD. Number of sub-intervals on which the estimation is performed on. Default is set to 100 sub-intervals. |
Q |
Argument used for the estimation of Hurst functions and LFD. Fixed integer greater than or equal to 2. Default is set to 2. |
L |
Argument used for the estimation of Hurst functions and LFD. Fixed integer greater than or equal to 2. Default is set to 2. |
The return from H_LFD is an object list of class "H_LFD" with the following components:
Raw_Hurst_estimatesA data frame of where the first column is a time sequence and second column is estimated values of the Hurst function.
Smoothed_Hurst_estimatesA data frame of where the first column is a time sequence and second column is smoothed estimates of the Hurst function. Smoothed using the LOESS method.
Raw_LFD_estimatesA data frame of where the first column is a time sequence and second column is Local fractal dimension estimates.
Smoothed_LFD_estimatesA data frame of where the first column is a time sequence and second column is smoothed estimates of Local fractal dimension. Smoothed using the LOESS method.
DataUser provided time series.
Since these are estimators of local characteristics, reliable results can only be obtained when a sufficiently large number of points is used.
TS <- data.frame("t" = seq(0, 1, length = 1000),"X(t)" = rnorm(1000)) Object <- H_LFD(TS) #Plot of time series, estimated and smoothed Hurst and LFD estimates plot(Object)TS <- data.frame("t" = seq(0, 1, length = 1000),"X(t)" = rnorm(1000)) Object <- H_LFD(TS) #Plot of time series, estimated and smoothed Hurst and LFD estimates plot(Object)
This function performs hierarchical clustering of realisations based on the estimated Hurst functions.
hclust_hurst( X.t, k = NULL, h = NULL, dist.method = "euclidean", method = "complete", dendrogram = FALSE, N = 100, Q = 2, L = 2 )hclust_hurst( X.t, k = NULL, h = NULL, dist.method = "euclidean", method = "complete", dendrogram = FALSE, N = 100, Q = 2, L = 2 )
X.t |
A list of data frames. In each data frame, the first column is a numeric time sequence and the second gives the values of the processes or time series. To get reliable results, it is recommended to use at least 500 time points. See Examples for usage. |
k |
The desired number of clusters. |
h |
The height where the dendrogram should be cut into. Either |
dist.method |
A string which specifies a registered distance from |
method |
A string which specifies the hierarchical method used. Available methods
are |
dendrogram |
Logical: If |
N |
Argument used for the estimation of Hurst functions. Number of sub-intervals on which the estimation is performed on. Default is set to 100 sub-intervals. |
Q |
Argument used for the estimation of Hurst functions. Fixed integer greater than or equal to 2. Default is set to 2. |
L |
Argument used for the estimation of Hurst functions. Fixed integer greater than or equal to 2. Default is set to 2. |
The Hurst function of each realisation is estimated using the function Hurst and the smoothed Hurst estimates are used
for the cluster analysis. The distances between smoothed Hurst estimates are computed by the dist.method provided and passed into
the hclust for hierarchical clustering.
An object list of class "hc_hurst" with print and plot methods. The list has following components:
cluster_infoA data frame indicating the cluster number and distance to cluster center from
each smoothed estimated Hurst function (item). Distance is obtained from the dist.method.
clusterA vector with cluster number of each item.
cluster_sizesNumber of items in each cluster.
centersA data frame of cluster centers. Center obtained as the average of each smoothed estimated Hurst function in the cluster. Columns denote time points in which estimates were obtained. Row names denote cluster numbers.
smoothed_Hurst_estimatesA data frame of smoothed Hurst estimates. Columns denote time points in which estimates were obtained. Rows denote estimates for each realisation.
raw_Hurst_estimatesA list of data frames of raw Hurst estimates.
callInformation about the input parameters used.
print.hc_hurst, plot.hc_hurst, kmeans_hurst
#Simulation of multifractional processes t <- seq(0, 1, by = (1/2)^10) H1 <- function(t) {return(0.1 + 0*t)} H2 <- function(t) {return(0.2 + 0.45*t)} H3 <- function(t) {return(0.5 - 0.4 * sin(6 * 3.14 * t))} X.list.1 <- replicate(3, GHBMP(t,H1),simplify = FALSE) X.list.2 <- replicate(3, GHBMP(t,H2),simplify = FALSE) X.list.3 <- replicate(3, GHBMP(t,H3),simplify = FALSE) X.list <- c(X.list.1, X.list.2, X.list.3) #Hierarchical clustering based on k = 3 clusters with dendrogram plotted HC <- hclust_hurst(X.list, k=3, dendrogram = TRUE) print(HC) #Plot of smoothed Hurst functions in each cluster with cluster centers plot(HC,type = "ec")#Simulation of multifractional processes t <- seq(0, 1, by = (1/2)^10) H1 <- function(t) {return(0.1 + 0*t)} H2 <- function(t) {return(0.2 + 0.45*t)} H3 <- function(t) {return(0.5 - 0.4 * sin(6 * 3.14 * t))} X.list.1 <- replicate(3, GHBMP(t,H1),simplify = FALSE) X.list.2 <- replicate(3, GHBMP(t,H2),simplify = FALSE) X.list.3 <- replicate(3, GHBMP(t,H3),simplify = FALSE) X.list <- c(X.list.1, X.list.2, X.list.3) #Hierarchical clustering based on k = 3 clusters with dendrogram plotted HC <- hclust_hurst(X.list, k=3, dendrogram = TRUE) print(HC) #Plot of smoothed Hurst functions in each cluster with cluster centers plot(HC,type = "ec")
This function computes statistical estimates for the Hurst function.
Hurst(X, N = 100, Q = 2, L = 2)Hurst(X, N = 100, Q = 2, L = 2)
X |
Data frame where the first column is a numeric time sequence and the second the values of the process or time series. |
N |
Number of sub-intervals on which the estimation is performed on. Default is set to 100 sub-intervals. |
Q |
Fixed integer greater than or equal to 2. Default is set to 2. |
L |
Fixed integer greater than or equal to 2. Default is set to 2. |
Statistical estimation of the Hurst function is done based on the results of Ayache, A., & Bouly, F. (2023). The pointwise Holder exponent of the process for data considered in the package is equal to the Hurst function. The estimator is built through generalized quadratic variations of the process associated with its increments. The integer parameters Q and L define the generalized quadratic variations and the corresponding estimator.
A data frame of where the first column is a time sequence and second column is estimated values of the Hurst function.
Since these are estimators of local characteristics, reliable results can only be obtained when a sufficiently large number of points is used.
Ayache, A. and Bouly, F. (2023). Uniformly and strongly consistent estimation for the random Hurst function of a multifractional process. Latin American Journal of Probability and Mathematical Statistics, 20(2):1587–1614. doi:10.30757/alea.v20-60.
LFD, H_LFD, plot.mp, plot_tsest, plot.H_LFD
#Hurst function of a multifractional process simulated using GHBMP function t <- seq(0, 1, by = (1/2)^10) H <- function(t) {return(0.5 - 0.4 * sin(6 * 3.14 * t))} X <- GHBMP(t, H) Hurst(X) #Hurst function of a fractional Browian motion simulated using FBm X <- FBm(H = 0.5, x_start = 0, t_start = 0, t_end = 2, N = 1000) Hurst(X)#Hurst function of a multifractional process simulated using GHBMP function t <- seq(0, 1, by = (1/2)^10) H <- function(t) {return(0.5 - 0.4 * sin(6 * 3.14 * t))} X <- GHBMP(t, H) Hurst(X) #Hurst function of a fractional Browian motion simulated using FBm X <- FBm(H = 0.5, x_start = 0, t_start = 0, t_end = 2, N = 1000) Hurst(X)
This function performs k-means clustering of realisations based on the estimated Hurst functions.
kmeans_hurst(X.t, k, ..., N = 100, Q = 2, L = 2)kmeans_hurst(X.t, k, ..., N = 100, Q = 2, L = 2)
X.t |
A list of data frames. In each data frame, the first column is a numeric time sequence and the second gives the values of the processes or time series. To get reliable results, it is recommended to use at least 500 time points. See Examples for usage. |
k |
The desired number of clusters. |
... |
Optional arguments: |
N |
Argument used for the estimation of Hurst functions. Number of sub-intervals on which the estimation is performed on. Default is set to 100 sub-intervals. |
Q |
Argument used for the estimation of Hurst functions. Fixed integer greater than or equal to 2. Default is set to 2. |
L |
Argument used for the estimation of Hurst functions. Fixed integer greater than or equal to 2. Default is set to 2. |
The Hurst function of each realisation is estimated using Hurst. The smoothed Hurst estimates are
used for k-means clustering in kmeans. The Hartigan and Wong algorithm is used as the
default k-means clustering algorithm.
An object list of class "k_hurst" with print and plot methods. The list has following components:
cluster_infoA data frame indicating the cluster number and euclidean distance to cluster center of each smoothed estimated Hurst function (item)
clusterA vector of cluster number of each item.
cluster_sizesNumber of item in each cluster.
centersA data frame of cluster centers. Center obtained as the average of each smoothed estimated Hurst function in the cluster. Columns denote time points in which estimates were obtained. Row names denote cluster numbers.
smoothed_Hurst_estimatesA data frame of smoothed Hurst estimates. Columns denote time points in which estimates were obtained. Rows denote estimates for each realisation.
raw_Hurst_estimatesA list of data frames of raw Hurst estimates.
callInformation about the input parameters used.
print.k_hurst, plot.k_hurst, hclust_hurst
#Simulation of multifractional processes t <- seq(0, 1, by = (1/2)^10) H1 <- function(t) {return(0.1 + 0*t)} H2 <- function(t) {return(0.2 + 0.45*t)} H3 <- function(t) {return(0.5 - 0.4 * sin(6 * 3.14 * t))} X.list.1 <- replicate(3, GHBMP(t, H1), simplify = FALSE) X.list.2 <- replicate(3, GHBMP(t, H2), simplify = FALSE) X.list.3 <- replicate(3, GHBMP(t, H3), simplify = FALSE) X.list <- c(X.list.1, X.list.2, X.list.3) #K-means clustering based on k = 3 clusters KC <- kmeans_hurst(X.list, k = 3) print(KC) #Plot of smoothed Hurst functions in each cluster with cluster centers plot(KC, type = "ec")#Simulation of multifractional processes t <- seq(0, 1, by = (1/2)^10) H1 <- function(t) {return(0.1 + 0*t)} H2 <- function(t) {return(0.2 + 0.45*t)} H3 <- function(t) {return(0.5 - 0.4 * sin(6 * 3.14 * t))} X.list.1 <- replicate(3, GHBMP(t, H1), simplify = FALSE) X.list.2 <- replicate(3, GHBMP(t, H2), simplify = FALSE) X.list.3 <- replicate(3, GHBMP(t, H3), simplify = FALSE) X.list <- c(X.list.1, X.list.2, X.list.3) #K-means clustering based on k = 3 clusters KC <- kmeans_hurst(X.list, k = 3) print(KC) #Plot of smoothed Hurst functions in each cluster with cluster centers plot(KC, type = "ec")
This function computes the estimates for the local fractal dimension.
LFD(X, N = 100, Q = 2, L = 2)LFD(X, N = 100, Q = 2, L = 2)
X |
Data frame where the first column is a numeric time sequence and the second is the values of the process or time series. |
N |
The same argument that is used for the estimation of Hurst function. Number of sub-intervals on which the estimation is performed on. Default is set to 100 sub-intervals. |
Q |
The same argument that is used for the estimation of Hurst function. Fixed integer greater than or equal to 2. Default is set to 2. |
L |
The same argument that is used for the estimation of Hurst function. Fixed integer greater than or equal to 2. Default is set to 2. |
The formula is used to compute the estimated local fractal dimension,
where is the estimated Hurst function.
A data frame where the first column is a time sequence and the second column is estimated values of the local fractal dimension.
Since these are estimators of local characteristics, reliable results can only be obtained when a sufficiently large number of points is used.
Gneiting, T., and Schlather, M. (2004). Stochastic models that separate fractal dimension and the Hurst effect. SIAM Review, 46(2):269-282. doi:10.1137/S0036144501394387.
Hurst, H_LFD, plot.mp, plot_tsest, plot.H_LFD
#LFD of a multifractional process simulated using GHBMP function t <- seq(0, 1, by = (1/2)^10) H <- function(t) {return(0.5 - 0.4 * sin(6 * 3.14 * t))} X <- GHBMP(t, H) LFD(X) #LFD of a fractional Browian motion simulated using FBm X <- FBm(H = 0.5, x_start = 0, t_start = 0, t_end = 2, N = 1000) LFD(X)#LFD of a multifractional process simulated using GHBMP function t <- seq(0, 1, by = (1/2)^10) H <- function(t) {return(0.5 - 0.4 * sin(6 * 3.14 * t))} X <- GHBMP(t, H) LFD(X) #LFD of a fractional Browian motion simulated using FBm X <- FBm(H = 0.5, x_start = 0, t_start = 0, t_end = 2, N = 1000) LFD(X)
Computes the time span of the longest increasing or decreasing streak(s) of a time series for the provided time interval or its sub-interval.
long_streak(X, direction = "increasing", subI = NULL, plot = FALSE)long_streak(X, direction = "increasing", subI = NULL, plot = FALSE)
X |
Data frame where the first column is a numeric time sequence |
direction |
A character string which specifies the direction of
the streak: |
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 longest streak(s) time span of the sub-interval is returned, otherwise the whole time interval is considered. |
plot |
Logical: If |
A data frame with one row for each longest streak, containing the time span
and the corresponding values of at the streak endpoints.
t <- seq(0, 1, length = 100) TS <- data.frame("t" = t,"X(t)" = rnorm(100)) long_streak(TS, direction = 'decreasing', subI = c(0.2, 0.8), plot = TRUE)t <- seq(0, 1, length = 100) TS <- data.frame("t" = t,"X(t)" = rnorm(100)) long_streak(TS, direction = 'decreasing', subI = c(0.2, 0.8), plot = TRUE)
Computes the mean time span of the increasing/decreasing streaks for the provided time interval or its sub-interval.
mean_streak(X, direction = "increasing", subI = NULL, plot = FALSE)mean_streak(X, direction = "increasing", subI = NULL, plot = FALSE)
X |
Data frame where the first column is a numeric time sequence |
direction |
A character string which specifies the direction of
the streak: |
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 mean time span of the sub-interval is returned, otherwise the whole time interval is considered. |
plot |
Logical: If |
Mean time span of the increasing/decreasing streaks.
t <- seq(0, 1 ,length = 100) TS <- data.frame("t" = t,"X(t)" = rnorm(100)) mean_streak(TS, direction = 'decreasing', subI = c(0.2, 0.8), plot = TRUE)t <- seq(0, 1 ,length = 100) TS <- data.frame("t" = t,"X(t)" = rnorm(100)) mean_streak(TS, direction = 'decreasing', subI = c(0.2, 0.8), plot = TRUE)
Creates a plot of the user provided time series with the
Hurst function estimated using Hurst, the smoothed estimated
Hurst function and local fractal dimension estimated using LFD
and smoothed estimates of local fractal dimension.
plot_tsest( X, H_Est = TRUE, H_Smooth_Est = TRUE, LFD_Est = TRUE, LFD_Smooth_Est = TRUE, N = 100, Q = 2, L = 2 )plot_tsest( X, H_Est = TRUE, H_Smooth_Est = TRUE, LFD_Est = TRUE, LFD_Smooth_Est = TRUE, N = 100, Q = 2, L = 2 )
X |
Data frame where the first column is a numeric time sequence |
H_Est |
Logical: If |
H_Smooth_Est |
Logical: If |
LFD_Est |
Logical: If |
LFD_Smooth_Est |
Logical: If |
N |
Argument used for the estimation of Hurst functions and LFD. Number of sub-intervals on which the estimation is performed on. Default is set to 100 sub-intervals. |
Q |
Argument used for the estimation of Hurst functions and LFD. Fixed integer greater than or equal to 2. Default is set to 2. |
L |
Argument used for the estimation of Hurst functions and LFD. Fixed integer greater than or equal to 2. Default is set to 2. |
Compared to plot.H_LFD the function's first argument is a time series,
not H_LFD object.
A ggplot object which is used to plot the time series with raw and smoothed estimates of Hurst function and local fractal dimension.
TS <- data.frame("t" = seq(0, 1, length = 1000), "X(t)" = rnorm(1000)) #Plot of time series, estimated and smoothed Hurst and LFD estimates plot_tsest(TS)TS <- data.frame("t" = seq(0, 1, length = 1000), "X(t)" = rnorm(1000)) #Plot of time series, estimated and smoothed Hurst and LFD estimates plot_tsest(TS)
H_LFD
Creates a plot of the user provided time series with the
Hurst function estimated using Hurst, the smoothed estimated
Hurst function and local fractal dimension estimated using LFD
and smoothed estimates of local fractal dimension for objects of class "H_LFD".
## S3 method for class 'H_LFD' plot( x, H_Est = TRUE, H_Smooth_Est = TRUE, LFD_Est = TRUE, LFD_Smooth_Est = TRUE, ... )## S3 method for class 'H_LFD' plot( x, H_Est = TRUE, H_Smooth_Est = TRUE, LFD_Est = TRUE, LFD_Smooth_Est = TRUE, ... )
x |
Return from |
H_Est |
Logical: If |
H_Smooth_Est |
Logical: If |
LFD_Est |
Logical: If |
LFD_Smooth_Est |
Logical: If |
... |
Other arguments. |
Compared to plot_tsest, the function's argument is a "H_LFD"
object, not a time series.
A ggplot object which is used to plot the time series with theoretical, raw and smoothed estimates of Hurst function and raw and smoothed estimates of local fractal dimension.
H_LFD, Hurst, LFD, plot_tsest
TS <- data.frame("t" = seq(0, 1, length = 1000), "X(t)" = rnorm(1000)) Object <- H_LFD(TS) #Plot of time series, estimated and smoothed Hurst and LFD estimates plot(Object)TS <- data.frame("t" = seq(0, 1, length = 1000), "X(t)" = rnorm(1000)) Object <- H_LFD(TS) #Plot of time series, estimated and smoothed Hurst and LFD estimates plot(Object)
Creates a plot of the smoothed Hurst functions of realisations of processes (or time series) separately in each cluster with cluster centers using the return from
hclust_hurst. Options to plot only estimates, only centers or both are available.
## S3 method for class 'hc_hurst' plot(x, type = "estimates", ...)## S3 method for class 'hc_hurst' plot(x, type = "estimates", ...)
x |
Return from |
type |
The type of plot required:
|
... |
Other arguments. |
A ggplot object which is used to plot the relevant type of plot: "estimates", "centers" or "ec".
#Simulation of multifractional processes t <- seq(0, 1, by = (1/2)^10) H1 <- function(t) {return(0.1 + 0*t)} H2 <- function(t) {return(0.2 + 0.45*t)} H3 <- function(t) {return(0.5 - 0.4*sin(6*3.14*t))} X.list.1 <- replicate(3, GHBMP(t,H1), simplify = FALSE) X.list.2 <- replicate(3, GHBMP(t,H2), simplify = FALSE) X.list.3 <- replicate(3, GHBMP(t,H3), simplify = FALSE) X.list <- c(X.list.1, X.list.2, X.list.3) #Hierarchical clustering based on k=3 clusters with dendrogram plotted HC<- hclust_hurst(X.list, k = 3, dendrogram = TRUE) print(HC) #Plot of smoothed Hurst functions in each cluster with cluster centers plot(HC, type = "ec")#Simulation of multifractional processes t <- seq(0, 1, by = (1/2)^10) H1 <- function(t) {return(0.1 + 0*t)} H2 <- function(t) {return(0.2 + 0.45*t)} H3 <- function(t) {return(0.5 - 0.4*sin(6*3.14*t))} X.list.1 <- replicate(3, GHBMP(t,H1), simplify = FALSE) X.list.2 <- replicate(3, GHBMP(t,H2), simplify = FALSE) X.list.3 <- replicate(3, GHBMP(t,H3), simplify = FALSE) X.list <- c(X.list.1, X.list.2, X.list.3) #Hierarchical clustering based on k=3 clusters with dendrogram plotted HC<- hclust_hurst(X.list, k = 3, dendrogram = TRUE) print(HC) #Plot of smoothed Hurst functions in each cluster with cluster centers plot(HC, type = "ec")
Creates a plot of the smoothed Hurst functions of realisations of processes (or time series) separately in each cluster with cluster centers using the return from
kmeans_hurst. Options to plot only estimates, only centers or both are available.
## S3 method for class 'k_hurst' plot(x, type = "estimates", ...)## S3 method for class 'k_hurst' plot(x, type = "estimates", ...)
x |
Return from |
type |
The type of plot required.
|
... |
Other arguments. |
A ggplot object which is used to plot the relevant type of plot: "estimates", "centers" or "ec".
#Simulation of multifractional processes t <- seq(0, 1, by = (1/2)^10) H1 <- function(t) {return(0.1 + 0*t)} H2 <- function(t) {return(0.2 + 0.45*t)} H3 <- function(t) {return(0.5 - 0.4 * sin(6 * 3.14 * t))} X.list.1 <- replicate(3, GHBMP(t, H1), simplify = FALSE) X.list.2 <- replicate(3, GHBMP(t, H2), simplify = FALSE) X.list.3 <- replicate(3, GHBMP(t, H3), simplify = FALSE) X.list <- c(X.list.1, X.list.2, X.list.3) #K-means clustering based on k=3 clusters KC <- kmeans_hurst(X.list, k = 3) print(KC) #Plot of smoothed Hurst functions in each cluster with cluster centers plot(KC, type = "ec")#Simulation of multifractional processes t <- seq(0, 1, by = (1/2)^10) H1 <- function(t) {return(0.1 + 0*t)} H2 <- function(t) {return(0.2 + 0.45*t)} H3 <- function(t) {return(0.5 - 0.4 * sin(6 * 3.14 * t))} X.list.1 <- replicate(3, GHBMP(t, H1), simplify = FALSE) X.list.2 <- replicate(3, GHBMP(t, H2), simplify = FALSE) X.list.3 <- replicate(3, GHBMP(t, H3), simplify = FALSE) X.list <- c(X.list.1, X.list.2, X.list.3) #K-means clustering based on k=3 clusters KC <- kmeans_hurst(X.list, k = 3) print(KC) #Plot of smoothed Hurst functions in each cluster with cluster centers plot(KC, type = "ec")
Creates a plot of the Gaussian Haar-based multifractional process
simulated by using GHBMP with theoretical Hurst function (if provided),
Hurst function estimated using Hurst, the smoothed estimated
Hurst function and local fractal dimension estimated using LFD
and smoothed estimates of local fractal dimension.
## S3 method for class 'mp' plot( x, H = NULL, H_Est = TRUE, H_Smooth_Est = TRUE, LFD_Est = TRUE, LFD_Smooth_Est = TRUE, N = 100, Q = 2, L = 2, ... )## S3 method for class 'mp' plot( x, H = NULL, H_Est = TRUE, H_Smooth_Est = TRUE, LFD_Est = TRUE, LFD_Smooth_Est = TRUE, N = 100, Q = 2, L = 2, ... )
x |
Return from |
H |
Theoretical Hurst function. Optional: If provided, the theoretical Hurst function is plotted. |
H_Est |
Logical: If |
H_Smooth_Est |
Logical: If |
LFD_Est |
Logical: If |
LFD_Smooth_Est |
Logical: If |
N |
Argument used for the estimation of Hurst functions and LFD. Number of sub-intervals on which the estimation is performed on. Default is set to 100 sub-intervals. |
Q |
Argument used for the estimation of Hurst functions and LFD. Fixed integer greater than or equal to 2. Default is set to 2. |
L |
Argument used for the estimation of Hurst functions and LFD. Fixed integer greater than or equal to 2. Default is set to 2. |
... |
Other arguments. |
A ggplot object which is used to plot the multifractional process with theoretical, raw and smoothed estimates of Hurst function and raw and smoothed estimates of local fractal dimension.
#Simulation of the multifractional process and estimation of the Hurst function t <- seq(0, 1, by = (1/2)^10) H <- function(t) {return(0.5 - 0.4 * sin(6 * 3.14 * t))} X <- GHBMP(t, H) #Plot of process, theoretical Hurst function, estimated and smoothed Hurst and LFD estimates plot(X, H = H) #Plot of process, estimated and smoothed Hurst and LFD estimates plot(X)#Simulation of the multifractional process and estimation of the Hurst function t <- seq(0, 1, by = (1/2)^10) H <- function(t) {return(0.5 - 0.4 * sin(6 * 3.14 * t))} X <- GHBMP(t, H) #Plot of process, theoretical Hurst function, estimated and smoothed Hurst and LFD estimates plot(X, H = H) #Plot of process, estimated and smoothed Hurst and LFD estimates plot(X)
Prints the results of hierarchical clustering of realisations of processes.
## S3 method for class 'hc_hurst' print(x, ...)## S3 method for class 'hc_hurst' print(x, ...)
x |
Object of class |
... |
Other arguments. |
Prints an object of class "hc_hurst".
Prints the results of k-means clustering of realisations of processes.
## S3 method for class 'k_hurst' print(x, ...)## S3 method for class 'k_hurst' print(x, ...)
x |
Object of class |
... |
Other arguments. |
Prints an object of class "k_hurst".
This function computes the Relative Strength Index (RSI) for a time series.
RS_Index(X, period = 14, plot = FALSE, overbought = 70, oversold = 30)RS_Index(X, period = 14, plot = FALSE, overbought = 70, oversold = 30)
X |
A numeric vector. |
period |
Period length used for smoothing. Default is set to 14. |
plot |
Logical: If |
overbought |
Horizontal line which indicates an overbought level in the RSI plot. Default is set to 70. |
oversold |
Horizontal line which indicates an oversold level in the RSI plot. Default is set to 30. |
To compute the RSI,
formula is used. Average gain and average loss are computed using the Wilders's smoothing method.
A list or vector of the RSI values.
Wilder, J. W. (1978). New concepts in technical trading systems. Greensboro, NC.
X <- c(74.44,74.19,74.25,73.65,74.37,74.73,75.15,75.46,75.88,76.78, 75.81,76.53,75.11,76.28,76.68,76.08,76.53,76.11,76.42,75.58, 75.44,75.46,74.98) RS_Index(X, plot = TRUE)X <- c(74.44,74.19,74.25,73.65,74.37,74.73,75.15,75.46,75.88,76.78, 75.81,76.53,75.11,76.28,76.68,76.08,76.53,76.11,76.42,75.58, 75.44,75.46,74.98) RS_Index(X, plot = TRUE)
Launches a Shiny app to visualise and analyse realisations of Brownian motion (see Bm),
Brownian bridge (see Bbridge), fractional Brownian motion (see FBm),
fractional Brownian bridge (see FBbridge), fractional Gaussian noise (see FGn),
Gaussian Haar-based multifractional processes (see GHBMP) and user-provided time series data.
shinyapp_sim()shinyapp_sim()
For Input time series, provide a .csv file that has headers of its columns.
It must have two columns: the first column should contain the numeric time sequence ,
and the second the corresponding time series values . To get reliable estimation
results for time series, it is recommended to use at least 500 time points.
Make sure there are no extra header rows or footnotes.
An interactive Shiny app with the following user interface controls.
GHBMP simulation
Hurst functionInput the Hurst function in terms of t.
The default is set to 0.5 + 0*t.
Time sequenceInput the time sequence which belongs to the interval . The default is set to seq(0, 1, by = (1/2)^10).
JInput or select a positive integer. For large J could be rather time consuming. Default is set to 15.
Hurst function and LFD estimation
Number of sub-intervals for estimationDefault is set to 100.
QInput or select an integer greater than or equal to 2. Default is set to 2.
LInput or select an integer greater than or equal to 2. Default is set to 2.
PlotChoose the required from: Theoretical Hurst function, Raw estimate of Hurst function, Smoothed estimate of Hurst function, Raw estimate of Local Fractal Dimension, Smoothed estimate of Local Fractal Dimension.
Excursion set and area
Number of time stepsInput the number of steps the time interval needs to be split into.
Constant levelInput the constant level.
Compare to levelGreater, Lower.
PlotSelect: Excursion set, Excursion area.
Longest streak
Longest streak to plotSelect: Increasing, Decreasing.
Maximum and minimum
PlotSelect: Maximum, Minimum.
Bm, FBm, FGn, Bbridge, FBbridge,
GHBMP, Hurst, LFD, sojourn, exc_Area
long_streak, X_max, X_min
if (interactive()) { shinyapp_sim() }if (interactive()) { shinyapp_sim() }
Computes the estimated sojourn measure for a time series greater or lower than the
constant level A for the provided time interval or its sub-interval.
sojourn(X, A, N = 10000, level = "greater", subI = NULL, plot = FALSE)sojourn(X, A, N = 10000, level = "greater", subI = NULL, plot = FALSE)
X |
Data frame where the first column is a numeric time sequence |
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 |
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 |
Estimated sojourn measure.
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)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)
This function computes the maximum of a time series for the provided time interval or its sub-interval.
X_max(X, subI = NULL, plot = FALSE, vline = FALSE, hline = FALSE)X_max(X, subI = NULL, plot = FALSE, vline = FALSE, hline = FALSE)
X |
Data frame where the first column is a numeric time sequence |
subI |
Time sub-interval is a vector where the lower bound is the first element and upper bound is the second. Optional: If provided maximum of the sub-interval is returned, otherwise the whole time sequence is considered. |
plot |
Logical: If |
vline |
Logical: If |
hline |
Logical: If |
A list of numeric vector(s). The first element in the vector is the corresponding value and second the
maximum of the time series.
t <- seq(0, 1, length = 100) TS <- data.frame("t" = t, "X(t)" = rnorm(100)) X_max(TS, subI = c(0.5, 0.8), plot = TRUE)t <- seq(0, 1, length = 100) TS <- data.frame("t" = t, "X(t)" = rnorm(100)) X_max(TS, subI = c(0.5, 0.8), plot = TRUE)
This function computes the minimum of a time series for the provided time interval or its sub-interval.
X_min(X, subI = NULL, plot = FALSE, vline = FALSE, hline = FALSE)X_min(X, subI = NULL, plot = FALSE, vline = FALSE, hline = FALSE)
X |
Data frame where the first column is a numeric time sequence |
subI |
Time sub-interval is a vector where the lower bound is the first element and upper bound is the second. Optional: If provided minimum of the sub-interval is returned, otherwise the whole time interval is considered. |
plot |
Logical: If |
vline |
Logical: If |
hline |
Logical: If |
A list of numeric vector(s). The first element in the vector is the corresponding value and second the
minimum of the time series.
t <- seq(0, 1, length = 100) TS <- data.frame("t" = t, "X(t)" = rnorm(100)) X_min(TS, subI = c(0.2, 0.8), plot = TRUE)t <- seq(0, 1, length = 100) TS <- data.frame("t" = t, "X(t)" = rnorm(100)) X_min(TS, subI = c(0.2, 0.8), plot = TRUE)