# ecmnstd

Standard errors for mean and covariance of incomplete data

## Syntax

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

## Arguments

 `Data` `NUMSAMPLES`-by-`NUMSERIES` matrix with `NUMSAMPLES` samples of a `NUMSERIES`-dimensional random vector. Missing values are indicated by `NaN`s. `Mean` `NUMSERIES`-by-`1` column vector of maximum-likelihood parameter estimates for the mean of `Data` using the expectation conditional maximization (ECM) algorithm `Covariance` `NUMSERIES`-by-`NUMSERIES` matrix of maximum-likelihood covariance estimates for the covariance of `Data` using the ECM algorithm `Method` (Optional) Character vector indicating method of estimation for standard error calculations. The methods are: `hessian` — (Default) Hessian of the observed negative log-likelihood function. `fisher` — Fisher information matrix.

## Description

`[StdMean, StdCovariance] = ecmnstd(Data,Mean,Covariance,Method)` computes standard errors for mean and covariance of incomplete data.

`StdMean` is a `NUMSERIES`-by-`1` column vector of standard errors of estimates for each element of the mean vector `Mean`.

`StdCovariance` is a `NUMSERIES`-by-`NUMSERIES` matrix of standard errors of estimates for each element of the covariance matrix `Covariance`.

Use this routine 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).

It is usually advisable to use the default `Method` since the resultant standard errors incorporate the increased uncertainty due to missing data. In particular, standard errors calculated with the Hessian are generally larger than standard errors calculated with the Fisher information matrix.

Note

This routine is slow for `NUMSERIES > 10` or ```NUMSAMPLES > 1000```.