# mbsconvy

Convexity of mortgage pool given yield

## Syntax

``Convexity = mbsconvy(Yield,Settle,Maturity,IssueDate,GrossRate)``
``Convexity = mbsconvy(___,CouponRate,Delay,PrepaySpeed,PrepayMatrix)``

## Description

example

````Convexity = mbsconvy(Yield,Settle,Maturity,IssueDate,GrossRate)` computes mortgage-backed security convexity, given time information, semiannual mortgage yield, and optionally, a prepayment model.```

example

````Convexity = mbsconvy(___,CouponRate,Delay,PrepaySpeed,PrepayMatrix)` specifies options using one or more optional arguments in addition to the input arguments in the previous syntax.```

## Examples

collapse all

This example shows how to compute the convexity of mortgage pool given yield for a mortgage-backed security with the following characteristics.

```Yield = 0.07125; Settle = '15-Apr-2002'; Maturity = '1 Jan 2030'; IssueDate = '1-Jan-2000'; GrossRate = 0.08125; Speed = 100; CouponRate = 0.075; Delay = 14; Convexity = mbsconvy(Yield, Settle, Maturity, IssueDate, ... GrossRate, CouponRate, Delay, Speed)```
```Convexity = 72.8263 ```

## Input Arguments

collapse all

Mortgage yield, compounded monthly, specified as an `NMBS`-by-`1` vector in decimals.

Data Types: `double`

Settlement dates, specified as an `NMBS`-by-`1` vector of serial date numbers or a cell array of character vectors. `Settle` must be earlier than `Maturity`.

Data Types: `double` | `cell`

Maturity dates, specified as an `NMBS`-by-`1` vector of serial date numbers or a cell array of character vectors.

Data Types: `double` | `cell`

Maturity dates, specified as an `NMBS`-by-`1` vector of serial date numbers or a cell array of character vectors.

Data Types: `double` | `cell`

Gross coupon rate (including fees), specified as an `NMBS`-by-`1` vector of numeric decimals.

Data Types: `double`

(Optional) Net coupon rate, specified as an `NMBS`-by-`1` vector of numeric decimals.

Data Types: `double`

(Optional) Delay in days, specified as an `NMBS`-by-`1` vector.

Data Types: `double`

(Optional) Speed relative to PSA standard, specified as an `NMBS`-by-`1` vector. The PSA standard is `100`.

Note

Set the `PrepaySpeed` to `[]` if you input a customized `PrepayMatrix`.

Data Types: `double`

(Optional) Customized prepayment vector, specified as a `NaN`-padded matrix of size `max(TermRemaining)`-by-`NMBS`. Each column corresponds to each mortgage-backed security, and each row corresponds to each month after settlement.

Note

Use `PrepayMatrix` only when `PrepaySpeed` is unspecified.

Data Types: `double`

## Output Arguments

collapse all

Periodic convexity of mortgage pool, returned as a scalar numeric.

 PSA Uniform Practices, SF-49