Title: Dynamic Optimal Shrinkage Portfolio
Version: 0.1.0
Maintainer: Erik Thorsén <erik.thorsen@math.su.se>
Author: Taras Bodnar ORCID iD [aut], Nestor Parolya ORCID iD [aut], Erik Thorsén ORCID iD [aut, cre]
Description: Constructs dynamic optimal shrinkage estimators for the weights of the global minimum variance portfolio which are reconstructed at given reallocation points as derived in Bodnar, Parolya, and Thorsén (2021) (<doi:10.48550/arXiv.2106.02131>). Two dynamic shrinkage estimators are available in this package. One using overlapping samples while the other use nonoverlapping samples.
License: GPL-3
URL: https://github.com/Statistics-In-Portfolio-Theory/DOSportfolio
Encoding: UTF-8
RdMacros: Rdpack
RoxygenNote: 7.1.1
Depends: R (≥ 3.5.0)
Suggests: knitr, rmarkdown, testthat (≥ 3.0.0), HDShOP
Config/testthat/edition: 3
Imports: Rdpack (≥ 0.7)
VignetteBuilder: knitr
NeedsCompilation: no
Packaged: 2021-09-09 08:27:08 UTC; ethor
Repository: CRAN
Date/Publication: 2021-09-13 07:30:08 UTC

A set of tools for constructing Dynamic Optimal Shrinkage estimator of the global minimum variance portfolio.

Description

The DOSPortfolio package consists of two shrinkage estimators for the Global Minimum Variance (GMV) portfolio. These are implemented in the packages main interface: DOSPortfolio. The shrinkage is performed at fixed reallocation points in a dynamic manner where the sample estimator of the GMV weights is shrunk towards the holding portfolio. The reallocation points are specified by a deterministic sequence given a priori. The estimation is performed such that the shrinkage coefficients are optimal for large portfolios, e.g. there are many assets in comparison to observations. The main interface validates the main assumptions of the theory used to derive these methods.

Methods

DOSPortfolio: (Bodnar et al. 2021)

References

Bodnar T, Parolya N, Thorsén E (2021). “Dynamic Shrinkage Estimation of the High-Dimensional Minimum-Variance Portfolio.” arXiv preprint arXiv:2106.02131. https://arxiv.org/abs/2106.02131.


A helper function for computing beta coefficients used in the case of the overlapping sample (Bodnar et al. 2021)

Description

The function computes the beta coefficients from Eq. (2.20) in Bodnar et al. (2021), which are used in the recursive computation of the dynamic shrinkage estimator of the GMV portfolio weights in the case of overlapping samples.

Usage

ComputeBeta(i, j, Psi)

Arguments

i

an integer greater than one.

j

an integer greater than one.

Psi

vector, the vector of the optimal shrinkage intensities computed in the previous step of the recursion.

Value

a number

References

Bodnar T, Parolya N, Thorsén E (2021). “Dynamic Shrinkage Estimation of the High-Dimensional Minimum-Variance Portfolio.” arXiv preprint arXiv:2106.02131. https://arxiv.org/abs/2106.02131.


A helper function for computing D-coefficients used in the case of the overlapping sample (Bodnar et al. 2021)

Description

The function computes the D_{j,i} coefficients from Eq. (2.21) in Bodnar et al. (2021), which are used in the recursive computation of the dynamic shrinkage estimator of the GMV portfolio weights in the case of overlapping samples.

Usage

ComputeD(Ci, Cj)

Arguments

Ci

a number equal to the concentration ratio of period i

Cj

a number equal to the concentration ratio of period j

Value

a number


Computes a convex combination between two vectors.

Description

Computes a convex combination between two vectors.

Usage

ConvexCombination(x1, x2, lambda)

Arguments

x1

a vector.

x2

a vector.

lambda

a numeric value between 0 and 1.

Value

a vector


The Dynamic Optimal Shrinkage Portfolio interface.

Description

This is the main function to compute the weights of the global minimum variance portfolio by using the dynamic optimal shrinkage estimators presented in Eq. (2.11) and Eq. (2.23) of Bodnar et al. (2021). It implements two different estimators for the shrinkage coefficients, one using overlapping samples (see, Eq. (2.23) of Bodnar et al. (2021)) and one using non-overlapping samples (see, Eq. (2.11) of Bodnar et al. (2021)).

Usage

DOSPortfolio(
  data,
  reallocation_points,
  relative_loss = NULL,
  target_portfolio = rep(1, ncol(data))/ncol(data),
  shrinkage_type = "non-overlapping"
)

Arguments

data

an n by p matrix of asset returns. Columns represent different assets rows are observations, where n>p, containing, for instance, log-returns.

