\HeaderA{Return.portfolio}{Calculates weighted returns for a portfolio of assets}{Return.portfolio}
\aliasA{Return.rebalancing}{Return.portfolio}{Return.rebalancing}
\keyword{ts}{Return.portfolio}
\keyword{multivariate}{Return.portfolio}
\keyword{distribution}{Return.portfolio}
\keyword{models}{Return.portfolio}
\begin{Description}\relax
Calculates weighted returns for a portfolio of assets.  If you have a single weighting vector, or want the equal weighted portfolio, use \code{Return.portfolio}.  If you have a portfolio that is periodically rebalanced, and multiple time periods with different weights, use \code{Return.rebalancing}.  Both functions will subset the return series to only include returns for assets for which \code{weight} is provided.
\end{Description}
\begin{Usage}
\begin{verbatim}
Return.portfolio(R, weights = NULL, wealth.index = FALSE, contribution = FALSE, method = c("compound", "simple"), ...)
Return.rebalancing(R, weights, ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{R}] an xts, vector, matrix, data frame, timeSeries or zoo object of asset returns 
\item[\code{weights}] a time series or sinlge-row matrix/vector containing asset weights, as percentages
\item[\code{wealth.index}] TRUE/FALSE whether to return a wealth index, default FALSE
\item[\code{contribution}] if contribution is TRUE, add the weighted return contributed by the asset in this period
\item[\code{method}] "simple" or "compound"
\item[\code{...}] any other passthru parameters 
\end{ldescription}
\end{Arguments}
\begin{Value}
returns a time series of returns weighted by the \code{weights} parameter, possibly including contribution for each period
\end{Value}
\begin{Author}\relax
Brian G. Peterson
\end{Author}
\begin{References}\relax
Bacon, C. \emph{Practical Portfolio Performance Measurement and Attribution}. Wiley. 2004. Chapter 2\\
\end{References}
\begin{SeeAlso}\relax
\code{\LinkA{Return.calculate}{Return.calculate}} \\
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}

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)

\end{ExampleCode}
\end{Examples}

