๐Ÿ“ˆ Walmart Stock Price Prediction ๐Ÿ“Š

Introduction

Welcome to the rollercoaster ride of Walmart stock prices! ๐ŸŽข This project dives deep into the world of stock price movements, forecasting, and data wizardry. Buckle up as we journey through data preparation, decomposition, stationarity testing, and the ultimate showdown of forecasting models.

Data Preparation ๐Ÿงน

  • Data Source: ๐Ÿ•ต๏ธโ€โ™‚๏ธ Sourced historical price data from 2014-06-03 to 2024-06-04 using the magical powers of yfinance.
  • Data Cleaning: ๐Ÿงผ Checked for pesky null values or duplicates. Spoiler: there were none!
  • Feature Engineering: ๐Ÿ› ๏ธ Added cool columns like '30-Day Moving Average', '90-Day Moving Average', '150-Day Moving Average', '210-Day Moving Average', 'Close First Difference', and 'Close 12 Difference' to supercharge our analysis.

Exploratory Analysis ๐Ÿ”

  • Visual Treats: ๐ŸŽจ Feast your eyes on the graphical representations of Open, High, Low, Close, Adj Close, Volume over the past decade.
  • Stock Price Highlights:
    • ๐Ÿ“ˆ Highest Closing Price: $65.379 on 2024-05-24.
    • ๐Ÿ“‰ Lowest Closing Price: $33.18 on 2019-05-09.
  • Year-End Extravaganza: ๐ŸŽ‰ Check out how Walmart stock has wrapped up each year over the past 10 years.
  • Quarter-Start Insights: ๐Ÿ—“๏ธ Analyze the stock performance at the start of each quarter.
  • Moving Averages Galore: ๐Ÿ“Š Plot and admire the 30-Day, 90-Day, 150-Day, and 210-Day moving averages.

Time Series Decomposition ๐Ÿ”ฌ

  • Trend, Seasonality, Residuals: ๐Ÿงฉ Unraveled using the mystical powers of STL decomposition.

Stationarity Testing ๐Ÿงช

  • ADF Test: ๐Ÿ“ Conducted the Augmented Dickey-Fuller test to check for stationarity. Spoiler: It wasn't stationary.
  • Transformation Magic: โœจ Applied differencing to achieve the zen state of stationarity. First differencing did the trick! Also checked 12th differencing for seasonality.

Forecasting Model Development ๐Ÿง 

  • ARIMA: ๐Ÿ“‰ The classic ARIMA model with pdq values from PACF and ACF graphs.

    • Performance: Not so great (MAE: 6.673, RMSE: 7.711). ARIMA, you tried your best!
  • SARIMAX: ๐Ÿ”„ The seasoned SARIMAX model with pdq and seasonality values from PACF and ACF graphs.

    • Performance: Improved results (MAE: 4.51, RMSE: 5.42). Nice try, SARIMAX!
  • Prophet: ๐Ÿ”ฎ Utilized Prophet for forecasting and plotted the magical forecast.

    • Performance: Impressive (MAE: 1.33, RMSE: 2.09). Way to go, Prophet!
  • LSTM: ๐Ÿค– Enter the neural network! Implemented LSTM and plotted the forecast.

    • Performance: Superstar results (MAE: 1.33, RMSE: 2.09). Predicted Close Price on 2023-12-01: $50.82 (Actual: $51.45), with approximately 1.22% error. LSTM, you rock!

Conclusion ๐ŸŽฌ

  • This wild ride shows how different forecasting models stack up against Walmart's stock data.
  • The LSTM model is the undisputed champion, providing the most accurate predictions.

Recommendations ๐Ÿ”ฎ

  • Future explorers, consider:
    • Further hyperparameter tuning of the LSTM model.
    • Incorporating additional external variables (e.g., economic indicators) for even more accuracy.
    • Regular updates and retraining of models to stay sharp with new data.