MarkowitzPortfolio {fPortfolio} | R Documentation |
A collection and description of functions to
investigate the efficient frontier for a
Markowitz portfolio from a given return
series in the mean-variance sense when short
selling is forbidden. Tangency, equal weigths,
and Monte Carlo portfolios can also be evaluated.
The functions are:
portfolioMarkowitz | Optimize mean variance Markowitz portfolio, |
frontierMarkowitz | computes efficient frontier of portfolio, |
montecarloMarkowitz | creates randomly created portfolios. |
portfolioMarkowitz(x, targetReturn, title = NULL, description = NULL) frontierMarkowitz(x, Rf = 0, length = 300, r.range = NULL, s.range = NULL, title = NULL, description = NULL, ...) montecarloMarkowitz(object, mc = 5000, doplot = FALSE, add = TRUE, ...) ## S3 method for class 'fPFOLIO': print(x, ...) ## S3 method for class 'fPFOLIO': plot(x, alpha = 0.05, mc = 500, which = "ask", ...) ## S3 method for class 'fPFOLIO': summary(object, ...)
alpha |
a numeric value, the confidence interval, by default 0.05. |
description |
[portfolioMarkowitz][frontierMarkowitz] - a character string, assigning a brief description to an "fPFOLIO" object.
|
doplot, add |
[frontierMarkowitz] - logical values. Should the results be plotted and/or added to the frontier plot? |
length |
[frontierMarkowitz] - the number of equidistand return points on the efficient frontier. |
mc |
the number of Monte Carlo portfolios. |
method |
[portfolioMarkowitz] - the optimization method. |
object |
a object of class "fPFOLIO" representing a portfolio.
A list with with elemets listed in the "Value" section.
|
r.range, s.range |
[frontierMarkowitz] - the range of returns and standardard deviations on the efficient frontier. If set to NULL , the default
value, then the whole efficient frontier will be investigated.
|
Rf |
[frontierMarkowitz] - the number of random portfolios to be generated. |
targetReturn |
[portfolioMarkowitz] - the target return, a numeric value. |
title |
[portfolioMarkowitz][frontierMarkowitz] - a character string, assigning a title to an "fPFOLIO"
object.
|
which |
which of the five plots should be displayed? which can
be either a character string, "all" (displays all plots)
or "ask" (interactively asks which one to display), or a
vector of 6 logical values, for those elements which are set
TRUE the correponding plot will be displayed.
|
x |
[frontierMarkowitz] - a numeric matrix or multivariate time series consisting of a series of returns. [print][plot] - an object of class "fPFOLIO" representing a portfolio.
A list with with elemets listed in the "Value" section.
|
... |
parameters to be passed. |
portfolioMarkowitz
frontierMarkowitz
return a S4 object class of class "fPFOLIO"
, with the following
slots:
@call |
the matched function call. |
@data |
the input data in form of a data.frame. |
@description |
allows for a brief project description. |
@pfolio |
the results as a list returned from the underlying optimization process. |
@method |
the selected method used by the optimization algorithm, here "Quadratic Programming". |
@model |
the model used for the optimization, here "Mean variance Portfolio Optimization". |
@title |
a title string. |
pm, ps |
the portfolios mean (the return) and standard deviation (the risk) values . |
returns, cov |
the returns vector and the covariance matrix of the assets. |
r.range, s.range |
the range of returns and of the standard deviations on the efficient frontier. |
Rf |
the risk free rate. |
Rm, Sm |
return and standard deviation of the tangency portfolio. |
t.weights |
the weights of the tangency portfolio. |
Rew, Sew |
Return and standard deviation of the equal weights portfolio. |
diversification |
the number of assets contributing with more than one percent to the efficient frontier portfolio as function of expected returns. |
montecarloMarkowitz
is a functions which adds random generated portfolios to frontier
plot.
print
is the S3 print method for objects of class "fPFOLIO"
returned
from the function mvFit
. If shows a summary report of
the optimization results.
plot
is the S3 plot method for objects of class "fPFOLIO"
. Six plots
are produced.
The first plot produces a Risk-Return-Graph with the individual assets,
the efficient frontier, the market line, tangency portfolio and the
equal weights portfolio.
The second plot is the same as the first, however, the risk and return
values for random generated portfolios are added.
The third plot generates a pie chart of weights for the tangency
portfolio.
The third plot generates a pie chart of weights for the tangency
portfolio.
The fourth plot shows the effect of diversification.
The fivth plot shows the cumulated returns for the tangency
portfolio.
The sixth plot shows a histogram of the tangency portfolio returns
together with the maximum loss, the condition Value-at-Risk and the
upper CVaR.
summary
is the S3 summary method for objects of class "fPFOLIO"
. The
summary method prints and plots in one step the results as done by
the print
and plot
methods.
Diethelm Wuertz for the Rmetrics port.
Elton E.J., Gruber M.J. (1991); Modern Portfolio Theory and Investment Analysis, 4th Edition, Wiley, NY, pp. 65–93.
Huang C.J., Litzenberger R.H. (1988); Foundations for Financial Economics, Elsevier, NY, pp. 59–82.
## SOURCE("fPortfolio.B2-MarkowitzPortfolio") ## Not run: ## berndtInvest - data(berndtInvest) # Exclude Date, Market and Interest Rate columns from data frame, # then multiply by 100 for percentual returns ... berndtAssets = berndtInvest[, -c(1, 11, 18)] rownames(berndtAssets) = berndtInvest[, 1] head(berndtAssets) ## portfolioMarkowitz - myPortfolio = portfolioMarkowitz(x = berndtAssets, targetReturn = 20/100/12) print(myPortfolio) ## pfolioTargetReturn - ## pfolioTargetRisk - pfolioTargetReturn(x = berndtAssets, weights = myPortfolio@pfolio$pw) pfolioTargetRisk(x = berndtAssets, weights = myPortfolio@pfolio$pw) ## End(Not run)