reallocation_points

a vector of reallocation points. The reallocation points determine when the holding portfolio should be reconstructed and its weights should be recomputed.

relative_loss

possibly a numeric or NULL. The initial value of the relative loss in the variance of the target portfolio. If its NULL, then it will be initialized with the first subsample and the function r0Strategy.

target_portfolio

a vector which determines the weights of the target portfolio used when the shrinkage estimator of the global minimum variance portfolio is constructed for the first time.

shrinkage_type

the type of shrinkage estimator to use. The two implemented approaches are "non-overlapping" and "overlapping".

Value

An S3 class which contains the matrix of the constructed weights of the dynamic shrinkage estimator of the global minimum variance portfolio and the type of the shrinkage estimator (i.e., "overlapping" or "non-overlapping") that was used in its construction. Each row of the weight matrix corresponds to the reallocation point and the column corresponds to the asset.

References

Bodnar T, Parolya N, Thorsén E (2021). “Dynamic Shrinkage Estimation of the High-Dimensional Minimum-Variance Portfolio.” arXiv preprint arXiv:2106.02131. https://arxiv.org/abs/2106.02131.

See Also

Section 2.1 and 2.2 of (Bodnar et al. 2021)

Examples

n <- 250*2
p <- 80
c <- p/n
reallocation_points <- c(120, 240)
data <- sqrt(5/3) * matrix(rt(n*p, df=5) , ncol=p, nrow=n)
weights <- DOSPortfolio(data, reallocation_points, 1)

Constructor for the DOSPortfolio class

Description

Constructor for the DOSPortfolio class

Usage

new_DOSPortfolio(
  data,
  reallocation_points,
  target_portfolio,
  relative_loss,
  shrinkage_type
)

Arguments

data

an n by p matrix of asset returns. Columns represent different assets rows are observations, where n>p, containing, for instance, log-returns.

reallocation_points

a vector of reallocation points. The reallocation points determine when the holding portfolio should be reconstructed and its weights should be recomputed.

target_portfolio

a vector which determines the weights of the target portfolio used when the shrinkage estimator of the global minimum variance portfolio is constructed for the first time.

relative_loss

possibly a numeric or NULL. The initial value of the relative loss in the variance of the target portfolio. If its NULL, then it will be initialized with the first subsample and the function r0Strategy.

shrinkage_type

the type of shrinkage estimator to use. The two implemented approaches are "non-overlapping" and "overlapping".

Value

a DOSPortfolio class.


Computes the relative loss of the target portfolio used

Description

The function computes the initial value of the relative loss in the variance of the target portfolio as given in Eq. (2.10) of Bodnar et al. (2021).

Usage

r0Strategy(data, target_portfolio, c)

Arguments

data

an n by p matrix of asset returns. Columns represent different assets rows are observations, where n>p, containing, for instance, log-returns.

target_portfolio

a vector which determines the weights of the target portfolio used when the shrinkage estimator of the global minimum variance portfolio is constructed for the first time.

c

a numeric which is the concentration ratio.

Value

vector

References

Bodnar T, Parolya N, Thorsén E (2021). “Dynamic Shrinkage Estimation of the High-Dimensional Minimum-Variance Portfolio.” arXiv preprint arXiv:2106.02131. https://arxiv.org/abs/2106.02131.

Examples


n <- 200*2
p <- 80
data <- 5/3 * matrix(rt(n*p, df=5), ncol=p, nrow=n)
# set a target portfolio, such as equally weighted
b <- rep(1,p)/p
r0Strategy(data, b, p/n)


The recursive estimation for updating the relative loss in the variance of the holding portfolio.

Description

This function implements equation (2.19), the recursive estimation for updating the relative loss in the variance of the holding portfolio in the overlapping scheme.

Usage

rUpdateOverlapping(Psi, c, prev_R, K)

Arguments

Psi

a vector of shrinkage coefficients.

c

a numeric between 0 and 1. It is the concentration ration.

prev_R

a numeric greater than 0, the previous value of the relative loss

K

a numeric parameter.

Value

a number


Validates input to the DOSPortfolio function.

Description

This function validates the assumptions made to derive the analytic formulas implemented in the different functions of the package. It is called for its side-effects.

Usage

validate_input(
  data,
  reallocation_points,
  target_portfolio,
  relative_loss,
  shrinkage_type
)

Arguments

data

an n by p matrix of asset returns. Columns represent different assets rows are observations, where n>p, containing, for instance, log-returns.

reallocation_points

a vector of reallocation points. The reallocation points determine when the holding portfolio should be reconstructed and its weights should be recomputed.

target_portfolio

