Different results in MLE across Gauss and R

Dear comunity,

I am using Gauss to estimate a maximum likelihood model with MaxLik. Before blindly trusting any results, I wanted to double check the results by letting R estimate the same model as well. Thereby, I encountered something very odd. Given the same starting values, log-likelihood formula, data set and method (BFGS), both programs will provide me with the same value for the log-likelihood and the parameters. However, the two Hessian matrices differ extremely. I need the Hessians to compute the standard errors and make statistical inferences. If I cannot trust those, I wouldn't know whether any paramters are significant.

I stripped down my model to a very simple logit model with two parameters (see Gauss code), that provides me with the exact same paramter values and likelihood as R does. However, both programs provide totally different Hessians. Can anyone help me to find out a) what the problem might be, b) how the Hessians are computed by Gauss/R and eventually c) which results to trust?

Any help would be greatly appreciated.

Gauss Code:

start={ 0.95568840 , -0.20459156 };

library maxlik,pgraph;
//_max_GradTol = 1.e-4;
_max_Algorithm = 0;
//_max_GradCheckTol = 1e-3;
//_max_CovPar = 0;
_max_Diagnostic = 1;
{betaa,f,g,cov,ret} = maxlik(XMAT,0,&ll,start);
call maxprt(betaa,f,g,cov,ret);
print _max_FinalHess;

proc ll(b,XMAT);
local exb, probo, logexb, yn, logexbn, yt, ynt, logl;

exb = EXP(alt*b);
probo = exb./(1+exb);

logexb = ln(probo);

yn = 1 - itn;
logexbn = ln(1 - probo);

yt = itn';
ynt = yn';

logl = (yt*logexb + ynt*logexbn);


Gauss Output:
Mean log-likelihood -0.591820
Number of cases 1924

Covariance matrix of the parameters computed by the following method:
Inverse of computed Hessian

Parameters Estimates Std. err. Est./s.e. Prob. Gradient
P01 2.1038 0.2857 7.363 0.0000 0.0000
P02 -0.9984 0.2365 -4.221 0.0000 0.0000

Gauss Hessian:

0.20133256 0.23932571
0.23932571 0.29377761

R Output:

Coeff. Std. Err. z p value
[1,] 2.10379869 0.28570765 7.3634665 1.7919000e-13
[2,] -0.99837955 0.23651060 -4.2212889 2.4290942e-05

R Hessian:

[,1] [,2]
[1,] 387.34106 460.45379
[2,] 460.45379 565.24412

1 Answer


You may have noticed that Maxlik reports a "mean log-likelihood".   The R Hessian divided by 1924 will reproduce the Maxlik Hessian.    Early versions of Maxlik optimizes the mean log-likelihood.  The idea was to reduce numerical issues.   Later versions optimize the log-likelihood itself.

Ron Schoenberg

You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.

Try GAUSS for 14 days for FREE

See what GAUSS can do for your data

© Aptech Systems, Inc. All rights reserved.

Privacy Policy