sp500 {depmixS4} | R Documentation |
Standard & Poor's 500 index
Description
This data set consists of (monthly) values of the S&P 500 stock exchange index. The variable of interest is the logarithm of the return values, i.e., the logarithm of the ratio of indices, in this case the closing index is used.
Usage
data(speed)
Format
A data frame with 744 observations and 6 variables.
Open
Index at the start of trading.
High
Highest index.
Low
Lowest index.
Close
Index at the close of trading.
Volume
The volume of trading.
logret
The log return of the closing index.
Source
Yahoo Data.
Examples
data(sp500)
# the data can be made with the following code (eg to include a longer or
# shorter time span)
## Not run:
require(TTR)
# load SP500 returns
Sys.setenv(tz='UTC')
sp500 <- getYahooData('^GSPC',start=19500101,end=20120228,freq='daily')
ep <- endpoints(sp500, on="months", k=1)
sp500 <- sp500[ep[2:(length(ep)-1)]]
sp500$sp500_ret <- log(sp500$Close) - lag(log(sp500$Close))
sp500 <- na.exclude(sp500)
## End(Not run)
[Package depmixS4 version 1.5-0 Index]