Learn R Programming

stockPortfolio (version 1.2)

portPossCurve: Plot the portfolio possibilities curve

Description

Plot the portfolio possibilities curve or the efficient frontier for models that permit short-selling.

Usage

portPossCurve(model, riskRange = 2, detail = 100, effFrontier = FALSE, add = FALSE, type = "l", xlab = "Risk", ylab = "Expected Return", doNotPlot = FALSE, ...)

Arguments

model
An object of class "stockModel".
riskRange
A parameter to specify how much of the portfolio possibilities curve to plot. If X is the portfolio with minimum risk without respect to the risk free rate, then the portfolio possibilities curve will be shown up to approximately the risk riskRange*X.
detail
The number of points to include on the portfolio possibilities curve. A small number will result a curve that is evidently made up of lines while a large number will provide more detail but takes more memory. The default value is generally adequate.
effFrontier
If TRUE, only the efficient frontier is drawn.
add
If TRUE, the curve is added to a plot. Otherwise a new plot is created.
type
Plotting method. "p" for points, "l" for lines, "b" for both lines and points, and "n" to produce no points or lines.
xlab
Label for the x axis. Only applied if add=FALSE.
ylab
Label for the y axis. Only applied if add=FALSE.
doNotPlot
If FALSE, nothing is plotted. This option may be useful if the points along the curve are of interest and only the values returned by portPossCurve are of interest.
...
If add=FALSE, additional arguments for plot.If add=TRUE, additional arguments for points.

Value

portPossCurve returns a list of the following items:
R
The returns of points along the curve.
risk
The risk of points along the curve.
ports
The portfolios corresponding to R and risk.

Details

If the curve is not smooth, first try decreasing the riskRange. If this is unsuccessful in producing a plot to the detail desired, increase the detail. Generally it is advisable to attempt to adjust the riskRange before adjusting detail.

See Also

stockModel, portCloud

Examples

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

Run the code above in your browser using DataLab