2025-02-06

Introduction

  • In this presentation, we analyze the relationship between trading volume and stock price using Simple Linear Regression.
  • Goal: Predict stock closing price based on trading volume.
  • Company Stock being analyzed: Apple.

Simple Linear Regression Model

\[ y = \beta_0 + \beta_1 x + \epsilon \]

where:

  • \(y\) is Adjusted (Stock closing price)
  • \(x\) is Volume (Trading volume)
  • \(\beta_0\) is the intercept
  • \(\beta_1\) is the slope
  • \(\epsilon\) is the error component

Apple Dataset Preview

Stock Trading Data
Date Open High Low Close Volume Adjusted
2020-01-02 74.0600 75.1500 73.7975 75.0875 135480400 72.79602
2020-01-03 74.2875 75.1450 74.1250 74.3575 146322800 72.08831
2020-01-06 73.4475 74.9900 73.1875 74.9500 118387200 72.66270
2020-01-07 74.9600 75.2250 74.3700 74.5975 108872000 72.32098
2020-01-08 74.2900 76.1100 74.2900 75.7975 132079200 73.48435
2020-01-09 76.8100 77.6075 76.5500 77.4075 170108400 75.04521

Scatter Plot of Volume vs. Closing Price

R Code for Scatter Plot

Below is the code chunk used to produce the scatter plot on the previous slide:

ggplot(df, aes(x = Volume, y = Adjusted)) + geom_point(color = “blue”, alpha = 0.6) + geom_smooth(method = “lm”, color =“red”) + ggtitle(“Trading Volume vs. Adjusted Closing Price”)

Where df is:

df <- getSymbols(“AAPL”, src = “yahoo”, from = “2020-01-01”, to = “2024-01-01”, auto.assign = FALSE)

Model Fitting in R

Linear Regression Model Summary
Estimate Stand Error t value p value
(Intercept) 178.2571868 1.673066 106.54523 0
Volume -0.0000004 0.000000 -26.96953 0

What this means

  • The regression model suggests a statisically significant but weak negative relationship between trading volume and stock price.
  • Intercept (178.26): Represents the estimated stock price when trading volume is zero.
  • Slope (-0.0000004): Indicates that for every additional unit of trading volume, the adjusted closing price decreases slightly.
  • The p-value confirms statistical significance, but the small coefficient suggests this effect is negligible in practical terms.
  • Other factors likely play a stronger role in stock price movements.

Residual Analysis (ggplot)

3D Plotly Visualization

Alternative Statistical approach

Another method that could be used to analyze the relationship between trading volume and stock price is the Pearson Correlation Coefficient, which measures the strength of direction of the linear relationship between two variables:

\[ r = \frac{ \sum (x_i - \bar{x}) (y_i - \bar{y}) }{ \sqrt{ \sum (x_i - \bar{x})^2 } \sqrt{ \sum (y_i - \bar{y})^2 } } \]

where

  • \(x\) represents trading volume
  • \(y\) represents adjusted closing price
  • \(\bar{x}\) and \(\bar{y}\) are the mean values of X and Y, respectively

This method provides insight into how strongly trading volume and price are correlated, rather than simply modeling price as a function of volume.

Conclusion

  • Trading volume has a correlation with stock price, but the effect size is small.
  • The model suggests that volume alone is not a strong indicator of stock price.
  • Further improvements can be made using multiple regression.
  • The Pearson Correlation Coefficient could be used as an alternative measure to analyze the relationship between trading volumn and stock price.

References

  • Dataset Source: Yahoo Finance via ‘quantmod’