\HeaderA{VaR.Marginal}{Calculate the Marginal VaR of each element of a portfolio}{VaR.Marginal}
\keyword{ts}{VaR.Marginal}
\keyword{multivariate}{VaR.Marginal}
\keyword{distribution}{VaR.Marginal}
\keyword{models}{VaR.Marginal}
\begin{Description}\relax
Marginal VaR is the difference between the VaR of the portfolio without the asset in question and the entire portfolio.  This function calculates Marginal VaR for all instruments in the portfolio.
\end{Description}
\begin{Usage}
\begin{verbatim}
VaR.Marginal(R, p = 0.99, modified = TRUE, weightingvector=NULL)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{R}] a vector, matrix, data frame, timeSeries or zoo object of asset returns or the components 
\item[\code{p}] confidence level for calculation, default p=.99 
\item[\code{modified}] TRUE/FALSE whether to use Cornish-Fisher VaR 
\item[\code{weightingvector}] vector of weights for each element in the portfolio 
\end{ldescription}
\end{Arguments}
\begin{Value}
matrix of Marginal VaRs
\end{Value}
\begin{Note}\relax
Different papers call this different things.  In the Denton and Jayaraman paper referenced here, this calculation is called Incremental VaR.  We have chosen the more common usage of calling this difference in VaR's in portfolios without the instrument and with the instrument as the \dQuote{difference at the Margin}, thus the name Marginal VaR.  This is incredibly confusing, and hasn't been resolved in the literature at this time.
\end{Note}
\begin{Author}\relax
Brian G. Peterson
\end{Author}
\begin{References}\relax
Denton M. and Jayaraman, J.D. Incremental, Marginal, and Component VaR. Sunguard. 2004.
\end{References}
\begin{SeeAlso}\relax
\code{\LinkA{VaR.CornishFisher}{VaR.CornishFisher}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
    data(edhec)
    # construct a weighting vector for an equally weighted portfolio
    assets=dim(edhec)[2]
    eqweight=t(rep(1/assets, assets))
    VaR.Marginal(R=edhec,p=0.99,weightingvector=eqweight)
\end{ExampleCode}
\end{Examples}

