Intermediate Portfolio Analysis in R
Ross Bennett
Instructor
Solve a portfolio optimization problem similar to the types of problems in the industry
Apply techniques learned throughout the course
Specify a portfolio with constraints and objectives
Run the optimization with period rebalancing on historical data
Analyze the results
Refine constraints, objectives, and moment estimates
Data
EDHEC-Risk Alternative Indexes monthly returns {6}
Jan 1997 - March 2016
data(indexes) returns <- indexes[,1:4]
# Equal weight benchmark n <- ncol(returns) equal_weights <- rep(1 / n, n) benchmark_returns <- Return.portfolio(R = returns, weights = equal_weights, rebalance_on = "years") colnames(benchmark_returns) <- "benchmark"
# Benchmark performance table.AnnualizedReturns(benchmark_returns)
benchmark
Annualized Return 0.0775
Annualized Std Dev 0.1032
Annualized Sharpe (Rf=0%) 0.7509
Define a portfolio specification to be used as the base case
The base portfolio specification is meant to be a simple approach with relaxed constraints and basic objectives
# Base portfolio specification
base_port_spec <- portfolio.spec(assets = colnames(returns))
base_port_spec <- add.constraint(portfolio = base_port_spec,
type = "full_investment")
base_port_spec <- add.constraint(portfolio = base_port_spec,
type = "long_only")
base_port_spec <- add.objective(portfolio = base_port_spec,
type = "risk", name = "StdDev")
Intermediate Portfolio Analysis in R