extractData: Datasets dfData, mData, tData, xData, zData, extractData :...

Description Usage Arguments Details References See Also Examples

View source: R/b_data.R

Description

dfData, mData, tData, xData, zData are datasets made of lists of data.frame, matrix, timeSeries, xts and zoo components. They describe prices and returns of 10 financial series used in the documents and demos presented at 8th and 9th R/Rmetrics conferences (2014, 2015). See the references. The last serie (CHF, interest rates in Switzerland) exhibits negative prices. All distributions of logreturns exhibit fat tails. Function extractData converts subsets of mData, tData, xData, zData.

Usage

1
extractData(pr = "p", ft = "tss", start = "2007-01-01", end = "2013-12-31")

Arguments

pr

character. Extract prices or returns: c("p","r","prices","returns").

ft

character. Output format among c("tss","xts","zoo","dfr","bfr","mat").

start

character. Start date.

end

character. End date.

Details

10 financial series presented in four different formats for convenient use: dfData is the complete dataset in data.frame format with dates as row.names and one or several columns. tData, xData and zData are lists of timeSeries, xts and zoo formats and display only one column per stock.

  1. "GOLD" from 1999-01-04 to 2013-12-31, dim 3694x1 (df, m, t, x, z).

  2. "DEXIA" from 2008-10-27 to 20009-10-26, dim 255x1 (t, x, z), 255x5 (df).

  3. "SOCGEN" from 1992-07-20 to 2013-12-31, dim 5445x1 (m, t, x, z), 5445x5 (df).

  4. "VIVENDI" from 1992-07-20 to 2013-12-31, dim 5444x1 (m, t, x, z) 5444x5 (df).

  5. "EURUSD" from 1999-01-03 to 2013-12-31, dim 3843x1 (m, t, x, z), 3843x4 (df).

  6. "VIX" from 2004-01-02 to 2013-12-31, dim 2517x1 (m, t, x, z), 2517x4 (df).

  7. "CAC40" from 1988-01-04 to 2013-12-31, dim 6574x1 (m, t, x, z), 6574x4 (df).

  8. "DJIA" from 1896-05-26 to 2013-12-31, dim 32064x1 (m, df, t, x, z).

  9. "SP500" from 1957-01-02 to 2013-12-31, dim 14350x1 (m, df, t, x, z).

  10. "CHF" from 1995-01-02 to 2013-09-13, dim 4880x1 (t, x, z), 4880x8 (df). Interst rates in Switzerland. Include negative prices at the end of the dataset. Care is required to calculate the returns! (Use fatreturns and elevate). See the examples if you decide or need to remove it from the list.

Function extractData extracts 8 financial series from matrix mData (DEXIA and CHF are not included) and converts them into a 2 dimensions object with any of the following class:

The start date must be posterior to "2007-01-01" (default) and the end date must be anterior to "2013-12-31" (default).

References

P. Kiener, Explicit models for bilateral fat-tailed distributions and applications in finance with the package FatTailsR, 8th R/Rmetrics Workshop and Summer School, Paris, 27 June 2014. Download it from: https://www.inmodelia.com/exemples/2014-0627-Rmetrics-Kiener-en.pdf

P. Kiener, Fat tail analysis and package FatTailsR, 9th R/Rmetrics Workshop and Summer School, Zurich, 27 June 2015. https://www.inmodelia.com/exemples/2015-0627-Rmetrics-Kiener-en.pdf

See Also

tData, xData, zData, dfData, getDSdata.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
   

library(zoo) 
library(xts) 
library(timeSeries) 

### dfData, tData, xData, zData : prices only
attributes(dfData); attributes(tData); attributes(xData); attributes(zData) 
lapply(dfData, head, 3)
lapply( mData, head, 3)
lapply( tData, head, 3)
lapply( xData, head, 3)
lapply( zData, head, 3)

### extractData : prices and logreturns
head(ptD <- extractData("p", "tss", "2009-01-01", "2012-12-31")) ; tail(ptD)
head(rtD <- extractData("r", "tss")) 
head(pxD <- extractData("p", "xts")) 
head(rxD <- extractData("r", "xts")) 
head(pzD <- extractData("p", "zoo")) 
head(rzD <- extractData("r", "zoo")) 
head(pbD <- extractData("p", "bfr")) 
head(rbD <- extractData("r", "bfr")) 
head(pmD <- extractData("p", "mat")) 
head(rmD <- extractData("r", "mat")) 

### Remove item CHF (negative prices) from dfData, tData, xData, zData
Z <- dfData[names(dfData)[1:9]]; attributes(Z)
Z <- tData[names(tData)[1:9]]; attributes(Z)
Z <- xData[names(xData)[1:9]]; attributes(Z)
Z <- zData[names(zData)[1:9]]; attributes(Z)

FatTailsR documentation built on March 12, 2021, 9:06 a.m.