Description Usage Arguments Value Examples
Calculate IS-turbulence based on a cross-section of times-series (xts) data
1 2 3 4 5 6 7 8 9 10 11 |
X |
the dataset X in xts format (if not, the program will try to convert it to xts) |
weights |
optional, can either be a vector (in which case it will be used for each row and must match ncol(X)) or a matrix with the same dimension as X if weights=NULL (the default), equal weights will be generated based on the number of columns (CHECK no of non NA entries per row) |
squared |
optional, should the square root be taken of the results? (standard: TRUE which correwsponds to squared=FALSE) |
norm |
optional, should the result be normalized by 1/sum(weights^2) per row (makes expectation equal to 1) |
method |
optional, if a robust mean/covariance estimator should be used |
s.k |
optional, lookback window for current observations that are related to the long-term mean |
imp |
optional, should missing values be imputed? (standard:) |
use |
optional, use="pairwise.complete.obs": What method of dealing with missing values should be used (note, that variables with more than half missing obs are thrown out anyway) |
GW |
optional, should the Garthwaite & Koch (2016) decomposition be calculated |
list containing 4 elements: - turb: turbulence index - turb.grad: contribution of individual series to turb - mturb: turbulence index based on diagonal covariance matrix - cturb: correlation turbulence turb/mturb - GW: Shall the Garthwaite & Koch (2016) decomposition also be calculated?
1 2 3 4 5 6 7 8 9 10 11 12 | require(xts)
data(X)
turb1 <- ISturbulence(X, s.k=1)$turb
turb2 <- ISturbulence(X,s.k=12)$turb
turb3 <- ISturbulence(X,s.k=12, method="MCD")$turb
plot(turb1, lwd=2, main="In-sample turbulence (standard)")
lines(turb2,lwd=2,col="red", main="Turbulence with 12 month lookback period",on=NA)
lines(turb3,lwd=2,col="blue", main="Turbulence with 12 month lookback period and robust MCD estimator",on=NA)
turbG <- ISturbulence(X,s.k=12)$turb.grad
turbGW <- ISturbulence(X,s.k=12, GW=TRUE)$turb.GW
tail(rowSums(turbG))
tail(rowSums(turbGW))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.