S&P Stock Market Data#

Daily percentage returns for the S&P 500 stock index between 2001 and 2005.

  • Year: The year that the observation was recorded

  • Lag1: Percentage return for previous day

  • Lag2: Percentage return for 2 days previous

  • Lag3: Percentage return for 3 days previous

  • Lag4: Percentage return for 4 days previous

  • Lag5: Percentage return for 5 days previous

  • Volume: Volume of shares traded (number of daily shares traded in billions)

  • Today: Percentage return for today

  • Direction: A factor with levels ‘Down’ and ‘Up’ indicating whether the market had a positive or negative return on a given day

Source#

Raw values of the S&P 500 were obtained from Yahoo Finance and then converted to percentages and lagged.

from ISLP import load_data
Smarket = load_data('Smarket')
Smarket.columns
Index(['Year', 'Lag1', 'Lag2', 'Lag3', 'Lag4', 'Lag5', 'Volume', 'Today',
       'Direction'],
      dtype='object')
Smarket.shape
(1250, 9)
Smarket.columns
Index(['Year', 'Lag1', 'Lag2', 'Lag3', 'Lag4', 'Lag5', 'Volume', 'Today',
       'Direction'],
      dtype='object')
Smarket.describe().iloc[:,-4:]
Lag4 Lag5 Volume Today
count 1250.000000 1250.00000 1250.000000 1250.000000
mean 0.001636 0.00561 1.478305 0.003138
std 1.138774 1.14755 0.360357 1.136334
min -4.922000 -4.92200 0.356070 -4.922000
25% -0.640000 -0.64000 1.257400 -0.639500
50% 0.038500 0.03850 1.422950 0.038500
75% 0.596750 0.59700 1.641675 0.596750
max 5.733000 5.73300 3.152470 5.733000