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
another ternary woe
by Sven Schreiber
Hi,
very short minimal script here:
<hansl>
matrix heyho = ("a" == "b") ? garbl[3,] : I(2)
</hansl>
There is no object "garbl", but that's by design in the case that the
condition isn't true. Gretl says "[" would be invalid here.
thanks,
sven
7 years, 7 months
crash with function package GUI
by Sven Schreiber
Hi,
I was given (and could confirm) the following crash recipe:
- open the function package list window
- open/execute a package and execute it via the GUI
- while the package is running (so you need to use a package that does
some long-running task, like a bootstrap) close the package list window
(not the window of the running package itself)
- after a while (I guess when the package is done, because I can see
some output) gretl crashes (OS message about terminating unexpectedly)
This was on Windows 7, recent snapshot.
thanks,
sven
7 years, 10 months
gretl git: news, warning, invitation
by Allin Cottrell
Hello all,
News: on Monday I will merge into git master my up-till-now
"experimental" branch that allows arbitrary nesting of the
"member-of" relation in the context of function calls and
assignment. (Thanks to Sven for pointing out the previous lack of
this feature.) There follows a small sample of the sort of thing
that now works:
<hansl>
# matrix in array of matrices in array of bundles
bundles B = array(2)
matrices B[1].M = defarray(I(3), mnormal(2,2))
B[1].M[1][2:3,2:3] += 17
eval B[1].M[1]
eval B[1].M[1][2,2]
# assign to bundle members directly
bundle b
scalar b.num = 3
matrix b.mat = I(2)
# assign to array member with type spec
matrices M = array(2)
matrix M[1] = I(3) # OK
M[2] = I(4) # implicit type, OK
string M[2] = "foo" # error, wrong type for array
</hansl>
After the merge I will consider it a bug if a well-formed instance
of this sort of nesting doesn't work. (Up till now I've claimed it's
just an "unimplemented feature").
Warning: I have tested this quite thoroughly but there's no
guarantee that I haven't missed some problem, so anyone in the habit
of using gretl-git for "real" econometric work should be cautious at
first.
I've checked that the following work OK: all the "practice" scripts
packaged with gretl, all of my large and miscellaneous collection of
scripts gathered from various sources over the years, all current
function packages, and all current addons. I've also put the new
code through its paces under valgrind and have fixed all bad
accesses and memory leaks that I found in earlier drafts. There may
nonetheless be some problems that have not manifested themselves so
far.
Invitation: I'll be glad if some people are willing to test the new
code -- that's the only way we'll be able beat out remaining bugs.
For those on Windows or Mac who regularly use snapshots but don't
build from git: I'm thinking about creating snapshots from the new
code but (for a while) putting them in a new "testing" directory on
sourceforge rather than the regular "snapshots" directory. Please
let me know if this is something you might use.
Allin
7 years, 10 months
parsing too liberal
by Sven Schreiber
Hi,
the following produces 5 (note the extra "+"):
hey = 2 + + 3
print hey
I think this should cause a syntax error instead. I kind of
understand/guess that the second "+" is interpreted as a unary
(redundant) operator relating to the following "3", and maybe that's
correct. But my gut feeling still says it's unfortunate...
thanks,
sven
7 years, 10 months
Placement of result windows in function package GUI usage
by Sven Schreiber
Hi,
I was just recently asked why, when running a function package with the
GUI, the result window is placed behind the initial package window
(where the parameters are specified). This is obviously only an issue
when you un-check the box "close this window on execution?" in the
parameter-entry windows.
On small screens there is probably no way around this, but it also seems
to happen on large screens, so that the user always has to move the
windows around manually, which becomes a nuisance.
Is this something which is controlled by gretl?
thanks,
sven
7 years, 11 months
Bounds for function arguments
by Marcin Błażejowski
Hi,
suppose I'm defining a function based on argument(s) with min/max values
and suppose I don't know this bounds a priori (for example max depends
on obs number or number of CPU cores). So I'd like to write something
like that:
<hansl>
function void foo (int a[0:$nobs:], int
threads[1:$sysinfo.omp_num_threads:1])
...
end function
</hansl>
I think it would be useful. What do you think?
Marcin
--
Marcin Błażejowski
7 years, 11 months
Access to set options
by Marcin Błażejowski
Hi,
sorry if this is just my ignorance but can I have access to values set
by "set"?
I know how to access current workdir value: it's just @workdir (as
string), but can I retrive value of omp_num_threads (as integer or
string, does not matter actually)?
Or can I do something like "eval set omp_num_threads" [of course not in
the current sence of eval] to get string "omp_num_threads: positive
integer, currently 4" which I could parse next?
Marcin
--
dr Marcin Błażejowski
Katedra Zarządzania oraz Instytut Rozwoju Badań Naukowych
Wyższa Szkoła Bankowa w Toruniu
ul. Młodzieżowa 31a
87-100 Toruń
pok. 116
--
Marcin Błażejowski
7 years, 11 months
obsolete use of "=" as Boolean test: please use "=="
by Marcin Błażejowski
Hi,
I got a warning today:
----
In regard to function...
obsolete use of "=" as Boolean test: please use "=="
----
The problem is that in given function all ifs have "==" expression
(including condition for loop...while).
Marcin
--
Marcin Błażejowski
GG: 203127
7 years, 11 months
Access to set options
by Marcin Błażejowski
Hi,
sorry if this is just my ignorance but can I have access to values set
by "set"?
I know how to access current workdir value: it's just @workdir (as
string), but can I retrive value of omp_num_threads (as integer or
string, does not matter actually)?
Or can I do something like "eval set omp_num_threads" [of course not in
the current sence of eval] to get string "omp_num_threads: positive
integer, currently 4" which I could parse next?
Marcin
--
dr Marcin Błażejowski
Katedra Zarządzania oraz Instytut Rozwoju Badań Naukowych
Wyższa Szkoła Bankowa w Toruniu
ul. Młodzieżowa 31a
87-100 Toruń
pok. 116
7 years, 11 months