# ecmmvnrstd

Evaluate standard errors for multivariate normal regression model

## Description

example

[StdParameters,StdCovariance] = ecmmvnrstd(Data,Design,Covariance) evaluates standard errors for a multivariate normal regression model with missing data. The model has the form

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

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

example

[StdParameters,StdCovariance] = ecmmvnrstd(___,Method,CovarFormat) adds an optional arguments for Method and CovarFormat.

## Examples

collapse all

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.

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 NaNs. 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

collapse all

Data, specified as an NUMSAMPLES-by-NUMSERIES matrix with NUMSAMPLES samples of a NUMSERIES-dimensional random vector. Missing values are indicated by NaNs. Only samples that are entirely NaNs are ignored. (To ignore samples with at least one NaN, use mvnrmle.)

Data Types: double

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 NUMSERIES1, 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

Estimates for the covariance of the regression residuals, specified as an NUMSERIES-by-NUMSERIES matrix.

Data Types: double

(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

(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

collapse all

Standard errors for each element of Parameters, returned as an NUMPARAMS-by-1 column vector.

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