[Gretl-devel] $depvar not a series?

Allin Cottrell cottrell at wfu.edu
Wed Jul 1 11:41:07 EDT 2015

On Wed, 1 Jul 2015, Sven Schreiber wrote:

> Ok now I'm really confused:
> (this is with the denmark.gdt dataset again)
> <hansl>
> ols LRM const LRY IBO
> eval $depvar	# gives LRM
> series s1 = $depvar # wrong datatype error!?
> </hansl>
> The doc says that the $depvar accessor returns a string, alright. But in 
> gretl's world a string ('LRM' here) would always be valid as an identifier, 
> no?

"Use versus mention", as W. V. Quine has it. Neither string variables 
nor string literals are ever acceptable as identifiers for series, 
matrices or whatever, in gretl commands. You need the unquoted name, 
or (for series only, in suitable contexts) the ID number. The above is 
basically equivalent to trying

series s1 = "LRM"

which is clearly a type error: "LRM" is not a series, it's the name of 
a series, just as "Sven" is not a developer of gretl but the name of 

Here are two ways of doing what you wanted:

open denmark.gdt
ols LRM const LRY IBO
# use string substitution to get the unquoted name
# into the command line
string tmp = $depvar
series s1 = @tmp
# use the $ylist accessor (cleaner)
series s2 = $ylist[1]
print LRM s1 s2 -o


More information about the Gretl-devel mailing list