Learn R Programming

fPortfolio (version 260.72)

PortfolioSlider: Portfolio Slider

Description

Pop ups interactive plots onportfolio weights and the portfolio frontier. The functions are: ll{ frontierSlider starts the efficient frontier Slider, weightsSlider starts the weights slider. }

Usage

frontierSlider(object, control = list(), ...)
weightsSlider(object, control = list(), ...)

Arguments

control
a list, defining the plotting parameters. The list modifies amongst others the color, e.g. minvariance.col, type of point, e.g. tangency.pch, or the dimension of the point, e.g. cml.cex, see
object
an S4 object of class fPORTFOLIO.
...
optional arguments to be passed.

Value

  • Creates interactive plots.

Details

The sliders have illustrative objectives. The functions expect an S4 object of class fPortfolio. frontierSlider: With the frontier slider it is possible to slide over the efficient frontier. Risk and return of the current portfolio is plotted in the title. The frontier slider has several addable plot features listed in the following. Little pies at the current portfolio showing the weights (left pie) and/or the attributed weights (right pie), legend, minimum variance portfolio, tangency portfolio, market portfolio with capital market line (risk free rate is slidable), Sharpe ratio plot, equal weights portfolio, single asset portfolios, two assets short selling efficient frontier, Monte Carlo portfolios (number is sliderable in a range from 0 to 25000). weightsSlider: The weights slider gives an overview of the weights on the efficient frontier. Three weight plots weightsPlot, piePlot and the not stacked weights and a frontier plot with the single assets, the tangency portfolio and a legend are provided. In the two weights plots the vertical line indicates the current portfolio and a dotted one indicates the minimum variance portfolio. The number in the pie plot stands for the asset and the sign shows whether this asset is short or long. In all plots colors represent the same asset.

See Also

PortfolioClass, PortfolioData, PortfolioSpec, PortfolioConstraints, PortfolioPlots.

Examples

Run this code
## minvariancePortfolio -
   # Load Data and Convert to timeSeries Object:
   Data = as.timeSeries(data(smallcap.ts))
   Data = Data[, c("BKE", "GG", "GYMB", "KRON")]
   Data
   # Set Default Specifications:
   Spec = portfolioSpec()
   Spec
   # Allow for unlimited Short Selling:
   Constraints = "Short"
   # Compute Short Selling Minimum Variance Portfolio
   minvariancePortfolio(Data, Spec, Constraints)
    
## portfolioFrontier -
   # Modify Constraints - Now Long Only Constraints:
   Constraint = c("minW[1:nAssets]=0")
   # Calculation of the Efficient Frontier
   frontier = portfolioFrontier(Data, Spec, Constraint)
   print(frontier)
    
## frontierSlider -
   # Try Frontier Slider:
   # frontierSlider(frontier)

## weightsSlider -
   # Try Weights Slider:
   # weightsSlider(frontier)

Run the code above in your browser using DataLab