Learn R Programming

fPortfolio (version 260.72)

PortfolioPlots: Portfolio Plots

Description

A collection and description of plot functions. Included are weights, frontier, and related plots, as well as covariance ellipses plots. The functions are:

ll{ frontierPlot Plots efficient frontier, weightsPlot Plots staggered weights, attributesPlot Plots weighted means, covRiskBudgetsPlot Plots covariance risk budgets, tailRiskBudgetsPlot Plots tail risk budgets, weightsPie Plots staggered weights, attributesPie Plots weighted means, covRiskBudgetPie Plots weighted risks, tailRiskBudgetPie Plots weighted risks, covEllipsesPlot Plots covariance ellipses. }

Usage

frontierPlot(object, frontier = c("both", "lower", "upper"),
    col = c("black", "grey"), add = FALSE, ...)
    
weightsPlot(object, col = NULL, legend = TRUE)
attributesPlot(object, col = NULL, legend = TRUE)
covRiskBudgetsPlot(object, col = NULL, legend = TRUE)
tailRiskBudgetsPlot(object, col = NULL, legend = TRUE)

weightsPie(object, pos = NULL, col = NULL, box = TRUE, legend = TRUE) attributesPie(object, pos = NULL, col = NULL, box = TRUE, legend = TRUE) covRiskBudgetsPie(object, pos = NULL, col = NULL, box = TRUE, legend = TRUE) tailRiskBudgetsPie(object, pos = NULL, col = NULL, box = TRUE, legend = TRUE)

covEllipsesPlot(x = list(), ...)

Arguments

add
[frontierPlot] - a logical value, determining whether the frontier should be added to an existing plot, by default FALSE.
box
[weightsPie] - a logical value, determining whether a frame (box) should be plotted around the pie, by default TRUE.
col
a character string vector, setting the color. For frontierPlot it is a two dimensional a vector; first entry is the upper part of the frontier, second entry the lower, by default "black" and "grey". For the other functions th
frontier
[frontierPlot] - a character string, determining which part of the frontier should be extracted. "both" stands for the full hyperbola, "lower" for all points below the minimum variance return and "upper"
legend
[*Pie][*Plot] - a numeric value, determining the position on the efficient frontier plotting the pie, by default NULL, i.e. expecting a object having only one set of weights like the tangency portfolio.
pos
[*Pie] - a logical value, determining whether a legend with the names of the assets should be plotted, by default TRUE.
object
an S4 object of class fPORTFOLIO, containing slots call, data, specification, constraints, portfolio, title, description.
x
[covEllipsesPlot] - a list of at least two covariance matrices.
...
[covEllipsesPlot] - optional arguments to be passed.

Details

Frontier Plot: The frontier plot provides plotting three parts of the efficient frontier. The part superior to the minimum variance portfolio is plotted with argument frontier = "upper". The part below is plotted with "lower". Both parts are plotted with "both", which is default. The ranges of plots are determined by maximum of the ranges of the assets or the minimum and maximum of the efficient frontier. Adding an efficient frontier to an existing plot is possible with the argument add. The argument col determines the color of the upper and lower part of the efficient frontier. Weights, Attributes, and Risk Budgets Plots: These plotds give a view on three different views related to the weights of the frontier. This concern the constitution of the weights, the weights attributes and of the risk budgets. A vertical line indicates the minimum variance portfolio. The weights plot displays staggered weights, while the attributes plot shows the mean return weighted weights of the portfolio, i.e. the real return. The risk budget plot shows the risk weighted weights. Covariance Ellipses Plot: This plot visualizes the difference between two or more covariance matrices. It is meant to compare different methods of covariance estimation.

See Also

PortfolioData, PortfolioSpec, PortfolioConstraints, fPORTFOLIO.

Examples

Run this code
## portfolioFrontier -
   # Load Data:
   Data = as.timeSeries(data(smallcap.ts))
   Data = Data[, c("BKE", "GG", "GYMB", "KRON")]
   Data
   # Compute Long Only Efficient Frontier
   frontier = portfolioFrontier(Data)
   frontier
   
## frontierPlot -  
   # Plot Upper Part of Frontier:
   # frontierPlot(frontier, frontier = "upper")
   # Adding Lower Part to Plot
   # frontierPlot(frontier, frontier = "lower", add = TRUE)
    
## weightsPlot -
   # View Weights Plot:
   # weightsPlot(frontier)
    
## attributesPlot -
   # View Attributes Plot:
   # attributesPlot(frontier, legend = TRUE)

Run the code above in your browser using DataLab