Minimum Variance Portfolio – R code

This is a rudimentary code for estimating the weights of the minimum variance portfolio. In a later stage, we will generalize for the use of multiple investments.

Still the main difficulty remains the estimation of the expected returns of the investments. For this reason, we can introduce a few asset pricing models (e.g. CAPM, Fama French 3-factor model, Carhart 4-factor model).

## Min Variance Analysis

# clear environment and console
rm(list = ls())
cat("\014")

# inputs assuming 2 investments
r1 = 0.08 # expected return of investment 1
r2 = 0.13 # expected return of investment 2
vol1 = 0.12 # volatility of investment 1
vol2 = 0.2 # volatility of investment 2
correl = 0.3 # correlation of investment 1 and 2

# calculate portfolio weights
w1 = (vol2^2 - correl * vol1 * vol2) / (vol1^2 + vol2^2 - 2 * correl * vol1 * vol2)
w2 = 1 - w1

w1; w2

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s