SDSC6012 Course 2-Stationarity and autoregressive models
#sdsc6012
English / 中文
Components and Decomposition of Time Series
A time series typically consists of three components:
-
Trend Component: Long-term direction of change
-
Seasonal Component: Fluctuations with fixed periods
-
Random Noise: Unexplained random fluctuations
Using Python’s Matplotlib and NumPy libraries, one can generate and visualize the combined effects of these components.
Key Statistics: Measuring Dependence
Mean Function
-
Represents the average level of the time series at time
-
For continuous random variables, calculated by integrating with the probability density function
Autocovariance Function
-
Measures the linear relationship between observations at two different time points in the same time series
-
Difference from ordinary covariance: Autocovariance measures the relationship of the same variable at different time points
Calculation Example:
For vectors and , the covariance is calculated as:
Detailed Calculation of Expected Value
Expected Value for Discrete Random Variables
-
: The -th possible value of random variable
-
: The probability corresponding to that value
Dice Expected Value Calculation:
Expected Value for Continuous Random Variables
-
: Probability Density Function (PDF)
-
For continuous variables, the probability at a single point is 0, only interval probabilities can be calculated
Bus Waiting Time Example (Uniform distribution minutes):
Stationarity
Strict Stationarity
-
Requires that the entire probability distribution of the time series remains unchanged over time
-
For any , satisfy:
-
The autocovariance function satisfies:
Weak Stationarity
-
More lenient conditions, only need to satisfy:
- Constant Mean: (independent of time )
- Constant Variance: is constant
- Autocovariance Depends Only on Time Lag:
Analogy for Understanding:
- Strict Stationarity: All aspects of an orchestra’s performance (melody, harmony, rhythm, volume, timbre) remain exactly the same
- Weak Stationarity: Only requires constant average volume, constant range of volume fluctuations, and stable rhythm
Properties of the Autocovariance Function
-
(variance is non-negative)
-
(autocovariance does not exceed variance)
-
(symmetry)
Autocorrelation Function (ACF)
-
Range:
-
Answers: “How correlated is today’s data with yesterday’s, the day before yesterday’s, etc.?”
Stationarity Example Analysis
White Noise Process
-
(constant mean)
-
-
Is a stationary process
Random Walk Process
-
-
(depends on both and )
-
Is not a stationary process
First-Order Moving Average Process MA(1)
-
-
(constant mean)
-
-
Is a stationary process
Estimation of Correlation
Sample Mean
-
(unbiased estimator)
-
Sample Autocovariance Function
Sample Autocorrelation Function (Sample ACF)
White Noise Test: If is white noise, then no more than 5% of sample ACF values satisfy:
Differencing Operations
Backshift Operator
Difference Operator
-
First-order difference:
-
d-th order difference:
Differencing to Remove Trends
-
First-order difference removes linear trend:
-
Second-order difference removes quadratic trend:
Tool Libraries Introduction
Matplotlib
-
Comprehensive visualization library for Python
-
Creates static, dynamic, and interactive visualizations
-
Supports high-quality publication graphics output
NumPy
-
Fundamental package for scientific computing in Python
-
Powerful N-dimensional array object
-
Provides comprehensive mathematical functions, random number generators, etc.
SciPy
-
Scientific computing library based on NumPy
-
Provides algorithms for optimization, integration, interpolation, eigenvalue problems, etc.
-
Underlying implementation uses highly optimized Fortran, C, and C++
