Description Usage Arguments Details Value Note Author(s) References See Also Examples

Finds an optimal portfolio for long-term investments and plots a return distribution.

1 2 3 | ```
portfOptim(i, symbol, yield, vol, beta,
indexVol = 0.2, nStocks = 7, total = 1, balanceInt = 1,
C = 0.05, riskProportion = 1, riskfreeRate = 0, sim = FALSE)
``` |

`i` |
vector of the indices of the included risky investments |

`symbol` |
character vector of the symbols of the risky investments |

`yield` |
vector of expected yields (in euros) |

`vol` |
vector of volatilities |

`beta` |
vector of betas |

`indexVol` |
portfolio index volatility |

`nStocks` |
number of stocks in the portfolio |

`total` |
total sum invested (in euros) |

`balanceInt` |
balancing interval of the portfolio (in years) |

`C` |
expected portfolio return (in euros) |

`riskProportion` |
proportion of risky investments |

`riskfreeRate` |
risk-free interest rate |

`sim` |
is the return distribution simulated and plotted (logical value)? |

The arguments vol, beta, indexVol, riskProportion and riskfreeRate are given in decimals. The portfolio is optimized by minimizing the variance of the portfolio yield for a given expected yield. The returns are assumed to be log-normally distributed. The covariance matrix is computed using the single index model and the properties of the log-normal distribution.

`portfolio` |
numeric vector of allocations to each stock (in euros) |

`returnExpectation` |
expected value of the return distribution (in euros) |

`returnDeviation` |
standard deviation of the return distribution (in euros) |

`VaR` |
0.5%,1%,5%,10% and 50% percentiles of the return distribution (in euros) |

This function is usually called by drawFigure.

Arto Luoma <arto.luoma@wippies.com>

Bodie, Kane, and Marcus (2014) *Investments, 10th Global Edition*, McGraw-Hill Education, (see Section 7.4 The Markowitz Portfolio Optimization Model and Section 8.2 The Single-Index Model).

1 2 3 |

```
Loading required package: rgl
Loading required package: demography
Loading required package: forecast
This is demography 1.22
Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl_init' failed, running with rgl.useNULL = TRUE
3: .onUnload failed in unloadNamespace() for 'rgl', details:
call: fun(...)
error: object 'rgl_quit' not found
4: no DISPLAY variable so Tk is not available
$portfolio
NESTE AM1 KEMIRA METSA METSB
18.6 -18.4 202.5 38.6 -141.3
$returnExpectation
[1] 5
$returnDeviation
[,1]
[1,] 68.77
$VaR
0.5% 1% 5% 10% 50%
-204.864975 -170.250035 -111.388197 -83.078267 5.994019
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.