Learn R Programming

AssetAllocation (version 1.1.1)

min_variance: Returns minimum variance portfolio weights on a given date

Description

min_variance determines asset allocations that minimize the variance of aportfolio.

Usage

min_variance(strat, reb_date, P, R, risk_free = NULL)

Value

A numeric vector of weights after applying the rule.

Arguments

strat

A list representing an asset allocation strategy.

reb_date

A date on which the allocation rule is applied.

P

An xts object with daily prices of the tickers in strat.

R

An xts object with daily returns of the tickers in strat.

risk_free

Either an xts object with daily returns of the risk-free asset, or a scalar numeric with the annual risk-free rate in decimals.

Details

The function calculates the covariance matrix of returns using the last two years (or minimum of one year) of daily returns. It relies on the minvar function from the NMOF package.

Examples

Run this code
ivy  <- asset_allocations$tactical$ivy
reb_date <- as.Date("2022-03-31")
risk_parity(ivy, reb_date, ETFs$Prices[, ivy$tickers], ETFs$Returns[, ivy$tickers])

Run the code above in your browser using DataLab