I shall endeavour to provide a humble explanation for that.

Generally speaking, language syntax in gretl consists of three groups: commands, functions and “the rest”. Since it is an econometrics software package, it deals with statistic datasets. If you tell it a command, it does something: “info” describes a dataset in the output window, “ols y x” estimates a model,  omit const” conducts a test whether the intercept (constant term) can be treated as zero and omitted etc. If you use a function, well, a function grabs something as input and yields something as output. Most of the functions are mathematical and statistical. Example: genr r = round(x) --- genr is a command, it does something, whereas round(arg) is a function that returns a rounded-to-zero value of its argument. Another example: after a regression is estimated, the command vif calculates variance inflation factors and produces a table with a bunch of numbers, whereas $rsq is a function: it is equal to the R-squared coefficient from the last estimated model. A bare function is senseless: one cannot simply write exp(x) and enjoy the fruits. A function is an instrument that is used in commands; a command is a script that uses functions. The ols command uses functions of matrix multiplication, assigns some values to the functions related to the regression estimation and produces a table. That’s the basic difference.

Please correct me if I wasn’t precise at all.

Yours sincerely,
Andreï V. Kostyrka

--
С уважением,
—Андрей Викторович Костырка.—
http://kostyrka.ru, http://kostyrka.ru/blog


2014-04-08 0:25 GMT+04:00 Logan Kelly <logan.kelly@uwrf.edu>:

Quick question. What is the difference between a command and a function? And more to the point when both a command and a function exist to do the same thing, e.g. pca, which should one use. I think I have read in other posts that commands are being slowly depreciated in favor of function, but I am not sure if that is true.

 

Thanks,

 

Logan


_______________________________________________
Gretl-users mailing list
Gretl-users@lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users