ecmnhess
Hessian of negative log-likelihood function
Description
Hessian = ecmnhess(Data,Covariance)NUMPARAMS-by-NUMPARAMS Hessian
                matrix of the observed negative log-likelihood function based on current parameter
                estimates.
Use ecmnhess after estimating the mean and covariance of
                    Data with ecmnmle. 
Hessian = ecmnhess(___,InvCovar,MatrixType)InvCovar and
                    MatrixType. 
Examples
This example shows how to compute the Hessian for the negative log-likelihood function for five years of daily total return data for 12 computer technology stocks, with six hardware and six software companies
load ecmtechdemo.matThe 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 NaNs. 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
   -0.0003
    0.0004
      ⋮
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
    0.0005    0.0006    0.0008    0.0005    0.0007    0.0003    0.0005    0.0004    0.0007    0.0004    0.0013    0.0007
    0.0006    0.0012    0.0008    0.0007    0.0011    0.0016    0.0006    0.0004    0.0007    0.0005    0.0007    0.0020
      ⋮
To evaluate the negative log-likelihood function for ecmnmle, use ecmnhess based on the current maximum likelihood parameter estimates for ECMCovar.
Hessian = ecmnhess(Data,ECMCovar)
Hessian = 90×90
107 ×
    0.0001    0.0000   -0.0000   -0.0000   -0.0000   -0.0000   -0.0000   -0.0000   -0.0000    0.0000   -0.0000   -0.0000         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0
    0.0000    0.0001   -0.0000   -0.0000   -0.0000    0.0000   -0.0000    0.0000   -0.0000   -0.0000    0.0000   -0.0000         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0
   -0.0000   -0.0000    0.0002   -0.0000   -0.0000   -0.0000   -0.0000   -0.0000   -0.0000   -0.0000   -0.0000   -0.0000         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0
   -0.0000   -0.0000   -0.0000    0.0003   -0.0000    0.0000   -0.0000   -0.0000   -0.0001   -0.0001   -0.0000   -0.0000         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0
   -0.0000   -0.0000   -0.0000   -0.0000    0.0001   -0.0000   -0.0000   -0.0000    0.0000   -0.0000   -0.0000   -0.0000         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0
   -0.0000    0.0000   -0.0000    0.0000   -0.0000    0.0000    0.0000   -0.0000    0.0000    0.0000    0.0000   -0.0000         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0
   -0.0000   -0.0000   -0.0000   -0.0000   -0.0000    0.0000    0.0002   -0.0000   -0.0000   -0.0000   -0.0000   -0.0000         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0
   -0.0000    0.0000   -0.0000   -0.0000   -0.0000   -0.0000   -0.0000    0.0004   -0.0000   -0.0000   -0.0000   -0.0000         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0
   -0.0000   -0.0000   -0.0000   -0.0001    0.0000    0.0000   -0.0000   -0.0000    0.0002   -0.0001   -0.0000   -0.0000         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0
    0.0000   -0.0000   -0.0000   -0.0001   -0.0000    0.0000   -0.0000   -0.0000   -0.0001    0.0004   -0.0000   -0.0000         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0
   -0.0000    0.0000   -0.0000   -0.0000   -0.0000    0.0000   -0.0000   -0.0000   -0.0000   -0.0000    0.0001   -0.0000         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0
   -0.0000   -0.0000   -0.0000   -0.0000   -0.0000   -0.0000   -0.0000   -0.0000   -0.0000   -0.0000   -0.0000    0.0001         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0
         0         0         0         0         0         0         0         0         0         0         0         0    0.0756    0.0014    0.0000   -0.0036   -0.0000    0.0000   -0.0392   -0.0004    0.0009    0.0051   -0.0086   -0.0001    0.0002    0.0022    0.0002   -0.0004   -0.0000    0.0000    0.0001    0.0000    0.0000   -0.0189   -0.0002    0.0005    0.0049    0.0011    0.0001    0.0012   -0.0142   -0.0001    0.0003    0.0037    0.0008    0.0000    0.0018    0.0007   -0.0315   -0.0003
         0         0         0         0         0         0         0         0         0         0         0         0    0.0014    0.0828    0.0008   -0.0115   -0.0021    0.0003   -0.0034   -0.0215    0.0030    0.0008   -0.0231   -0.0049    0.0012    0.0061    0.0013    0.0088   -0.0002   -0.0002   -0.0023   -0.0004   -0.0002   -0.0047   -0.0104    0.0015    0.0015    0.0031   -0.0011    0.0006    0.0118   -0.0076    0.0008   -0.0028    0.0015   -0.0008   -0.0011   -0.0011   -0.0036   -0.0173
         0         0         0         0         0         0         0         0         0         0         0         0    0.0000    0.0008    0.0229   -0.0001   -0.0063    0.0004   -0.0000   -0.0016    0.0002    0.0001   -0.0002   -0.0127    0.0018    0.0004    0.0018    0.0000    0.0058   -0.0007    0.0003   -0.0016    0.0019   -0.0001   -0.0023    0.0003    0.0002    0.0006    0.0004    0.0001    0.0001    0.0064   -0.0009   -0.0003   -0.0018    0.0000   -0.0005    0.0005   -0.0000   -0.0017
      ⋮
Input Arguments
Data, specified as an
                            NUMSAMPLES-by-NUMSERIES matrix
                        with NUMSAMPLES samples of a
                        NUMSERIES-dimensional random vector. Missing values are
                        indicated by NaNs. 
Data Types: double
Maximum likelihood parameter estimates for the covariance of the
                            Data using the ECM algorithm, specified as a
                            NUMSERIES-by-NUMSERIES
                        matrix.
(Optional) Inverse of covariance matrix, specified as a matrix using
                            inv
                        as:
inv(Covariance)
Data Types: double
(Optional) Matrix format, specified as a character vector with a value of:
- 'full'— Computes the full Hessian matrix.
- 'meanonly'— Computes only the components of the Hessian matrix associated with the mean.
Data Types: char
Output Arguments
Hessian matrix, returned as an
                            NUMPARAMSNUMPARAMS matrix of the
                        observed log-likelihood function based on current parameter estimates, where
                            NUMPARAMS = NUMSERIES * (NUMSERIES + 3)/2 if the
                            MatrixFormat = 'full'. If the
                            MatrixFormat = 'meanonly', then
                        the NUMPARAMS = NUMSERIES.
More About
The Hessian matrix is a square matrix of second-order partial derivatives of a scalar-valued function.
The Hessian matrix is a key concept in optimization, particularly in the context of multivariable calculus, and is used to study the local curvature of functions. The Hessian matrix provides important information about the behavior of functions near critical points, which are points where the gradient (first derivative) is zero.
Version History
Introduced before R2006a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)