This repository contains a Python script for conducting a statistical analysis of the S&P 500 index's historical log returns over a 10-year period from January 1, 2010, to December 31, 2020. The analysis includes data retrieval, computation of log returns, statistical measurements, data visualization, and probability estimation of negative returns.
- Data Retrieval: Fetch S&P 500 historical data using the
yfinance
library. - Log Return Calculation: Compute daily log returns for consecutive trading days.
- Statistical Analysis: Calculate mean and standard deviation of daily log returns.
- Data Visualization: Plot a histogram of log returns and a normal distribution curve for comparison.
- Probability Estimation:
- Calculate the daily probability of the index dropping by 1% to 5%.
- Estimate the probability of the index dropping over 5% in a 30-day period.
To run the script, navigate to the script's directory and execute the python notebook
- Python 3
pandas
numpy
matplotlib
scipy
yfinance
Make sure to install all required libraries using pip
before running the script.