Hessian of negative log-likelihood function
Hessian = ecmnhess(Data, Covariance, InvCovariance, MatrixFormat)
NUMSAMPLES-by-NUMSERIES matrix of observed multivariate normal data
NUMSERIES-by-NUMSERIES matrix with covariance estimate of Data
(Optional) Inverse of covariance matrix: inv(Covariance)
(Optional) String that identifies parameters included in the Hessian matrix. If MatrixFormat =  or ' ', the default method full is used. The parameter choices are
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.
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.