# 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.```

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 ```

## 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

If `PortReturn` and `PortRisk` are in dollar units, then `PortValue` should be `1`. If `PortReturn` and `PortRisk` are on a percentage basis, then `PortValue` should be the total value of the portfolio.

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

If `PortValue` is not given, `ValueAtRisk` is presented on a per-unit basis. A value of `0` indicates no losses.