Learn R Programming

stockPortfolio (version 1.2)

portCloud: Plot a portfolio cloud

Description

Given a model with short-selling permitted, portCloud plots a cloud of possible portfolios.

Usage

portCloud(model, riskRange = 2, detail = 25, N = 3000, add = TRUE, col = c("#55550044"), pch = 20, subSamp = 1000, xlim = "default", ylim = "default", xlab = "Risk", ylab = "Return", ...)

Arguments

model
An object of class "stockModel".
riskRange
A factor to specify how large you would like the portfolio cloud to be. If X is the portfolio with minimum risk, then the portfolio cloud will look aesthetically best to approximately risk of riskRange*X.
detail
A parameter that adjusts the appearance of the portfolio cloud. The default value is often adequate.
N
A parameter for the number of portfolios to consider.
add
If TRUE, then the points are added to the plot. If FALSE, a new plot is created.
col
Color of the portfolios in the plot.
pch
Plotting character of the portfolios.
subSamp
The maximum number of portfolios to plot.
xlim
Limits for the x axis. Only applied if add=FALSE.
ylim
Limits for the y axis. Only applied if add=FALSE.
xlab
Label for the x axis. Only applied if add=FALSE.
ylab
Label for the y axis. Only applied if add=FALSE.
...
If add=FALSE, additional arguments for plot. If add=TRUE, additional arguments for points.

Value

A list of the following items:
ports
The portfolios plotted.
R
The estimated return associated with each row of ports.
risk
The estimated risk associated with each row of ports.

Details

Which portfolios are actually plotted is dependent on the portfolio possibilities curve. A number of points along the curve, specified by detail and the stocks themselves are used to produce a relatively uniform looking portfolio cloud.

See Also

stockModel, portPossCurve

Examples

Run this code
data(stock94)
sm <- stockModel(stock94, model='SIM', index=25)
portCloud(sm, add=FALSE)
portPossCurve(sm, 2.5, add=TRUE)

Run the code above in your browser using DataLab