Week 5 - Can I Predict the Future?
March 29, 2024
Hello everybody and welcome back to my Senior Project! Before I get into my progress for the week, I would like to quickly revisit my timeline that I created at the beginning of this project. Before starting, I made a 12 week timeline with goals that I wanted to achieve at the end of each week. My timeline is below:
Week 1: Research
Week 2: Research
Week 3: Compile stock market data
Week 4: Preprocess stock market data
Week 5: Run stock market data through the ARIMA model
Week 6: Accuracy Tests
Week 7: Compile news articles
Week 8: Build Sentiment Analysis model
Week 9: Preprocess Sentiment Analysis Data
Week 10: Accuracy Tests
Week 11: Conclusion
Week 12: Finish Final Product
Now that I am almost halfway through the project, I decided to revisit my timeline and modify it based on what I’ve done so far. My updated timeline is below:
Week 1: Research
Week 2: Preprocess and Compile stock Market Data
Week 3: Develop ARIMA model
Week 4: Continue Developing ARIMA model and run data through it
Week 5: Accuracy Tests
Week 6: Compile news articles for Sentiment Analysis Data
Week 7: Preprocess Sentiment Analysis data
Week 8: Develop Sentiment Analysis Model
Week 9: Develop Sentiment Analysis Model
Week 10: Accuracy Tests
Week 11: Create Presentation Slides + Rehearse
Week 12: Present at Senior Project Showcase
This new modified timeline uses less time for compiling and processing data (as I realized it doesn’t take much time) and more time for developing the statistical models (as they output many error messages which take much time to fix).
Now, let’s talk about what I did this week. My goal for the week was to run accuracy tests on my ARIMA model to figure out how accurately the model was able to forecast stock prices. Now remember, I inputted data from September 1, 2022 to September 1, 2023 and asked the model to predict the prices from September 1, 2023 to March 1, 2024. Going into this week, I did not expect the accuracy to be very high because the ARIMA model was supposed to represent stock forecasts without any external influence. I ran this model on 8 different companies and surprisingly, the model was more accurate than I thought it would be. The first thing I did was create a graph so I could visually conclude how close/far the model’s predictions were. The graphs for all companies are shown below:
As shown from these graphs, the model was pretty good at predicting the price for Apple, Google, Microsoft, Meta, and surprisingly not very far off from its Sharps Technology forecast. It was not very accurate for Tesla, Amazon, and Nvidia. However, while these graphs were helpful, I wanted a quantitative way to know exactly how far off these predictions were.
I ran two tests on each ARIMA model to find the Mean Absolute Error (MAE) and the Mean Percentage Error (MPE). The MAE is the value by which each prediction that the ARIMA model makes deviates from the actual stock price. The MPE is the percentage by which the prediction deviates from the actual stock price. The MAE and MPE for each company is listed below:
AMAZON:
Mean Absolute Error (MAE): 38.477605580118656
Mean Percentage Error (MPE): 27.31%
APPLE:
Mean Absolute Error (MAE): 23.59470828609305
Mean Percentage Error (MPE): 13.01%
GOOGLE:
Mean Absolute Error (MAE): 6.76478021978044
Mean Percentage Error (MPE): 3.27%
META:
Mean Absolute Error (MAE): 27.357669922490018
Mean Percentage Error (MPE): 5.14%
MICROSOFT:
Mean Absolute Error (MAE): 17.253761822453814
Mean Percentage Error (MPE): -1.16%
NVIDIA:
Mean Absolute Error (MAE): 145.22725207136597
Mean Percentage Error (MPE): 31.58%
SHARPS TECHNOLOGIES:
Mean Absolute Error (MAE): 0.1772688493753724
Mean Percentage Error (MPE): 47.82%
TESLA:
Mean Absolute Error (MAE): 120.094505494509
Mean Percentage Error (MPE): 54.04%
As shown, the model was pretty accurate for Microsoft, Meta, and Google as their mean percentage error was below 10% which means on average the model’s predictions deviated from the actual values by less than 10%. This was very surprising to me because I did not expect the model to be that accurate (since it was only a mathematical forecast). For Microsoft, the ARIMA model only deviated from the actual value by 1% (the MPE is negative because the actual values were higher than the predicted values on average). It was not very accurate for Tesla and Sharps technologies, however this was expected. Sharps Technologies is a startup, so its stock price is very volatile. Additionally, there have been many issues with Tesla’s stock and it has declined very rapidly, so much that since the start of this project, it has left the “Magnificent 7.” If you remember, these stocks were the ones that had the biggest shares in the market which is why I chose to look into them. However, around a week ago, Broadcom replaced Tesla as one of these Magnificent 7 stocks, which wasn’t something the ARIMA model could have predicted. It wasn’t very accurate for Amazon and Nvidia, however, those results were around what I expected (for the model to be between 60-80% accurate) so that I could further investigate whether or not the news could have helped its accuracy.
Overall, I think the results of this ARIMA model were pretty surprising and more accurate than I would have expected, given that there was no external influence on these prices. Would I recommend someone to utilize it to make real life financial decisions? The answer is no. While these results weren’t bad, I still don’t know how much external factors influence these prices. I definitely also did not input enough training data and the time frame for my predictions was very small, so I don’t know how the model will perform in the longer run. However, while the model may not be ideal for real life predictions, it was still very interesting to see how it was able to act with the stock prices that I inputted. Next, I plan to start researching and compiling news articles about these companies to see how they influence these predictions that my model gave. Thank you guys so much for reading and I’ll see you next week!
Leave a Reply
You must be logged in to post a comment.