Skip to content

DavidSolan0/functional_outlier_time_series_detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Functional Outlier Time Series Detection

A comprehensive R implementation for detecting outliers in functional time series data using various depth-based and bootstrap methods.

Overview

This repository provides multiple approaches for outlier detection in functional time series, extending the original proposal by Raña et al. (2015) with several enhancements:

  • Bootstrap-based methods for robust cutoff estimation
  • Multivariate extensions using derivative information for shape outlier detection
  • Directional outlyingness (DirOut) methods for comprehensive outlier characterization
  • Sliding window approaches for local outlier detection

Available Methods

Bootstrap-based outlier detection methods following Raña et al. (2015):

  • SmBoD: Standard smoothed bootstrap on data
  • MBBo: Moving block bootstrap (for temporal dependence)
  • StBo: Stationary bootstrap

Best for: General-purpose outlier detection, especially magnitude outliers.

Multivariate extension using derivative information:

  • Uses original process, first derivative, and second derivative
  • Combines information across variables with weighted depth
  • Best for: Shape outliers and partially contaminated observations

⚠️ Note: May mask magnitude outliers. Use when you expect shape but not magnitude outliers.

Directional outlyingness-based detection:

  • Two-component outlyingness (average and variance)
  • Captures both magnitude and shape outliers
  • Best for: Comprehensive outlier detection when both types are possible

Local outlier detection using sliding windows:

  • Window-based functional depth and boxplot detection
  • Aggregates outlier flags across multiple windows
  • Best for: Non-stationary data and local pattern detection

Quick Start

Installation

# Required packages
library(fda)
library(roahd)
library(fda.usc)
library(mrfDepth)
library(fdaoutlier)  # For DirOut methods

Basic Example

# Source required files
source("R/utils.R")
source("R/depths.R")

# Prepare your functional data
data_matrix <- matrix(rnorm(100*50), nrow = 100, ncol = 50)
fdataobj <- fdata(data_matrix)

# Method 1: Original proposal (MBBo)
source("R/original_proposal/bootstrap-procedures.R")
source("R/original_proposal/outlier-detection-procedures.R")

result <- outlier_bootstrap(
    fdataobj = fdataobj,
    boot = MBBo,
    dfunc = MBD
)

print(result$outliers)

Documentation

Each method has detailed documentation with:

  • Complete function signatures and parameter descriptions
  • Working code examples
  • Parameter tuning guidelines
  • Troubleshooting tips

See the README files in each directory:

Choosing a Method

Method Best For Strengths
Original Proposal General use, magnitude outliers Robust, well-tested, multiple bootstrap options
Multivariate Process Shape outliers, partial contamination Excellent for shape detection, uses derivative info
DirOut Comprehensive detection Two-component outlyingness, captures both types
Sliding Window Non-stationary data, local patterns Local context, no bootstrap required

Repository Structure

R/
├── original_proposal/     # Original bootstrap methods
├── multivariate_process/  # Multivariate extension with derivatives
├── dirout/                # Directional outlyingness methods
├── sliding_window/        # Sliding window approach
├── real_data/            # Real data examples
├── depths.R              # Depth function implementations
├── utils.R               # Utility functions
└── simulated-models.R    # Simulation models for testing

References

Raña, P., Aneiros, G. and Vilar, J. (2015) Detection of outliers in functional time series. Environmetrics, 26, 178–191.

License

[Add your license information here]

About

This repo contains a proposal for functional time series outlier detection based on multivariate functional processes and functional depths.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages