Skip to content

Latest commit

 

History

History
 
 

Post_Prediction_SP500

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

readme.md

Supplemental Files for Medium Post - Predicting S&P 500 with Time-Series Statistical Learning

This folder consists the supplemental files for my Medium Post of Predicting S&P 500 with Time-Series Statistical Learning. This Medium Post is about my project of S&P 500 Prediction which is part of my project of Stock Analytics.

S&P 500 Index

S&P 500 is a capitalization-weighted index in the United States. This index takes the weighted average of the top 500 market capitalization companies to reflect the average of the stock market. The following list is the top 20 weighted stocks in the index:

  • General Electric (GE): 2.95%
  • Bank of America (BAC): 2.93%
  • Microsoft (MSFT): 2.56%
  • AT&T (T): 2.41%
  • Pfizer (PFE): 1.88%
  • Comcast (CMCSA): 1.54%
  • Apple (AAPL): 1.47%
  • Coca-cola (KO): 1.45%
  • Cisco (CSCO): 1.43%
  • Intel (INTC): 1.43%


The accuracy of the stock price predictive model of the top 20 weighted stocks in the index:
  • General Electric (GE): Negative R-square
  • Bank of America (BAC): Negative R-square
  • Microsoft (MSFT): 62.98% R-square
  • AT&T (T): 5.68% R-square
  • Pfizer (PFE): Negative R-square
  • Comcast (CMCSA): Negative R-square
  • Apple (AAPL): 76.31% R-square
  • Coca-cola (KO): 24.12% R-square
  • Cisco (CSCO): Negative R-square
  • Intel (INTC): 27.95% R-square


The above stocks with negative R-square is the priority to improve their stock price predictive model.

Adaptive Model (Time Series) Apporoach

The baseline model is the first approach to predict S&P 500. The baseline model is a predictive model of S&P 500 using adaptive model in time-series statistical model. This approach trains the predictive model with Facebook Prophet and the index between 1997-2018 for training data set. The baseline model validated with testing data with index between 2019-May 2020, that the model has achieved a 10.69% R-square. You may find more detail and the code in the Baseline Model folder.

The visualization of the prediction looks like this:

Stock Price Aggregation Model

he Stock Price Aggregation Model takes the nature of index calculation of S&P 500, it predicts the stock price of all S&P 500 components and calculate the S&P 500 using all predicted stock price. This approach consists 4 parts - Data Acquisition, Stock Price Prediction, Index Calculation, and Evaluation. You may view the code of the data acquistion part in the ETL folder, Stock Price Prediction part in the Dynamic folder in the Stock Price Prediction folder, Index Calculation and Evaluation in the Stock Price Aggregation Model folder. This folder contains a Python file, Visualization_PredictedPrice.py to visualize the stock price prediction of a selected stock. This file requires the predicted stock price saved in the local database and Plotly to plot the visualization. I have visualized the predicted stock price of Microsoft (MSFT) and General Electric (GE):


Dashboard

Coming Soon...