plotPerformance {tawny}R Documentation

Calculate some portfolio statistics and compare with other portfolios or benchmarks

Description

The group of compare.* functions plot the performance of additional benchmarks such as an equal weighted portfolio over the same time period or a benchmark market (e.g. DJIA or S&P500).

Usage

portfolioReturns(h, weights)

portfolioPerformance(p, rf.rate = 0.01)

plotPerformance(h, weights, window = NULL, rf.rate = 0.01, new.plot = TRUE, y.min = -0.25, y.max = 0.25, bg = NULL, name = "", color = "red", colors = c(), ...)

compare.EqualWeighted(h, window, color = "#342a31", ...)

compare.Market(market, obs, window, end = Sys.Date(), color = "#44bc43", ...)

Arguments

h Asset returns as used elsewhere in this package
p Portfolio returns (h %*% weights)
weights Portfolio weights over the given time period
window Size of window used in other calculations
obs Number of observations to retrieve
end End date of data to retrieve
rf.rate A risk free rate to use when calculating the sharpe ratio
new.plot Pass-through to new in plot
y.min Minimum y value for plot
y.max Maximum y value for plot
bg
name The name of the series to use in the legend
color Color of the plot
colors Current colors (and names) of lines plotted on the chart
market A string or zoo/xts object representing the market to use
... Additional parameters to plot/lines

Details

These functions are provided to assist in the analysis of the resultant portfolio weights generated by the package. The function plotPerformance plots the performance of a portfolio and calculates basic statistics. For more detailed analysis, use a specialized package such as PerformanceAnalytics.

The equal weighted portfolio is simply the same portfolio weight for each asset in the specified portfolio. For this to be meaningful, the same portfolio and window are passed into the function as with the optimizePortfolio call thus ensuring that the equal weighted portfolio and corresponding returns are constructed correctly.

When comparing to the market portfolio, the number of observations need to be specified again so the market portfolio and corresponding returns are constructed properly.

Value

A list of portfolio statistics.

returns The daily portfolio returns
perf Cumulative return over time period
stdev Standard deviation of portfolio over time period
avg.return Average return of portfolio
sharpe.ratio Sharpe ratio of portfolio

Author(s)

Brian Lee Yung Rowe

Examples

data(sp500.subset)
ys <- sp500.subset
ws <- optimizePortfolio(ys, 150, getCorFilter.RMT())
plotPerformance(ys, ws, 150)
compare.EqualWeighted(ys, 150)
compare.Market('^GSPC', 200, 150)

[Package tawny version 1.1.0 Index]