# portvrisk

Portfolio value at risk (VaR)

## Syntax

``ValueAtRisk = portvrisk(PortReturn,PortRisk)``
``ValueAtRisk = portvrisk(___,RiskThreshold,PortValue)``

## Description

example

````ValueAtRisk = portvrisk(PortReturn,PortRisk)` returns the maximum potential loss in the value of a portfolio over one period of time (that is, monthly, quarterly, yearly, and so on) given the loss probability level. `portvrisk` calculates `ValueAtRisk` using a normal distribution. NoteAn alternative for portfolio optimization is to use the `Portfolio` object for mean-variance portfolio optimization. This object supports gross or net portfolio returns as the return proxy, the variance of portfolio returns as the risk proxy, and a portfolio set that is any combination of the specified constraints to form a portfolio set. For information on the workflow when using `Portfolio` objects, see Portfolio Object Workflow. ```

example

````ValueAtRisk = portvrisk(___,RiskThreshold,PortValue)` adds optional arguments for `RiskThreshold` and `PortValue`.```

## Examples

collapse all

This example shows how to return the maximum potential loss in the value of a portfolio over one period of time, where `ValueAtRisk` is computed on a per-unit basis.

```PortReturn = 0.29/100; PortRisk = 3.08/100; RiskThreshold = [0.01;0.05;0.10]; PortValue = 1; ValueAtRisk = portvrisk(PortReturn,PortRisk,... RiskThreshold,PortValue)```
```ValueAtRisk = 3×1 0.0688 0.0478 0.0366 ```

This example shows how to return the maximum potential loss in the value of a portfolio over one period of time, where `ValueAtRisk` is computed with actual values.

```PortReturn = [0.29/100;0.30/100]; PortRisk = [3.08/100;3.15/100]; RiskThreshold = 0.10; PortValue = [1000000000;500000000]; ValueAtRisk = portvrisk(PortReturn,PortRisk,... RiskThreshold,PortValue)```
```ValueAtRisk = 2×1 107 × 3.6572 1.8684 ```

This example shows how to return the maximum potential loss in the value of a portfolio over one period of time, where the portfolio return (`PortReturn`) and risk (`PortRisk`) are specified in dollar units. The returned `ValueAtRisk` is also in dollar units. Note that the `PortValue` input for `portvrisk` is not used in this example. `PortValue` is only used as a scaling factor to convert from percent to dollars when `PortReturn` and `PortRisk` are specified on a percentage basis.

```PortReturn = [2900000;1500000]; PortRisk = [30800000;15750000]; RiskThreshold = 0.10; ValueAtRisk = portvrisk(PortReturn,PortRisk,RiskThreshold)```
```ValueAtRisk = 2×1 107 × 3.6572 1.8684 ```

## Input Arguments

collapse all

Expected return of each portfolio over the period, specified as a scalar numeric or an `NPORTS`-by-`1` vector.

Data Types: `double`

Standard deviation of each portfolio over period, specified as a scalar numeric or `NPORTS`-by-`1` vector.

Data Types: `double`

(Optional) Loss probability, specified as a scalar decimal or an `NPORTS`-by-`1` vector.

Data Types: `double`

(Optional) Total value of asset portfolio, specified as a scalar numeric or an `NPORTS`-by-`1` vector.

Note

The `PortValue` input is used as a scaling factor for `ValueAtRisk`. The `ValueAtRisk` output is computed using the `PortReturn` and `PortRisk` inputs first, and then scaled by `PortValue`. Therefore, if you specify `PortValue` in dollar units, then `PortReturn` and `PortRisk` must be given on a percentage basis. Conversely, when `PortReturn` and `PortRisk` are specified in dollar units,` PortValue` must be `1` (default value).

Data Types: `double`

## Output Arguments

collapse all

Estimated maximum loss in the portfolio, returned as an `NPORTS`-by-`1` vector. `ValueAtRisk` is predicted with a confidence probability of `1``RiskThreshold`.

Note

When `PortValue` is the default value of `1`, `ValueAtRisk` is presented as a percent. A value of `0` for `ValueAtRisk` indicates no losses.

## Version History

Introduced before R2006a