Skip to content

Python implementation of Hansen's Superior Predictive Ability (SPA) Test for evaluating multiple strategy performances, adjusting for correlation effects and multiple comparisons to identify statistically significant strategies. This version doesn't use bootstrapping and uses a loglog correction.

Notifications You must be signed in to change notification settings

RSv618/superior-predictive-ability

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hansen's Superior Predictive Ability (SPA) Test

This Python project implements Hansen's Superior Predictive Ability (SPA) Test, a statistical test for evaluating the performance of multiple strategies against a null hypothesis. The SPA test adjusts for the correlation structure between strategies and accounts for multiple comparisons, identifying statistically significant outperforming strategies. This version doesn't use bootstrapping and uses a loglog correction.

Features

  • Calculates Sharpe ratios for multiple strategies based on their log returns.
  • Transforms Sharpe ratios using Hansen's adjustment to account for correlation effects.
  • Computes significance thresholds and identifies strategies that outperform a given null Sharpe ratio.
  • Implements multiple-comparison correction to control for false positives.

Installation

Requirements

This project requires Python 3.8 or later and the following libraries:

  • numpy
  • pandas
  • scipy

To install the required libraries, run:

pip install numpy pandas scipy

Files

  • superior_predictive_ability.py: Main Python script implementing the SPA test.
  • log_returns_matrix.csv: Sample dataset containing log returns for various strategies.

Usage

  1. Prepare a CSV file containing log returns for multiple strategies. Each column should represent a strategy, and each row should represent a time period. Ensure the index is a timestamp or sequential period identifier.
  2. Use the following code to run the SPA test:
    python superior_predictive_ability.py
    
    The script reads the log returns data from log_returns_matrix.csv and performs the SPA test with default parameters.
  3. The output will list statistically significant strategies or indicate if none were found.

References

  • Pav, S. E. (2019). "Conditional inference on the asset with maximum Sharpe ratio".
  • Hansen, P. R. (2005). "A Test for Superior Predictive Ability". Journal of Business & Economic Statistics.

About

Python implementation of Hansen's Superior Predictive Ability (SPA) Test for evaluating multiple strategy performances, adjusting for correlation effects and multiple comparisons to identify statistically significant strategies. This version doesn't use bootstrapping and uses a loglog correction.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages