# tangency.portfolio: Compute tangency portfolio In IntroCompFinR: Introduction to Computational Finance in R

## Description

Compute tangency (maximum Sharpe ratio) portfolio. The portfolio can allow all assets to be shorted or not allow any assets to be shorted.

## Usage

 `1` ```tangency.portfolio(er, cov.mat, risk.free, shorts = TRUE) ```

## Arguments

 `er` N x 1 vector of expected returns `cov.mat` N x N return covariance matrix `risk.free` numeric, risk free rate `shorts` logical, if TRUE then short sales (negative portfolio weights) are allowed. If FALSE then no asset is allowed to be sold short.

## Details

The tangency portfolio t is the portfolio of risky assets with the highest Sharpe's slope and solves the optimization problem: max (t(t)μ-r_f)/(t(t)Σ t^{1/2}) s.t. t(t)1=1 where r_f denotes the risk-free rate. If short sales are allowed then there is an analytic solution using matrix algebra. If short sales are not allowed then the maximum Sharpe ratio portfolio must be computed numerically.

## Value

 `call` captures function call `er` portfolio expected return `sd` portfolio standard deviation `weights` N x 1 vector of portfolio weights

Eric Zivot

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22``` ```# construct the data asset.names = c("MSFT", "NORD", "SBUX") er = c(0.0427, 0.0015, 0.0285) names(er) = asset.names covmat = matrix(c(0.0100, 0.0018, 0.0011, 0.0018, 0.0109, 0.0026, 0.0011, 0.0026, 0.0199), nrow=3, ncol=3) r.free = 0.005 dimnames(covmat) = list(asset.names, asset.names) # compute tangency portfolio tan.port <- tangency.portfolio(er, covmat, r.free) tan.port summary(tan.port, risk.free=r.free) plot(tan.port, col="blue") # compute tangency portfolio with no short sales tan.port.ns <- tangency.portfolio(er, covmat, r.free, shorts=FALSE) tan.port.ns summary(tan.port.ns, risk.free=r.free) plot(tan.port.ns, col="blue") ```

IntroCompFinR documentation built on May 31, 2017, 2:01 a.m.