# convert2sur

Convert multivariate normal regression model to seemingly unrelated regression (SUR) model

## Syntax

``DesignSUR = convert2sur(Design,Group)``

## Description

example

````DesignSUR = convert2sur(Design,Group)` converts a multivariate normal regression model into a seemingly unrelated regression model with a specified grouping of the data series. ```

## Examples

collapse all

This example shows a CAPM demonstration using 6 stocks and 60 months of simulated asset returns, where the model for each stock is `AssetReturn = Alpha * 1 + CashReturn + Beta * (MarketReturn - CashReturn) + Noise` and the parameters to estimate are `Alpha` and `Beta`.

Using simulated data, where the `Alpha` estimate(s) are displayed in the first row(s) and the `Beta` estimate(s) are display in the second row(s).

```Market = (0.1 - 0.04) + 0.17*randn(60, 1); Asset = (0.1 - 0.04) + 0.35*randn(60, 6); Design = cell(60, 1); for i = 1:60 Design{i} = repmat([ 1, Market(i) ], 6, 1); end```

Obtain the aggregate estimates for all stocks.

```[Param, Covar] = mvnrmle(Asset, Design); disp({'All 6 Assets Combined'});```
``` {'All 6 Assets Combined'} ```
`disp(Param);`
``` 0.0233 0.1050 ```

Estimate parameters for individual stocks using `convert2sur`

```Group = 1:6; DesignSUR = convert2sur(Design, Group); [Param, Covar] = mvnrmle(Asset, DesignSUR); Param = reshape(Param, 2, 6); disp({ 'A', 'B', 'C', 'D', 'E', 'F' });```
``` {'A'} {'B'} {'C'} {'D'} {'E'} {'F'} ```
`disp(Param);`
``` 0.0144 0.0270 0.0046 0.0419 0.0376 0.0291 0.3264 -0.1716 0.3248 -0.0630 -0.0001 0.0637 ```

Estimate parameters for pairs of stocks by forming groups.

`disp({'A & B', 'C & D','E & F'});`
``` {'A & B'} {'C & D'} {'E & F'} ```
```Group = { [1,2 ],[3,4],[5,6]}; DesignSUR = convert2sur(Design, Group); [Param, Covar] = mvnrmle(Asset, DesignSUR); Param = reshape(Param, 2, 3); disp(Param);```
``` 0.0186 0.0190 0.0334 0.0988 0.1757 0.0293 ```

## Input Arguments

collapse all

Data series, specified as a matrix or a cell array that depends on the number of data series `NUMSERIES`.

• If `NUMSERIES = 1`, `convert2sur` returns the `Design` matrix.

• If `NUMSERIES > 1`, `Design` is a cell array with `NUMSAMPLES` cells, where each cell contains a `NUMSERIES`-by-`NUMPARAMS` matrix of known values.

Data Types: `double` | `cell`

Grouping for data series, specified using separate parameters for each group. Specify groups either by series or by groups:

• To identify groups by series, construct an index vector that has `NUMSERIES` elements. Element ```i = 1, ..., NUMSERIES``` in the vector, and has the index `j = 1, ..., NUMGROUPS` of the group in which series i is a member.

• To identify groups by groups, construct a cell array with `NUMGROUPS` elements. Each cell contains a vector with the indexes of the series that populate a given group.

In either case, the number of series is `NUMSERIES` and the number of groups is `NUMGROUPS`, with `1``NUMGROUPS ``NUMSERIES`.

Data Types: `double` | `cell`

## Output Arguments

collapse all

Seemingly unrelated regression model with a specified grouping of the data series, returned as either a matrix or a cell array that depends on the value of `NUMSERIES`.

• If `NUMSERIES = 1`, ```DesignSUR = Design```, which is a `NUMSAMPLES`-by-`NUMPARAMS` matrix.

• If `NUMSERIES > 1` and `NUMGROUPS` groups are to be formed, `Design` is a cell array with `NUMSAMPLES` cells, where each cell contains a `NUMSERIES`-by-```(NUMGROUPS * NUMPARAMS)``` matrix of known values.

The original collection of parameters that are common to all series are replicated to form collections of parameters for each group.