| Smarket | R Documentation |
S&P Stock Market Data
Description
Daily percentage returns for the S&P 500 stock index between 2001 and 2005.
Usage
Smarket
Format
A data frame with 1250 observations on the following 9 variables.
YearThe year that the observation was recorded
Lag1Percentage return for previous day
Lag2Percentage return for 2 days previous
Lag3Percentage return for 3 days previous
Lag4Percentage return for 4 days previous
Lag5Percentage return for 5 days previous
VolumeVolume of shares traded (number of daily shares traded in billions)
TodayPercentage return for today
DirectionA factor with levels
DownandUpindicating 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, https://www.statlearning.com, Springer-Verlag, New York
Examples
summary(Smarket)
lm(Today~Lag1+Lag2,data=Smarket)