Title: | Index Construction for Time Series Data |
---|---|
Description: | Derivation of indexes for benchmarking purposes. A methodology with flexible number of constituents is implemented. Also functions for market capitalization and volume weighted indexes with fixed number of constituents are available. The main function of the package, indexComp(), provides the derived index, suitable for analysis purposes. The functions indexUpdate(), indexMemberSelection() and indexMembersUpdate() are components of indexComp() and enable one to construct and continuously update an index, e.g. for display on a website. The methodology behind the functions provided gets introduced in Trimborn and Haerdle (2018) <doi:10.1016/j.jempfin.2018.08.004>. |
Authors: | Simon Trimborn <[email protected]> |
Maintainer: | Simon Trimborn <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.1-3 |
Built: | 2024-11-15 04:51:36 UTC |
Source: | https://github.com/cran/IndexConstruction |
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)
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)
market |
An xts object with the market capitalization data. The default is |
price |
An xts object with the price data. An entry is always required. |
vol |
An xts object with the trading volume (liquidity) data. The default is |
weighting |
The weighting scheme to be applied. |
weighting.all |
The weighting scheme to be applied to the full market index. |
ic |
Information Criterion to be used for the evaluation of the appropriate index to be used. Possible entries are |
eval.seq |
Indicates how the evaluation of the candidate indices by the ic shall be performed. |
optimum |
Define how to choose the optimal index. Either a |
start.const |
The number of constituents to start constructing the indices with. The default is |
steps |
The step width for the number of constituents to construct the next index from. The default is |
fixed.value |
In case no |
base.value |
The starting value for the index. The default is |
derivation.period |
The number of month after which the weights of the index are reallocated. The default is |
derivation.period.ic |
The number of month after which the composition of the index is derived again, thus the number of constituents is reevaluated. The default is |
days.line |
The days of the month to perform the recalculation on. Can be calculated from switchDates. |
For more details, please see the methodology section of the paper Trimborn and Haerdle (2018).
An object of the class
IndexConstruction with the components
results |
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
inputs |
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
weighting |
The selected weighting scheme |
weighting.all |
The selected weighting.all scheme |
ic |
The selected ic |
eval.seq |
The selected eval.seq scheme |
optimum |
The selected optimization scheme |
start.const |
The selected number of starting constituents for the index |
steps |
The selected step size for the selection of the constituents for the index |
derivation.period |
The selected period for rederivation of the weights of the index constituents |
derivation.period.ic |
The selected period for rederivation of the number of index constituents |
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
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)
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)
indexMemberSelection
derives the number of index members for the coming period based on an Information Criterion, e.g. AIC. The methodology is according to Trimborn and Haerdle (2018). The method derives the new weights according to the specifications of the weight reevaluation. The function expects the data period provided to be twice the number of months specified in derivation.period.ic. In case of a mismatch, a warning is given. This function is meant for continuous updating and display of an index on a website. For the derivation of an index for analysis purposes, please refer to the function "indexComp"
.
indexMemberSelection(market, price, vol, 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, derivation.period = 1, derivation.period.ic = 3, base.value = 1000, days.line)
indexMemberSelection(market, price, vol, 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, derivation.period = 1, derivation.period.ic = 3, base.value = 1000, days.line)
market |
An xts object with the market capitalization data. The default is |
price |
An xts object with the price data. An entry is always required. |
vol |
An xts object with the trading volume (liquidity) data. The default is |
weighting |
The weighting scheme to be applied. |
weighting.all |
The weighting scheme to be applied to the full market index. |
ic |
Information Criterion to be used for the evaluation of the appropriate index to be used. Possible entries are |
eval.seq |
Indicates how the evaluation of the candidate indices by the ic shall be performed. |
optimum |
Define how to choose the optimal index. Either a |
start.const |
The number of constituents to start constructing the indices with. The default is |
steps |
The step width for the number of constituents to construct the next index from. The default is |
fixed.value |
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, |
base.value |
The starting value for the index. The default is |
derivation.period |
The number of month after which the weights of the index are reallocated. The default is |
derivation.period.ic |
The number of month after which the composition of the index is derived again, thus the number of constituents is reevaluated. The default is |
days.line |
The days of the month to perform the recalculation on. Can be calculated from SwitchDates. |
indexMemberSelection
derives the number of index members for the coming period based on an Information Criterion, e.g. AIC. The methodology is according to Trimborn and Haerdle (2018). The method derives the new weights according to the specifications of the weight reevaluation. The function expects the data period provided to be twice the number of months specified in derivation.period.ic. In case of a mismatch, a warning is given. The data from the first period are used to derived the likelihood, the second period is used for out-of-sample derivation of the number of constituents. Hence for a 3 month reevaluation period, 6 month of data are required by this function. For more details, please see the methodology section of the paper Trimborn and Haerdle (2018).
Returns the number of index members for application in the next period.
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
data(CryptoData) price = price["2016-07-31::2017-01-31"] market = market["2016-07-31::2017-01-31"] vol = vol["2016-07-31::2017-01-31"] days.line = switchDates(price, specificDate = "1") indexMemberSelection(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)
data(CryptoData) price = price["2016-07-31::2017-01-31"] market = market["2016-07-31::2017-01-31"] vol = vol["2016-07-31::2017-01-31"] days.line = switchDates(price, specificDate = "1") indexMemberSelection(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)
indexMembersUpdate
derives the new weights for the coming period. The methodology is according to Trimborn and Haerdle (2018). The method derives the new weights over the data period provided. The data input defines the length of the period, hence it can be different from full month. This function is meant for continuous updating and display of an index on a website. For the derivation of an index for analysis purposes, please refer to the function "indexComp"
.
indexMembersUpdate(market, price, vol, weighting, index.const, last.value)
indexMembersUpdate(market, price, vol, weighting, index.const, last.value)
market |
An xts object with the market capitalization data. The default is |
price |
An xts object with the price data. An entry is always required. |
vol |
An xts object with the trading volume (liquidity) data. The default is |
weighting |
The weighting scheme to be applied. |
index.const |
Number of Index constituents. The number can be derived from |
last.value |
The last index value before rederivation. |
indexMembersUpdate
derives the new weights for the coming period. The methodology is according to Trimborn and Haerdle (2018). The method derives the new weights over the data period provided. The data input defines the length of the period, hence it can be different from full month. For more details, please see the methodology section of the paper Trimborn and Haerdle (2018).
A list, entry 1 is the ordered names of index members, entry 2 the respective consideration of the index constituents, entry 3 the weights of the index members which gives multiplied with entry 2 the actual weight and entry 4 the new divisor of the index.
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
data(CryptoData) price = price["2017-01-01::2017-01-31"] market = market["2017-01-01::2017-01-31"] vol = vol["2017-01-01::2017-01-31"] indexMembersUpdate(market = market, price = price, vol = vol, weighting = "market", index.const = 5, last.value = 1000)
data(CryptoData) price = price["2017-01-01::2017-01-31"] market = market["2017-01-01::2017-01-31"] vol = vol["2017-01-01::2017-01-31"] indexMembersUpdate(market = market, price = price, vol = vol, weighting = "market", index.const = 5, last.value = 1000)
indexUpdate
derives the next values of an Index from the given price, weights and its divisor. This function is meant for continuous updating and display of an index on a website. For the derivation of an index for analysis purposes, please refer to the function "indexComp"
.
indexUpdate(price, index.weights, divisor)
indexUpdate(price, index.weights, divisor)
price |
An xts object with the price data. An entry is always required. |
index.weights |
A vector with the absolute weights expressed as number of shares of each asset. The weights are provided by |
divisor |
The divisor required for the index derivation. The divisor is provided by |
For more details, please see the methodology section of the paper Trimborn and Haerdle (2018).
The next value(s) of the Index.
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
data(CryptoData) const.names = c("btc", "eth", "xrp", "ltc", "xmr") index.weights = c(16136712, 88440036, 36856524148, 49589181, 13859864) divisor = 17185084 indexUpdate(price["2017-02-01", const.names], index.weights = index.weights, divisor = divisor)
data(CryptoData) const.names = c("btc", "eth", "xrp", "ltc", "xmr") index.weights = c(16136712, 88440036, 36856524148, 49589181, 13859864) divisor = 17185084 indexUpdate(price["2017-02-01", const.names], index.weights = index.weights, divisor = divisor)
The dataset contains market capitalization information for cryptocurrencies.
data(CryptoData)
data(CryptoData)
A dataset with a xts matrix. Load the R library xts for proper visualization of the dataset.
The dataset was provided by CoinGecko. Up-to-date data are accessible via https://www.coingecko.com/api.
The dataset contains pricing information for cryptocurrencies.
data(CryptoData)
data(CryptoData)
A dataset with a xts matrix. Load the R library xts for proper visualization of the dataset.
The dataset was provided by CoinGecko. Up-to-date data are accessible via https://www.coingecko.com/api.
relativeWeights
retrieves the relative weights of the assets in the index from the absolute weights expressed in shares of the assets. The latter is a direct output of indexComp
.
relativeWeights(price, index.weights)
relativeWeights(price, index.weights)
price |
An xts object with the price data. An entry is always required. |
index.weights |
A vector with the absolute weights expressed as number of shares of each asset. The weights are provided by |
The relative weights of the assets in the Index.
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
data(CryptoData) const.names = c("btc", "eth", "xrp", "ltc", "xmr") index.weights = c(16136712, 88440036, 36856524148, 49589181, 13859864) relativeWeights(price = price["2017-02-01", const.names], index.weights = index.weights)
data(CryptoData) const.names = c("btc", "eth", "xrp", "ltc", "xmr") index.weights = c(16136712, 88440036, 36856524148, 49589181, 13859864) relativeWeights(price = price["2017-02-01", const.names], index.weights = index.weights)
switchDates
derives the dates on which the index constituents are going to be reevaluated.
switchDates(price, specificDate = NULL, WeekDay = NULL, Appearance = 1)
switchDates(price, specificDate = NULL, WeekDay = NULL, Appearance = 1)
price |
An xts object with the price data. An entry is always required. |
specificDate |
A specific date of each month on which the index members get reevaluated. A common date would be the 1st of each month or the 15th of each month. |
WeekDay |
Only active when |
Appearance |
Defines if the 1st, 2nd or another appearance of a weekday gets returned. E.g. the 3rd Friday of each month can be returned. Only active when |
A vector of class date with the respective dates on which the index members become reevaluated. This is a necessary input to IndexComp
.
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
data(CryptoData) switchDates(price, specificDate = "1")
data(CryptoData) switchDates(price, specificDate = "1")
The dataset contains trading volume information for cryptocurrencies.
data(CryptoData)
data(CryptoData)
A dataset with a xts matrix. Load the R library xts for proper visualization of the dataset.
The dataset was provided by CoinGecko. Up-to-date data are accessible via https://www.coingecko.com/api.