[Gretl-users] Constant in log-likelihood and graph of two densities together

Allin Cottrell cottrell at wfu.edu
Mon Jul 8 21:31:05 EDT 2013

On Mon, 8 Jul 2013, Alecos Papadopoulos wrote:

> Good evening everybody. I am rather new to Gretl and my questions 
> are probably kindergarten-level, but I could not figure out the 
> answers myself or using Help. So here they are
> 1) I run maximum likelihood from the script window. I am trying 
> two different and non-nested stochastic specifications. I have to 
> compare and evaluate them by using the value of the maximized 
> log-likelihood. But since they are non-nested, their 
> log-likelihood functions are totally different. So, suddenly, the 
> constants of each log-likelihood, although they play no role in 
> the estimation of the parameters, influence the value of the 
> maximized logl - and they are different constants.
> If I don't include them in the logl function, then the values of 
> the maximized logl (and the AIC and BIC and HQ criteria) will be 
> misleading for comparison purposes of the two competing stochastic 
> specifications, and currently I am doing the corrections by hand 
> (which I can live with). But it would be nice not to have output 
> that needs such corrections. I tried to include them in the 
> specification of the logl after the "mle logl = " command. But 
> when I tried to include them as, say, "ln(4/sqrt(2/pi))" or 
> "ln(4/sqrt(2/%pi)) I get "syntax error on the command line".

The recommended way of accessing pi = 3.14... in current gretl 
(version 1.9.12) is "$pi", though plain "pi" (deprecated since May 
2012) will still work; "%pi" will definitely not work. The 


is correctly evaluated as 1.612... in current gretl.

> When I calculate them explicitly, say 0.45678 and enter this 
> constant instead, Gretl runs, but the estimation goes astray, and 
> produces different results than when the constant is not included. 
> I suspect that this may have something to do with the fact that I 
> do not specify analytical derivatives, but I really don't know. 
> What am I doing wrong?

The issue of analytical versus numerical derivatives wouldn't seem 
to be relevant to the inclusion or non-inclusion of a constant term 
(which obviously doesn't have a derivative) in the log-likelihood.
I suppose something else must be wrong here. I think you'll have to 
show us your full script to get useful help.

> 2) Again for comparison purposes, I would want to have in one graph the
> estimated densities of two series. But when I select two series the
> "Variable" menu becomes disabled, while in the "View" menu there are
> various graph options, but not the option to graph the estimated
> densities of the two series together. Is there a way around this?

This question has come up before. Please see 

Allin Cottrell

More information about the Gretl-users mailing list