Package 'DOSPortfolio'

Title: Dynamic Optimal Shrinkage Portfolio
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) (<arXiv:2106.02131>). Two dynamic shrinkage estimators are available in this package. One using overlapping samples while the other use nonoverlapping samples.
Authors: Taras Bodnar [aut] , Nestor Parolya [aut] , Erik Thorsén [aut, cre]
Maintainer: Erik Thorsén <[email protected]>
License: GPL-3
Version: 0.1.0
Built: 2025-03-12 05:14:57 UTC
Source: https://github.com/statistics-in-portfolio-theory/dosportfolio

Help Index


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.


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)

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)