[Gretl-users] Multiple Linear Regression

Allin Cottrell cottrell at wfu.edu
Tue Oct 31 10:39:57 EST 2006


On Tue, 31 Oct 2006, Martin Sykora wrote:

> Thanks very much for your help Allin!
>
>> On Tue, 31 Oct 2006, Martin Sykora wrote:
>>
>>> I am completely lost in the source code and accompanying 
>>> files.

You're welcome.  Here's a further suggestion for navigating the 
gretl source, which I sometimes use myself if I forget where 
something is.

* First, look up the gretl command code for the topic you're 
interested in, using the command word.  For least squares 
regression the command word is "ols" and in 
lib/src/gretl_commands.c a search for "ols" shows that the 
corresponding numeric code is OLS.

* Now look up OLS in the central command execution code, in
lib/src/interact.c.  This is a big "switch" and we find:

     case OLS:
     case WLS:
     case HCCM:
 	clear_model(models[0]);
 	*models[0] = lsq(cmd->list, pZ, pdinfo, cmd->ci, cmd->opt);
 	err = maybe_print_model(models[0], pdinfo, prn, cmd->opt);
 	break;

This tells is that lsq() is the function that actually does the 
work for OLS.

>From this point on, the exact process depends on what code editor 
you're using.  I use emacs, and by typing "Alt" + "." over the 
"lsq" above, I'm taken to the point in the source where lsq() is 
actually defined.  Other C-source-aware editors presumably have 
their own ways of doing this sort of thing.

Allin Cottrell





More information about the Gretl-users mailing list