Read sample data by specifying the symbol. The two utilities, ecd.data
and ecd.data.arr
,
serves for slightly different purpose.
ecd.data
works off the xts object that has two rows:
the prices and log-returns indexed by the dates.
ecd.data.arr
and ecd.data.ts
separate the data into list of three vectors: x is the log-return, p is the prices, and d is the dates.
And allows for more sophisticated call for range of dates, and different ways of slice and lag.
ecd.data.arr
takes symbol as input, while ecd.data.ts
takes an xts object.
ecd.data(symbol = "dji")ecd.data.arr(
symbol = "dji",
start.date = "1950-01-01",
end.date = "2015-12-31",
on = "days",
lag = 1,
drop = 0,
repeated = TRUE,
cache = TRUE,
do.kurtosis = FALSE
)
ecd.data.ts(
ts,
start.date = "1950-01-01",
end.date = "2015-12-31",
on = "days",
lag = 1,
drop = 0,
repeated = TRUE,
do.kurtosis = FALSE
)
character, the symbol of the time series. Default: dji
Date or character of ISO format (YYYY-MM-DD), to specify the date range, default is from 1950-01-01 to 2015-12-31. Set start.date and end.date to NULL or "" if you wish to get the entire time series.
character, specify the calendar interval, days, weeks, months. Default is days
.
integer, specify the lags of return calculation, default is 1.
integer, specify number of largest outliners to drop, default is 0.
logical, specify whether to use repeated sampling or unique sampling, default is TRUE
.
Using "repeated" sampling can reduce noise due to insufficient sample size. This is particularly useful for larger lags.
logical, use R's options memory to cache xts data, default is TRUE
.
logical, if specified, calculate mean, sd, var, skewness, and kurtosis, default is FALSE
.
xts, the time series
ecd.data
returns an xts object for the time series, with two columns - "Close" and "logr".
ecd.data.arr
and ecd.data.ts
return a list of three vectors: x is the log-return, p is the prices, and d is the dates.
# NOT RUN {
dji <- ecd.data()
wti <- ecd.data("wti")
spx <- ecd.data.arr("spx", lag=5)
# }
Run the code above in your browser using DataLab