a matrix or dataframe of portfolio weights. Each row represents a vector of portfolio weights.
grouping
a numeric vector of positive integers taking values from 1 to m, where m is the number of groups. An example is c(1, 1, 2, 3, 2, 3, 1), where m is 3. If grouping is given, the hierachical energy-entropy decomposition will be performed.
plot
TRUE or FALSE. If TRUE, the energy-entropy decomposition will be plotted. The default value is TRUE.
Details
The energy-entropy decomposition decomposes the excess log return of a portfolio (with respect to the benchmark) into three terms: free energy, control and change in relative entropy. See Section 2 of Pal and Wong (2013) for details. It is important to note that Pal and Wong (2013) assumes that the benchmark is a buy-and-hold portfolio, so that market$buy.and.hold is TRUE. The decomposition is modified so that an identity holds even when the market is not buy-and-hold. However in that case the control term in the decomposition is harder to interpret.
A portfolio can sometimes be thought of as a portfolio of portfolios, and the energy-entropy decomposition has a corresponding hierchical decomposition, see Section 3 of Pal and Wong (2013). If grouping is provided, the hierachical decomposition will be performed and plotted. An example of grouping is a label for sectors (say 1: financial, 2: utility, 3:energy, etc). For more details see the supplementary files available on the author's website.
Value
If grouping is not provided, it is a zoo object with the followign columns. The definitions of the terms can be found in Section 2 of Pal and Wong (2013). Each term represents an increment for the period.
Excess log return
relative log return.
Free energy
free energy.
Relative entropy
minus of the change of relative entropy.
Control
control.
Drift
drift. It equals free energy + control.
If grouping is provided, it is a list containing several zoo objects:
dlogV
relative log return.
free.energies
free energy and its decomposition.
relative.entropies
relative entropy and its decomposition.
control
control and its decomposition.
References
Pal, S. and T.-K. L. Wong (2013). Energy, entropy, and arbitrage. arXiv preprint arXiv:1308.5376.
# Example 1
# Energy-entropy decomposition for the entropy-weighted portfolio
data(applestarbucks)
market <- toymkt(applestarbucks, initial.weight = c(0.5, 0.5))
weight <- GetWeight(market, EntropyPortfolio$weight.function)
decomp <- EnergyEntropyDecomp(market, weight, plot = TRUE)
# Example 2
# Example of a hierchical decomposition of the entropy-weighted
# portfolio in the Atlas market model
model <- AtlasModel(n = 6, g = 0.1, sigma = 0.2)
market <- SimMarketModel(model) # default settings
grouping <- c(1, 1, 2, 2, 2, 2)
weight <- GetWeight(market, EntropyPortfolio$weight.function)
decomp <- EnergyEntropyDecomp(market, weight, grouping, plot = TRUE)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(RelValAnalysis)
Loading required package: zoo
Attaching package: 'zoo'
The following objects are masked from 'package:base':
as.Date, as.Date.numeric
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/RelValAnalysis/EnergyEntropyDecomp.Rd_%03d_medium.png", width=480, height=480)
> ### Name: EnergyEntropyDecomp
> ### Title: Energy-entropy Decomposition
> ### Aliases: EnergyEntropyDecomp
>
> ### ** Examples
>
> # Example 1
> # Energy-entropy decomposition for the entropy-weighted portfolio
> data(applestarbucks)
> market <- toymkt(applestarbucks, initial.weight = c(0.5, 0.5))
> weight <- GetWeight(market, EntropyPortfolio$weight.function)
> decomp <- EnergyEntropyDecomp(market, weight, plot = TRUE)
>
>
> # Example 2
> # Example of a hierchical decomposition of the entropy-weighted
> # portfolio in the Atlas market model
> model <- AtlasModel(n = 6, g = 0.1, sigma = 0.2)
> market <- SimMarketModel(model) # default settings
> grouping <- c(1, 1, 2, 2, 2, 2)
> weight <- GetWeight(market, EntropyPortfolio$weight.function)
> decomp <- EnergyEntropyDecomp(market, weight, grouping, plot = TRUE)
>
>
>
>
>
> dev.off()
null device
1
>