Return.portfolio: Calculate weighted returns for a portfolio of assets

Description Usage Arguments Details

Description

Using a time series of returns and any regular or irregular time series of weights for each asset, this function calculates the returns of a portfolio with the same periodicity of the returns data.

Usage

1
2
3
Return.portfolio(R, weights = NULL, wealth.index = FALSE,
  contribution = FALSE, geometric = TRUE, rebalance_on = c(NA, "years",
  "quarters", "months", "weeks", "days"), value = 1, verbose = FALSE, ...)

Arguments

R

An xts, vector, matrix, data frame, timeSeries or zoo object of asset returns

weights

A time series or single-row matrix/vector containing asset weights, as decimal percentages, treated as beginning of period weights. See Details below.

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 a given period. Default FALSE

geometric

utilize geometric chaining (TRUE) or simple/arithmetic (FALSE) to aggregate returns. Default TRUE.

rebalance_on

Default "none"; alternatively "daily" "weekly" "monthly" "annual" to specify calendar-period rebalancing supported by endpoints.

value

The beginning of period total portfolio value. This is used for calculating position value.

verbose

If verbose is TRUE, return a list of intermediary calculations. See Details below.

...

any other passthru parameters. Not currently used.

Details

By default, this function calculates the time series of portfolio returns given asset returns and weights. In verbose mode, the function returns a list of intermediary calculations that users may find helpful, including both asset contribution and asset value through time.

When asset return and weights are matched by period, contribution is simply the weighted return of the asset. c_i = w_i * R_i Contributions are summable across the portfolio to calculate the total portfolio return.

Contribution cannot be aggregated through time. For example, say we have an equal weighted portfolio of five assets with monthly returns. The geometric return of the portfolio over several months won't match any aggregation of the individual contributions of the assets, particularly if any rebalancing was done during the period.

To aggregate contributions through time such that they are summable to the geometric returns of the portfolio, the calculation must track changes in the notional value of the assets and portfolio. For example, contribution during a quarter will be calculated as the change in value of the position through those three months, divided by the original value of the portfolio. Approaching it this way makes the calculation robust to weight changes as well. c_pi = V_(t-p)i - V_t)/V_ti

If the user does not specify weights, an equal weight portfolio is assumed. Alternatively, a vector or single-row matrix of weights that matches the length of the asset columns may be specified. In either case, if no rebalancing period is specified, the weights will be applied at the beginning of the asset time series and no further rebalancing will take place. If a rebalancing period is specified, the portfolio will be rebalanced to the starting weights at the interval specified.

Return.rebalancing will work only on daily or lower frequencies. If you are rebalancing intraday, you should be using a trades/prices framework like


ecjbosu/PerformanceAnalytics documentation built on March 24, 2020, 3:43 a.m.