# Asset Allocation

**R - datawookie**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

The Two-Fund Separation Theorem introduced by James Tobin, a Nobel Prize-winning economist, is a fundamental concept in investment theory. It addresses how investors can optimally allocate their assets. In an efficient market an optimal portfolio is a combination of a risk-free asset and a market portfolio.

## Asset Allocation

Let’s build a portfolio consisting of Tata Steel and a risk-free asset (which might be government bonds, treasury bills or cash).

Start by building a simple GARCH model for Tata Steel that will enable us to determine how volatility (or risk) changes with time.

specification <- ugarchspec( distribution.model = "norm", mean.model = list(armaOrder = c(0, 0)), variance.model = list(model = "sGARCH") ) fit <- ugarchfit(data = TATASTEEL, spec = specification)

Suppose that we want to target a portfolio with 20% annualised volatility. We’ll use the annualised volatility of Tata Steel to derive the proportion that this stock should form in the portfolio. First we need the annualised volatility.

annualised <- sqrt(252) * sigma(fit)

Now use the inverse of the annualised volatility to find the required proportion of Tata Steel in the portfolio. Since the portfolio will consist of just Tata Steel and a risk-free asset (which by definition has zero volatility), the portfolio volatility depends exclusively on Tata Steel.

weights <- 0.20 / annualised

Now we can compare the weighting of Tata Steel in the portfolio to its annualised volatility. Observe that as the volatility of the stock increases it should form a smaller proportion of the portfolio.

**leave a comment**for the author, please follow the link and comment on their blog:

**R - datawookie**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.