ecmnstd

Standard errors for mean and covariance of incomplete data

Syntax

``[StdMean,StdCovar] = ecmnstd(Data,Mean,Covariance)``
``[StdMean,StdCovar] = ecmnstd(___,Method)``

Description

example

````[StdMean,StdCovar] = ecmnstd(Data,Mean,Covariance)` computes standard errors for mean and covariance of incomplete data. Use `ecmnstd` after estimating the mean and covariance of `Data` with `ecmnmle`. If the mean and distinct covariance elements are treated as the parameter θ in a complete-data maximum-likelihood estimation, then as the number of samples increases, θ attains asymptotic normality such that$\theta -E\left[\theta \right]\sim N\left(0,{I}^{-1}\left(\theta \right)\right),$where E[θ] is the mean and I(θ) is the Fisher information matrix.With missing data, the Hessian H(θ) is a good approximation for the Fisher information (which can only be approximated when data is missing).```

example

````[StdMean,StdCovar] = ecmnstd(___,Method)` adds an optional argument for `Method`. ```

Examples

collapse all

This example shows how to compute the standard errors for mean and covariance of incomplete data for five years of daily total return data for 12 computer technology stocks, with six hardware and six software companies

`load ecmtechdemo.mat`

The time period for this data extends from April 19, 2000 to April 18, 2005. The sixth stock in Assets is Google (GOOG), which started trading on August 19, 2004. So, all returns before August 20, 2004 are missing and represented as `NaN`s. Also, Amazon (AMZN) had a few days with missing values scattered throughout the past five years.

`[ECMMean, ECMCovar] = ecmnmle(Data)`
```ECMMean = 12×1 0.0008 0.0008 -0.0005 0.0002 0.0011 0.0038 -0.0003 -0.0000 -0.0003 -0.0000 ⋮ ```
```ECMCovar = 12×12 0.0012 0.0005 0.0006 0.0005 0.0005 0.0003 0.0005 0.0003 0.0006 0.0003 0.0005 0.0006 0.0005 0.0024 0.0007 0.0006 0.0010 0.0004 0.0005 0.0003 0.0006 0.0004 0.0006 0.0012 0.0006 0.0007 0.0013 0.0007 0.0007 0.0003 0.0006 0.0004 0.0008 0.0005 0.0008 0.0008 0.0005 0.0006 0.0007 0.0009 0.0006 0.0002 0.0005 0.0003 0.0007 0.0004 0.0005 0.0007 0.0005 0.0010 0.0007 0.0006 0.0016 0.0006 0.0005 0.0003 0.0006 0.0004 0.0007 0.0011 0.0003 0.0004 0.0003 0.0002 0.0006 0.0022 0.0001 0.0002 0.0002 0.0001 0.0003 0.0016 0.0005 0.0005 0.0006 0.0005 0.0005 0.0001 0.0009 0.0003 0.0005 0.0004 0.0005 0.0006 0.0003 0.0003 0.0004 0.0003 0.0003 0.0002 0.0003 0.0005 0.0004 0.0003 0.0004 0.0004 0.0006 0.0006 0.0008 0.0007 0.0006 0.0002 0.0005 0.0004 0.0011 0.0005 0.0007 0.0007 0.0003 0.0004 0.0005 0.0004 0.0004 0.0001 0.0004 0.0003 0.0005 0.0006 0.0004 0.0005 ⋮ ```

To evaluate the impact of the estimation error and, in particular, the effect of missing data, use `ecmnstd` to calculate standard errors. Although it is possible to estimate the standard errors for both the mean and covariance, the standard errors for the mean estimates alone are usually the main quantities of interest.

`StdMeanF = ecmnstd(Data,ECMMean,ECMCovar,'fisher')`
```StdMeanF = 12×1 0.0010 0.0014 0.0010 0.0009 0.0011 0.0013 0.0009 0.0006 0.0009 0.0007 ⋮ ```

Calculate standard errors that use the data-generated Hessian matrix (which accounts for the possible loss of information due to missing data) with the option `'hessian'`.

`StdMeanH = ecmnstd(Data,ECMMean,ECMCovar,'hessian')`
```StdMeanH = 12×1 0.0010 0.0014 0.0010 0.0009 0.0011 0.0021 0.0009 0.0006 0.0009 0.0007 ⋮ ```

The difference in the standard errors shows the increase in uncertainty of estimation of asset expected returns due to missing data. To view the differences:

`Assets`
```Assets = 1x12 cell {'AAPL'} {'AMZN'} {'CSCO'} {'DELL'} {'EBAY'} {'GOOG'} {'HPQ'} {'IBM'} {'INTC'} {'MSFT'} {'ORCL'} {'YHOO'} ```
`StdMeanH'`
```ans = 1×12 0.0010 0.0014 0.0010 0.0009 0.0011 0.0021 0.0009 0.0006 0.0009 0.0007 0.0010 0.0012 ```
`StdMeanF'`
```ans = 1×12 0.0010 0.0014 0.0010 0.0009 0.0011 0.0013 0.0009 0.0006 0.0009 0.0007 0.0010 0.0012 ```
`StdMeanH' - StdMeanF'`
```ans = 1×12 10-3 × -0.0000 0.0021 -0.0000 -0.0000 -0.0000 0.7742 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 ```

The two assets with missing data, AMZN and GOOG, are the only assets to have differences due to missing information.

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 `NaN`s.

Data Types: `double`

Maximum likelihood parameter estimates for the mean of the `Data` using the ECM algorithm, specified as a `NUMSERIES`-by-`1` column vector.

Maximum likelihood parameter estimates for the covariance of the `Data` using the ECM algorithm, specified as a `NUMSERIES`-by-`NUMSERIES` matrix.

(Optional) Method of estimation for standard error calculations, specified as a character vector. The estimation methods are:

• `'hessian'` — The Hessian of the observed negative log-likelihood function. This method is recommended since the resultant standard errors incorporate the increase uncertainties due to missing data. In particular, standard errors calculated with the Hessian are generally larger than standard errors calculated with the Fisher information matrix.

• `'fisher'` — The Fisher information matrix.

Data Types: `char`

Output Arguments

collapse all

Standard errors of estimates for each element of `Mean` vector, returned as a `NUMSERIES`-by-`1` column vector.

Standard errors of estimates for each element of `Covariance` matrix, returned as a `NUMSERIES`-by-`NUMSERIES` matrix.

Version History

Introduced before R2006a