| Return.portfolio {PerformanceAnalytics} | R Documentation |
Calculates weighted returns for a portfolio of assets. If you have a single weighting vector, or want the equal weighted portfolio, use Return.portfolio. If you have a portfolio that is periodically rebalanced, and multiple time periods with different weights, use Return.rebalancing. Both functions will subset the return series to only include returns for assets for which weight is provided.
Return.portfolio(R, weights = NULL, wealth.index = FALSE, contribution = FALSE, method = c("compound", "simple"), ...)
Return.rebalancing(R, weights, ...)
R |
an xts, vector, matrix, data frame, timeSeries or zoo object of asset returns |
weights |
a time series or sinlge-row matrix/vector containing asset weights, as percentages |
wealth.index |
TRUE/FALSE whether to return a wealth index, default FALSE |
contribution |
if contribution is TRUE, add the weighted return contributed by the asset in this period |
method |
"simple" or "compound" |
... |
any other passthru parameters |
returns a time series of returns weighted by the weights parameter, possibly including contribution for each period
Brian G. Peterson
Bacon, C. Practical Portfolio Performance Measurement and Attribution. Wiley. 2004. Chapter 2
data(edhec) data(weights) # calculate an equal weighted portfolio return Return.portfolio(edhec) # now return the contribution too Return.portfolio(edhec,contribution=TRUE) # calculate a portfolio return with rebalancing Return.rebalancing(edhec,weights)