a vector which determines the weights of the target portfolio used when the shrinkage estimator of the global minimum variance portfolio is constructed for the first time.

relative_loss

possibly a numeric or NULL. The initial value of the relative loss in the variance of the target portfolio. If its NULL, then it will be initialized with the first subsample and the function r0Strategy.

shrinkage_type

the type of shrinkage estimator to use. The two implemented approaches are "non-overlapping" and "overlapping".

Value

NULL, only called for its side effects


Sample estimator of the weights of the global minimum variance portfolio

Description

The functions computes the sample estimate of the weights of the global minimum variance portfolio (see, e.g., Eq. (1.4) of Bodnar et al. (2021))).

Usage

wGMV(data)

Arguments

data

an n by p matrix of asset returns. Columns represent different assets rows are observations, where n>p, containing, for instance, log-returns.

Value

a vector, which is the Global Minimum Variance Portfolio.

Examples


n <- 200
p <- 80
data <- 3/5 * matrix(rt(n*p, df=5), ncol=p, nrow=n)
weights <- wGMV(data)
# since the covariance matrix is the identity-matrix the estimated weights
# should be close to the equally weighted portfolio.
mean(abs(wGMV(data) - 1/p))


Dynamic optimal shrinkage estimator of the weights of the global minimum variance portfolio when non-overlapping samples are used.

Description

The function implements the dynamic shrinkage estimator of the weights of the global minimum-variance portfolio when the overlapping samples are used as given in Eq. (2.11) of Bodnar et al. (2021) .

Usage

wGMVNonOverlapping(data, reallocation_points, target_portfolio, relative_loss)

Arguments

data

an n by p matrix of asset returns. Columns represent different assets rows are observations, where n>p, containing, for instance, log-returns.

reallocation_points

a vector of reallocation points. The reallocation points determine when the holding portfolio should be reconstructed and it is weights should be recomputed.

target_portfolio

a vector which determines the weights of the target portfolio used when the shrinkage estimator of the global minimum variance portfolio is constructed for the first time.

relative_loss

possibly a numeric or NULL. The initial value of the relative loss in the variance of the target portfolio. If it is NULL, then it will be initialized with the first subsample and the function r0Strategy.

Value

a matrix of the constructed weights at each reallocation point of the dynamic shrinkage estimator of the global minimum variance portfolio when non-overlapping samples are used.

References

Bodnar T, Parolya N, Thorsén E (2021). “Dynamic Shrinkage Estimation of the High-Dimensional Minimum-Variance Portfolio.” arXiv preprint arXiv:2106.02131. https://arxiv.org/abs/2106.02131.

See Also

section 2.1 (Bodnar et al. 2021)

Examples

n <- 200*2
p <- 80
reallocation_point <- c(199)
data <- 3/5 * matrix(rt(n*p, df=5), ncol=p, nrow=n)
target_portfolio <- as.vector(rep(1,p))/p
wGMVNonOverlapping(data, reallocation_point, target_portfolio, 1)

Dynamic optimal shrinkage estimator of the weights of the global minimum variance portfolio when overlapping samples are used.

Description

The function implements the dynamic shrinkage estimator of the weights of the global minimum-variance portfolio when the overlapping samples are used as given in Eq. (2.23) of Bodnar et al. (2021).

Usage

wGMVOverlapping(data, reallocation_points, target_portfolio, relative_loss)

Arguments

data

an n by p matrix of asset returns. Columns represent different assets rows are observations, where n>p, containing, for instance, log-returns.

reallocation_points

a vector of reallocation points. The reallocation points determine when the holding portfolio should be reconstructed and it is weights should be recomputed.

target_portfolio

a vector which determines the weights of the target portfolio used when the shrinkage estimator of the global minimum variance portfolio is constructed for the first time.

relative_loss

possibly a numeric or NULL. The initial value of the relative loss in the variance of the target portfolio. If it is NULL, then it will be initialized with the first subsample and the function r0Strategy.

Value

a matrix of the constructed weights at each reallocation point of the dynamic shrinkage estimator of the global minimum variance portfolio when overlapping samples are used.

References

Bodnar T, Parolya N, Thorsén E (2021). “Dynamic Shrinkage Estimation of the High-Dimensional Minimum-Variance Portfolio.” arXiv preprint arXiv:2106.02131. https://arxiv.org/abs/2106.02131.

See Also

wGMVNonOverlapping

Examples

n <- 200*2
p <- 80
reallocation_points <- c(199)
data <- matrix(rt(n*p, df=5), ncol=p, nrow=n)
target_portfolio <- as.vector(rep(1,p))/p
wGMVOverlapping(data, reallocation_points, target_portfolio, 1)