indexComp
derives an Index from the given price and market capitalization or liquidity data. The number of constituents can be fixed or being chosen flexible based on the methodology from Trimborn and Haerdle (2018). This is the main function of the package. The derived index is meant for analysis purposes. For a continuous updating and display of an index on a website, please refer to the remaining functions.
indexComp(market, price, vol = NULL, weighting = "market", weighting.all = "market",
ic = "AIC", eval.seq = c("sequential", "all.together"),
optimum = c("local", "global"), start.const = 1, steps = 1, fixed.value = NULL,
base.value = 1000, derivation.period = 1, derivation.period.ic = 3, days.line)
An xts object with the market capitalization data. The default is NULL
, an entry is necessary if weighting is set to "market"
.
An xts object with the price data. An entry is always required.
An xts object with the trading volume (liquidity) data. The default is NULL
, an entry is necessary if weighting is set to "volume"
.
The weighting scheme to be applied. "market"
refers to weighting by market capitalization, "volume"
refers to weighting by trading volume.
The weighting scheme to be applied to the full market index. "market"
refers to weighting by market capitalization, "volume"
refers to weighting by trading volume.
Information Criterion to be used for the evaluation of the appropriate index to be used. Possible entries are "AIC"
, "GCV"
, "GFCV"
, "SH"
, "Cp"
and "FPE"
.
Indicates how the evaluation of the candidate indices by the ic shall be performed. "all.together"
evaluates all indices against each other, "sequential"
evaluates always two consecutive indices against each other.
Define how to choose the optimal index. Either a "local"
optimum is chosen, thus the derivation stops the first time the results become worse under the chosen ic
, or a "global"
optimum is chosen, thus all indices are derived and the best fitting one under the ic
is chosen.
The number of constituents to start constructing the indices with. The default is 1
.
The step width for the number of constituents to construct the next index from. The default is 1
.
In case no ic
for the number of constituents for the index shall be applied, give the number of constituents the index shall contain. In that case, "ic"
, "eval.seq"
, "optimum"
, "start.const"
and "steps"
are inactive parameters. The default is NULL
.
The starting value for the index. The default is 1000
.
The number of month after which the weights of the index are reallocated. The default is 1
.
The number of month after which the composition of the index is derived again, thus the number of constituents is reevaluated. The default is 3
.
The days of the month to perform the recalculation on. Can be calculated from switchDates.
An object of the class
IndexConstruction with the components
A list containing the results of the model fitting
index
The optimal index
totalIndex
The index of all constituents
totalIndexRebased
The index of all constituents rebased at the index each time after altering the number of index constituents which is useful for comparisons with the market
assets
A list containing the assets considered for index construction in each period
weights
A list containing the weights assigned to the selected index constituents in each period
weightsRelative
A list containing the relative weights assigned to the selected index constituents in each period
A list containing the inputs for model fitting
marketCap
The provided dataset of the market capitalization of each asset for index construction
price
The provided dataset of the price series of each asset for index construction
tradingVolume
The provided dataset of the trading volume of each asset for index construction
daysDerivation
The provided vector of dates on which to rederive the index weights and number of index constituents
The selected weighting scheme
The selected weighting.all scheme
The selected ic
The selected eval.seq scheme
The selected optimization scheme
The selected number of starting constituents for the index
The selected step size for the selection of the constituents for the index
The selected period for rederivation of the weights of the index constituents
The selected period for rederivation of the number of index constituents
For more details, please see the methodology section of the paper Trimborn and Haerdle (2018).
Trimborn, S. and Haerdle, W.K. (2018). CRIX an Index for cryptocurrencies, Journal of Empirical Finance 49, pp. 107-122. https://doi.org/10.1016/j.jempfin.2018.08.004
# NOT RUN {
data(CryptoData)
price = price["2014-03-31::2015-01-31"]
market = market["2014-03-31::2015-01-31"]
vol = vol["2014-03-31::2015-01-31"]
days.line = switchDates(price, specificDate = "1")
indexComp(market = market, price = price, vol = vol, weighting = "market",
weighting.all = "market", ic = "AIC", eval.seq = "sequential", optimum = "local",
start.const = 5, steps = 5, days.line = days.line)
# }
Run the code above in your browser using DataLab