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

Smarket

Format

A data frame with 1250 observations on the following 9 variables.

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.

References

James, G., Witten, D., Hastie, T., and Tibshirani, R. (2013) An Introduction to Statistical Learning with applications in R, www.StatLearning.com, Springer-Verlag, New York

Examples

summary(Smarket)
#> Year Lag1 Lag2 Lag3 #> Min. :2001 Min. :-4.922000 Min. :-4.922000 Min. :-4.922000 #> 1st Qu.:2002 1st Qu.:-0.639500 1st Qu.:-0.639500 1st Qu.:-0.640000 #> Median :2003 Median : 0.039000 Median : 0.039000 Median : 0.038500 #> Mean :2003 Mean : 0.003834 Mean : 0.003919 Mean : 0.001716 #> 3rd Qu.:2004 3rd Qu.: 0.596750 3rd Qu.: 0.596750 3rd Qu.: 0.596750 #> Max. :2005 Max. : 5.733000 Max. : 5.733000 Max. : 5.733000 #> Lag4 Lag5 Volume Today #> Min. :-4.922000 Min. :-4.92200 Min. :0.3561 Min. :-4.922000 #> 1st Qu.:-0.640000 1st Qu.:-0.64000 1st Qu.:1.2574 1st Qu.:-0.639500 #> Median : 0.038500 Median : 0.03850 Median :1.4229 Median : 0.038500 #> Mean : 0.001636 Mean : 0.00561 Mean :1.4783 Mean : 0.003138 #> 3rd Qu.: 0.596750 3rd Qu.: 0.59700 3rd Qu.:1.6417 3rd Qu.: 0.596750 #> Max. : 5.733000 Max. : 5.73300 Max. :3.1525 Max. : 5.733000 #> Direction #> Down:602 #> Up :648 #> #> #> #>
lm(Today~Lag1+Lag2,data=Smarket)
#> #> Call: #> lm(formula = Today ~ Lag1 + Lag2, data = Smarket) #> #> Coefficients: #> (Intercept) Lag1 Lag2 #> 0.003283 -0.026444 -0.010946 #>