Calculates a given portfolio risk/deviation measure given a set of weights and matrix of returns, possible representing a forecast scenario.

```
riskfun(weights, Data, risk = c("mad", "ev", "minimax", "cvar", "cdar", "lpm"),
benchmark = NULL, alpha = 0.05, moment = 1, threshold = 0, VaR = NULL, DaR = NULL)
```

weights

vector of weights.

Data

Matrix of returns.

risk

Choice of measure.

benchmark

(Optional) vector of benchmark returns with same number of rows as Data.

alpha

The lower quantile for the “cvar” and “cdar” measures.

moment

The “lpm” measure moment.

threshold

The “lpm” measure threshold. A value of 999 will subtract the portfolio mean.

VaR

(Optional) The pre-calculated VaR for the “cvar” measure.

DaR

(Optional) The pre-calculated DaR for the “cdar” measure.

A numeric value representing the risk/deviation measure.

A simple utility function for the calculation and understanding of some of the risk and deviation measures implemented in the package.