User guide plotting chapter: outdated section
by Sven Schreiber
Hi,
looking at the chapter "6 Graphs and plots", it seems to me that the
sub-section "Publication-quality graphics: advanced options" (within
6.1) is quite outdated. It talks of sizes and terminals and so on which
you haven't really had to touch at least for a couple of years. For PDF
output we have another GUI controller which does all that, and
hand-picking gnuplot terminals is not recommended, I believe.
Just adding another screenshot of the PDF controller window would be
enough to replace that sub-section, I think.
As a cosmetic aside, the picture 6.1 could be updated, the window
decorations look 20 years old. (That's probably true for other
screenshots as well, though...)
cheers
sven
6 months
variable list (main) window not updated when list is returned
by Sven Schreiber
Hi,
I have this reproducible behavior: Have an active dataset (e.g.,
australia.gdt), call a user-defined function that produces a list (and
assign the return value); the new series from the created list do not
show up in the GUI variable list. But they're there and can be accessed
through console commands.
To be concrete, here's a function for testing:
<hansl>
function list putL(void)
series s = normal()
list L = s
return L
end function
</hansl>
And I called it with 'list L = putL()'. Afterwards I can do 'print s'
and so on, but it's not in the GUI.
thanks
sven
6 months, 1 week
typename() with non-existent input
by Sven Schreiber
Hello,
the help text for the (relatively recent) typename() function says: "If
the argument does not identify an object the string null is returned." -
But I'm actually getting an error instead of a string output, like with
all other functions (apart from exists()). Is the help text outdated or
the implementation buggy? Or --as always-- am I missing something?
thanks
sven
6 months, 3 weeks
modeltab --output within function
by Artur T.
Hi all,
I am trying to store a model table through the modeltab command. I am
calling the command _within_ a function. However, even though the model
objects seem to get stored, the table will not be written to a file
(either tex or rtf).
Is modeltab --output="@filename" not supposed to work within a function
for some reason or is this a bug?
It follows an example using a very recent version. The first function
adds models through a loop to the table, while the second one adds the
model objects manually.
<hansl>
set verbose off
clear
open denmark --quiet
function void floop (const series Y,
const lists Xlists)
string filename = sprintf("est_loop.rtf") # fails also for tex
loop foreach i Xlists
mod$i <- ols Y const Xlists[$i] --robust --quiet
modeltab add
endloop
modeltab --output="@filename"
modeltab show # does not appear
end function
function void simple (const series Y,
const lists Xlists)
string filename = sprintf("est_simple.rtf") # fails also for tex
mod1 <- ols Y const Xlists[1] --robust --quiet
mod2 <- ols Y const Xlists[2] --robust --quiet
modeltab --output="@filename"
modeltab show # does not appear
end function
list X1 = LRY IBO
list X2 = LRY IBO IDE
lists X = defarray(X1, X2)
floop(LRM, X)
simple(LRM, X)
</hansl>
Thanks in advance.
Artur
6 months, 3 weeks
printf: ignore nan values in a matrix
by Artur T.
Hi Gretl community,
I am wondering whether there is a way to ignore printing NA values in a
matrix when calling the printf command
Suppose you have a matrix like this:
Model=1 Model=2 Model=3 Model=4
INT nan -0.12 -0.17 -0.06
pv nan 0.00 0.00 0.09
U -0.07 -0.09 -0.11 nan
pv 0.00 0.00 0.00 nan
intercept -176.03 -108.49 6.37 -203.84
pv 0.00 0.00 0.00 0.00
l_INC 6.79 4.28 nan 7.81
pv 0.00 0.00 nan 0.00
trend -0.01 -0.01 -0.01 -0.01
pv 0.00 0.00 0.00 0.00
but you would like to replace all nan values by "" (empty string or no
value) for better readability. This should not be the default, but maybe
there exists some format argument of which I am not aware of.
Thanks
Artur
6 months, 3 weeks
'hausman' a reserved word?
by Sven Schreiber
Hi everybody,
I've stumbled over the issue that I cannot copy the Hausman test results
into a matrix called 'hausman'. Example:
<hansl>
open denmark
tsls LRM 0 LRY ; 0 LRY(-1) LRY(-2)
eval $hausman
matrix hoho = $hausman # works
matrix sargan = $sargan # works
matrix hausman = $hausman # fails
</hansl>
What's more, there isn't any real error message.
I vaguely remember that in the old days there was a "hausman" command
which is now obsolete, could that be the reason? Nonetheless, an
informative message would be nice.
thanks
sven
6 months, 4 weeks
"local" series not deleteable
by Sven Schreiber
Hi all,
I'm not sure I understand the rationale for the error I'm getting:
<hansl>
open denmark
function void sercheck(void)
series hey = normal()
print hey
delete hey # error "cannot delete variable in this context"
end function
sercheck()
</hansl>
The doc says that "delete" is only problematic in a loop, not in a
function per se -- but true enough, if I add the --force switch to the
delete command, then it does not complain anymore. So is this just a
missing piece of documentation? OTOH, deleting a locally created series
should not be a problem, should it?
Oh, BTW, another error "on the road"; writing the function signature
with " void" like this:
function void sercheck( void)
(with a blank), I'm getting another error, too. ("unrecognized type...")
thanks
sven
7 months
'workspace' in the main git tree?
by Sven Schreiber
Hi,
I see that now there's an (empty) dir named "workspace" in the gretl git
source tree. Is this fallout from moving the unit tests into the tree,
or is it intended?
thanks
sven
7 months
extensions to the "gmm" command
by Allin Cottrell
A couple of extensions to the "gmm" command are now in git
(snapshots will follow).
1) The doc for the "orthog" keyword (which defines an orthogonality
condition) states that the terms on the left and right of the
semicolon can be scalars, matrices or lists, but up till now a list
could only be given as a _named_ list. Now a list can be given in
"raw" form, as the space-separated names of two or more series. This
is convenient in some contexts.
2) Up till now parameters given in connection with the "params"
keyword could only be scalars or vectors. Now a general matrix is
acceptable. The script below illustrates this usage, with a
comparison of estimation of a (very simple) two-equation system via
OLS and GMM.
<hansl>
set verbose off
nulldata 100
T = $nobs
k = 3
n = 2
matrix X = mnormal(T, k)
matrix Y = mnormal(T, n)
# OLS
matrix U1 = {}
matrix B1 = mols(Y, X, &U1)
# GMM
matrix B2 = zeros(k, n)
matrix U2 = zeros(T, n)
matrix W = I(n*k)
gmm
U2 = Y - X*B2
orthog U2 ; X
weights W
params B2
end gmm
print B1 B2
eval max(abs(U1 - U2))
</hansl>
Allin Cottrell
7 months
determining the members' types in a bundle
by Sven Schreiber
Hi,
I needed to check whether a bundle contains a certain gretl object type,
so I put together a fairly general but straightforward function that
counts all the various types.
Comments welcome; in particular whether this should go into the "extra"
addon. Also, do you like the return format or do you have a better idea?
thanks
sven
--
<hansl>
set verbose off
function matrix bundle_member_types (const bundle b)
# Checks the types of the members of b and counts their occurrences.
# Returns a vector with 12 rows, holding the contained number of
members
# of the possible types in the order corresponding to the inbundle()
# function:
#
# 1. scalar, 2. series, 3. matrix, 4. string, 5. bundle,
# 6. array, 7. list.
#
# Since an 'array' can be of various sub-types, the rows 8-12
# hold the numbers of those sub-types:
# 8. matrices, 9. bundles, 10. strings, 11. lists, 12. arrays.
#
# Therefore the sum of rows 8-12 equals the number in 6.
# init
matrix out = zeros(12)
rnameset(out, defarray("scalar","series","matrix","string","bundle", \
"array", \
"list", \
"matrices","bundles","strings","lists","arrays"))
# check all the members
if nelem(b)
keys = getkeys(b)
loop foreach i keys
type = inbundle(b, "$i") # should be non-zero by construction
out[type]++
if type == 6 # array
string arraytype = typename(b["$i"])
if arraytype == "matrices"
out[8]++
elif arraytype == "bundles"
out[9]++
elif arraytype == "strings"
out[10]++
elif arraytype == "lists"
out[11]++
elif arraytype == "arrays"
out[12]++
else
print arraytype
funcerr "shouldn't happen"
endif
endif
endloop
endif
# quick cross-check
errorif(out[6] != sum(out[8:12]), "array counts don't match")
return out
end function
# test case:
open denmark --quiet
var 2 LRM LRY IBO --silent
eval bundle_member_types($system)
eval $system
</hansl>
7 months