# ecmmvnrstd

Evaluate standard errors for multivariate normal regression model

## Syntax

## Description

`[`

evaluates standard errors for a multivariate normal regression model with missing
data. The model has the form`StdParameters`

,`StdCovariance`

] = ecmmvnrstd(`Data`

,`Design`

,`Covariance`

)

$$Dat{a}_{k}\sim N\left(Desig{n}_{k}\times Parameters,\text{\hspace{0.17em}}Covariance\right)$$

for samples *k* = 1, ... , `NUMSAMPLES`

.

`[`

adds an optional arguments for `StdParameters`

,`StdCovariance`

] = ecmmvnrstd(___,`Method`

,`CovarFormat`

)`Method`

and
`CovarFormat`

.

## Examples

### Compute Standard Errors for Multivariate Normal Regression

This example shows how to compute standard errors for a multivariate normal regression model.

First, load dates, total returns, and ticker symbols for the twelve stocks from the MAT-file.

load CAPMuniverse whos Assets Data Dates

Name Size Bytes Class Attributes Assets 1x14 1568 cell Data 1471x14 164752 double Dates 1471x1 11768 double

Dates = datetime(Dates,'ConvertFrom','datenum');

The assets in the model have the following symbols, where the last two series are proxies for the market and the riskless asset.

Assets(1:14)

`ans = `*1x14 cell*
{'AAPL'} {'AMZN'} {'CSCO'} {'DELL'} {'EBAY'} {'GOOG'} {'HPQ'} {'IBM'} {'INTC'} {'MSFT'} {'ORCL'} {'YHOO'} {'MARKET'} {'CASH'}

The data covers the period from January 1, 2000 to November 7, 2005 with daily total returns. Two stocks in this universe have missing values that are represented by `NaN`

s. One of the two stocks had an IPO during this period and, consequently, has significantly less data than the other stocks.

[Mean,Covariance] = ecmnmle(Data);

Compute separate regressions for each stock, where the stocks with missing data have estimates that reflect their reduced observability.

[NumSamples, NumSeries] = size(Data); NumAssets = NumSeries - 2; StartDate = Dates(1); EndDate = Dates(end); Alpha = NaN(1, length(NumAssets)); Beta = NaN(1, length(NumAssets)); Sigma = NaN(1, length(NumAssets)); StdAlpha = NaN(1, length(NumAssets)); StdBeta = NaN(1, length(NumAssets)); StdSigma = NaN(1, length(NumAssets)); for i = 1:NumAssets % Set up separate asset data and design matrices TestData = zeros(NumSamples,1); TestDesign = zeros(NumSamples,2); TestData(:) = Data(:,i) - Data(:,14); TestDesign(:,1) = 1.0; TestDesign(:,2) = Data(:,13) - Data(:,14); [Param, Covar] = ecmmvnrmle(TestData, TestDesign); % Estimate the sample standard errors for model parameters for each asset. StdParam = ecmmvnrstd(TestData, TestDesign, Covar,'hessian') end

`StdParam = `*2×1*
0.0008
0.0715

`StdParam = `*2×1*
0.0012
0.1000

`StdParam = `*2×1*
0.0008
0.0663

`StdParam = `*2×1*
0.0007
0.0567

`StdParam = `*2×1*
0.0010
0.0836

`StdParam = `*2×1*
0.0014
0.2159

`StdParam = `*2×1*
0.0007
0.0567

`StdParam = `*2×1*
0.0004
0.0376

`StdParam = `*2×1*
0.0007
0.0585

`StdParam = `*2×1*
0.0005
0.0429

`StdParam = `*2×1*
0.0008
0.0709

`StdParam = `*2×1*
0.0010
0.0853

## Input Arguments

`Data`

— Data

matrix

Data, specified as an
`NUMSAMPLES`

-by-`NUMSERIES`

matrix
with `NUMSAMPLES`

samples of a
`NUMSERIES`

-dimensional random vector. Missing values are
indicated by `NaN`

s. Only samples that are entirely
`NaN`

s are ignored. (To ignore samples with at least
one `NaN`

, use `mvnrmle`

.)

**Data Types: **`double`

`Design`

— Design model

matrix | cell array

Design model, specified as a matrix or a cell array that handles two model structures:

If

`NUMSERIES = 1`

,`Design`

is a`NUMSAMPLES`

-by-`NUMPARAMS`

matrix with known values. This structure is the standard form for regression on a single series.If

`NUMSERIES`

≥`1`

,`Design`

is a cell array. The cell array contains either one or`NUMSAMPLES`

cells. Each cell contains a`NUMSERIES`

-by-`NUMPARAMS`

matrix of known values.If

`Design`

has a single cell, it is assumed to have the same`Design`

matrix for each sample. If`Design`

has more than one cell, each cell contains a`Design`

matrix for each sample.

**Data Types: **`double`

| `cell`

`Covariance`

— Estimates for covariance of regression residuals

matrix

Estimates for the covariance of the regression residuals, specified as an
`NUMSERIES`

-by-`NUMSERIES`

matrix.

**Data Types: **`double`

`Method`

— Method of calculation for the information matrix

`'hessian'`

(default) | character vector

(Optional) Method of calculation for the information matrix, specified as a character vector defined as:

`'hessian'`

— The expected Hessian matrix of the observed log-likelihood function. This method is recommended since the resultant standard errors incorporate the increased uncertainties due to missing data.`'fisher'`

— The Fisher information matrix.**Note**If

`Method`

=`'fisher'`

, to obtain more quickly just the standard errors of variance estimates without the standard errors of the covariance estimates, set`CovarFormat`

=`'diagonal'`

regardless of the form of the covariance matrix.

**Data Types: **`char`

`CovarFormat`

— Format for the covariance matrix

`'full'`

(default) | character vector

(Optional) Format for the covariance matrix, specified as a character vector. The choices are:

`'full'`

— Compute the full covariance matrix.`'diagonal'`

— Force the covariance matrix to be a diagonal matrix.

**Data Types: **`char`

## Output Arguments

`StdParameters`

— Standard errors for each element of `Parameters`

vector

Standard errors for each element of `Parameters`

,
returned as an `NUMPARAMS`

-by-`1`

column
vector.

`StdCovariance`

— Standard errors for each element of `Covariance`

matrix

Standard errors for each element of `Covariance`

,
returned as an `NUMSERIES`

-by-`NUMSERIES`

matrix.

## References

[1] Little, Roderick J. A. and
Donald B. Rubin. *Statistical Analysis with Missing Data.* 2nd
Edition. John Wiley & Sons, Inc., 2002.

## Version History

**Introduced in R2006a**

## MATLAB Command

You clicked a link that corresponds to this MATLAB command:

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

## How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

### Americas

- América Latina (Español)
- Canada (English)
- United States (English)

### Europe

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)