Mann-Kendall test
by Sven Schreiber
Hi,
I've just read about the non-parametric Mann-Kendall test for a trend
(hence my recent postings about Kendall's tau and ties in a series).
It looked pretty easy, so I'm attaching an attempt at a basic
implementation. Full disclosure: I've used the description from
https://cran.r-project.org/web/packages/trend/vignettes/trend.pdf (only
the basic version in section 1.1).
All you have to do is call "MannKendall(x)", where x is your series of
interest.
I'd be happy about feedback regarding cross-checks and correctness (for
example in the above document in equ. (4) the case S>0 wrongly appears
twice, and I had to make an educated guess where to switch the
signs...), whether it should become a function package and so on.
thanks,
sven
7 years, 6 months
translating gretl docs
by Allin Cottrell
I've been working lately on making the production of the PDF Command
(and function) Reference from the XML source files more robust. This
leads me to a couple of observations and a question.
First, translating the User's Guide is by now a massive task --
equivalent to translating a big book. But translating the two
reference XML files (gretl_commands_en.xml and
gretl_functions_en.xml) is relatively manageable, and doing so
basically gets you the PDF Reference "for free". There's a certain
amount of supplementary text in a few TeX files, namely cmdref.tex,
funcref.tex, operators.tex, comments.tex, optarg.tex and
reftables.tex (about 20 kbytes total); if these are translated too
then the whole Reference is internationalized.
I see that the front page of the Italian Reference has a note saying
that the translation is frozen as of gretl 1.7.1 but actually that's
not true: since the Italian XML files are up to date, so (basically)
is the Reference. So maybe we could remove that note?
Now for the question. The big problem with translation of the XML
files is ensuring that the translations stay up to date. I'm
wondering if xml2po might be helpful here. I think Alexander
Gedranovich raised this question a while back. I didn't look into it
at the time but now I've done so. Xml2po offers the facility of
stripping the translatable material out of an XML file and making a
pot file (essentially each paragraph becomes a "msgid"), and it also
gives a means of merging translations in a po file back into XML. So
we could use the usual "gettext" procedure, meaning that any updates
to the English versions would be immediately apparent to translators
-- and any newly added material would appear in the translated
versions in English (until it gets translated).
I've put a sample pot file (for the function reference) at
http://users.wfu.edu/cottrell/tmp/gretl_functions.pot . Comments
invited.
Allin
7 years, 11 months
Draft: CfP for 2017, please check (Ioannis, Jack, Ignacio, Oleh especially, and Allin of course)
by Sven Schreiber
Hi all,
based on Ignacio's existing document for the last conference I have put
together a first draft of the call for papers, attached. (I hope it goes
through the list as it's <200KB here.)
Please check the contents of the call in general, for example if the
described idea of the "coding sprint" is appropriate and practical, and
the dates given in general. This general check would be especially
important for the central players Ioannis and Allin.
Also there are some "fixme" places in the document with some of your
names; so Jack, Oleh, and Ignacio, please respond whether the respective
part of the document should be changed or if it is OK.
It would be nice if you could answer before the holidays.
thanks,
sven
7 years, 11 months
empirical CDF function
by Allin Cottrell
I've added in git a function named ecdf which takes a series or
vector argument and returns the empirical CDF in the form of a two
column matrix with unique sorted values of the input in column 1 and
cumulative relative frequency in column 2.
This is not very difficult to do in hansl, but it's substantially
faster in C (the differential depending on the dimensions of the
problem) and I think it may be worth having. Test script below.
<hansl>
function matrix hansl_ecdf (const matrix M)
matrix ret = values(M) ~ 0
scalar n = rows(M)
loop i=1..rows(ret) -q
ret[i,2] = sumc(M .<= ret[i,1])/n
endloop
return ret
end function
scalar N = 3000
matrix M = zeros(N, 1)
loop i=1..N -q
M[i] = randint(1, 200)
endloop
scalar t1=0
scalar t2=0
loop 500 -q
set stopwatch
matrix ec1 = ecdf(M)
t1 += $stopwatch
matrix ec2 = hansl_ecdf(M)
t2 += $stopwatch
endloop
printf "built-in: %.3fs\n", t1
printf "hansl: %.3fs\n", t2
</hansl>
hansl_ecdf() could probably be improved upon, but it seems like a
"natural" solution for hansl users. Output on the machine I'm at:
built-in: 0.204s
hansl: 1.610s
(Besides, the built-in version handles both series and vectors, and
automatically drops NAs or NaNs from the calculation.)
If I've missed a reason why this is redundant (which sometimes
happens!) please let me know. Otherwise I'll go ahead and document
it.
Allin
8 years
duration models and Liu-Hong test
by Allin Cottrell
Any duration model experts out there?
I'm trying to get started with implementing Liu and Hong's omnibus
specification test for duration models with censoring -- see
http://ajbuckeconbikesail.net/Seminars/Spring_08/Duration_Chapter1.pdf
-- but I've got stuck on what seems like it should be an elementary
point.
The relevant pages of the article are 6-10. Here's my problem: their
empirical survivor function (p. 10) involves counting cases where
V_i(\theta) and C_i(\theta), for observations i, are greater than
duration value t. But V_i and C_i are (if I'm reading the paper
right) CDF values and therefore limited to [0,1], while the duration t
is said on page 6 to be distributed on [0, \infty). So I don't see how
these two terms can be meaningfully compared.
I guess I'm missing some implicit mapping/transformation (maybe of t
onto [0,1]?). Can anyone help?
Allin
8 years
Re: [Gretl-devel] Translations to Galician
by Allin Cottrell
I'm cc'ing this reply to gretl-devel since it may be of interest to
others.
On Tue, 20 Dec 2016, ESTEVEZ NUÑEZ JUAN CARLOS wrote:
> In last release of .po files, if the comment of
> 'gretl_cli_fnref.en', 'gretl_gui_fnref.en', etc... says to leave the
> chain unstranlated, do you mean to leave a blank or to repeat the
> same chain?
It's best to leave the msgstr blank (avoids typos!).
> And another question: As I find very useful to translate the
> 'gretl_functions_en.xml' and 'gretl_commands_en.xml' to Galician,
> I'm doing.
That's great, thanks.
> So how will be the translated '*_gl.xlm ' files uploaded to
> doc/commands directory? Need I send it to you or must I upload it
> directly?
You may do it either way. But you should probably let me know when you
reckon the translation is "ready for publication" (that is, when it
should become the default for users running gretl in Galician).
Allin
8 years
translated helpfiles
by Allin Cottrell
First, many thanks to those who have contributed translations of the
gretl "online" help files.
Second point, it's time to (re-)explain the mechanism for getting
such translations activated, which I'm afraid is not totally
transparent.
By way of background, I'm talking about translations of the XML
files gretl_commands.xml and genr_funcs.xml, which live in the
doc/commands subdirectory of the gretl source tree. Translations of
these are named with an interpolated two-letter language code, as in
genr_funcs_it.xml
gretl_commands_pt.xml
These files are used as "raw material" for building the marked-up
text shown under /Help/Command reference and /Help/Function
reference in the GUI program; they can also be used in other ways.
Our mechanism for actually showing translations to the user depends
on "translations" of the names of the generated help files, to be
found (or not) in the relevant .po files. The full set of English
help files (for both commands and functions, and for both the GUI
and CLI programs) is as follows:
gretlcli.hlp
gretlcmd.hlp
gretlgui.hlp
genrcli.hlp
genrgui.hlp
To activate translations these entries in gretl.pot should be
"translated" as in, for example,
gretlcli.hlp -> gretlcli.hlp.it
gretlcmd.hlp -> gretlcmd.hlp.pt
(that is, add the appropriate two-letter extension).
In current git, I've ensured that these filenames are translated for
the pt files. But if a translator wants to "mask" a translated
helpfile ("not really ready yet") it should be enough to enter a
null translation in the .po file, e.g.,
genrgui.hlp -> genrgui.hlp
and users will be shown the English-language version.
Allin
8 years
Crash when using empty strings
by Artur Tarassow
Dear all,
the following example where S is an array of strings but a single entry
is 'null' triggers a crash of gretl (using current git on Ubuntu 16.10).
<hansl>
clear
matrix M = mnormal(2,2)
strings S = array(2)
S[1] = "col1"
colnames(M, S)
plot M
options with-lines time-series
end plot --output=display
</hansl>
Best,
Artur
8 years
Function help translation
by Henrique Andrade
Dear Allin,
I'm almost finishing the localization of "genr_funcs.xml" (79% of the
functions are translated) and I would like to send the
"genr_funcs_pt_BR.xml" to Gretl git. Can I upload it?
Best,
Henrique Andrade
8 years
Eigengen function help
by Henrique Andrade
Dear Allin,
In the "eigengen" function help we have:
(...)
If a non-null second argument is given, the specified matrix will be
over-written with the auxiliary result. (It is not required that the
existing matrix be of the right dimensions to receive the result.) It will
be organized as follows:
(...)
When you say "It will be organized as follows", are you talking about the
matrix that the function will output (A) or the existing matrix (U)?
Best regards,
Henrique Andrade
8 years