﻿

Accelerating the pace of engineering and science

# ecmnhess

Hessian of negative log-likelihood function

## Syntax

```Hessian = ecmnhess(Data, Covariance, InvCovariance, MatrixFormat)
```

## Arguments

 Data NUMSAMPLES-by-NUMSERIES matrix of observed multivariate normal data Covariance NUMSERIES-by-NUMSERIES matrix with covariance estimate of Data InvCovariance (Optional) Inverse of covariance matrix: inv(Covariance) MatrixFormat (Optional) String that identifies parameters included in the Hessian matrix. If MatrixFormat = [] or ' ', the default method full is used. The parameter choices are full — (Default) Compute full Hessian matrix.meanonly — Compute only components of the Hessian matrix associated with the mean.

## Description

Hessian = ecmnhess(Data, Covariance, InvCovariance, MatrixFormat) computes a NUMPARAMS -by-NUMPARAMS Hessian matrix of the observed negative log-likelihood function based upon current parameter estimates, where

```NUMPARAMS = NUMSERIES*(NUMSERIES + 3)/2
```

if MatrixFormat = 'full' and

```NUMPARAMS = NUMSERIES
```

if MatrixFormat = 'meanonly'.

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

The data matrix has NaNs for missing observations. The multivariate normal model has

```NUMPARAMS = NUMSERIES + NUMSERIES*(NUMSERIES + 1)/2
```

distinct parameters. Therefore, the full Hessian is a NUMPARAMS-by-NUMPARAMS matrix.

The first NUMSERIES parameters are estimates for the mean of the data in Mean and the remaining NUMSERIES*(NUMSERIES + 1)/2 parameters are estimates for the lower-triangular portion of the covariance of the data in Covariance, in row-major order.

If MatrixFormat = 'meanonly', the number of parameters is reduced to NUMPARAMS = NUMSERIES, where the Hessian is computed for the mean parameters only. In this format, the routine executes fastest.

This routine expects the inverse of the covariance matrix as an input. If you do not pass in the inverse, the routine computes it.

The equation

```Stderr = (1.0/sqrt(NumSamples)) .* sqrt(diag(inv(Hessian)));
```

provides an approximation for the observed standard errors of estimation of the parameters.

Because of the additional uncertainties introduced by missing information, these standard errors may be larger than the estimated standard errors derived from the Fisher information matrix. To see the difference, compare to standard errors calculated from ecmnfish.