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, 5 months
Preserve row and col names of a matrix after functions
by Henrique Andrade
Dear Gretl Team,
Is it possible to preserve row and col names of a matrix after
"mreverse" and "trimr" functions? Please take a look at the following
code:
<hansl>
matrix M = {1, 2; 2, 1; 4, 1}
strings Row = defarray("Row1", "Row2", "Row3")
strings Col = defarray("Col1", "Col2")
rownames(M, Row)
colnames(M, Col)
matrix Msortby = msortby(M, 1)
matrix Mreverse = mreverse(M)
matrix Mtrimr = trimr(M, 1, 1)
print M Msortby Mreverse Mtrimr
</hansl>
In my humble opinion, "reverse" and "trimr" could have the same
behavior of "msortby", i.e., keep col and row names as in "msortby".
Best,
Henrique Andrade
7 years, 12 months
Translation help
by Henrique Andrade
Dear Gretl Team,
I'm not an expert in MIDAS and because of that I am not confident
translating the following lines:
1. Normalized beta (zero last lag)
2. spread (MIDAS)
Line 1: Could you explain me what is "zero last lag"?
Line 2: Could you give me a little more context about "spread (MIDAS)"?
Another line I get myself stuck is:
3. Decoration
Could you give me more context?
Best,
Henrique Andrade
8 years
Pre-specifying names of list members returned from a function call
by Sven Schreiber
Hi,
see feature request #85 (by myself I must admit):
https://sourceforge.net/p/gretl/feature-requests/85/
Currently a function with a list as a return type must internally set
the names of the list members (series) and the those names are
automatically exported to the function caller. If series with those
names already exist in the outer scope (at the caller level), they would
be overwritten. This is an exception of gretl's principle of function
encapsulation.
I'm suggesting: To provide a cleaner solution of this name clash
problem, such a list-returning function should also accept a string
array argument. The string elements in this array would be used by the
function as the names of the exported list members.
In this context it would be useful to have a built-in easy mechanism to
take the labels from the string array and use it for the returned list
(inside the user-defined function). That is the concrete request right now.
I'm not suggesting to make this thing mandatory any time soon, because
of the backward-compatibility issue.
thanks,
sven
8 years
$huge accessor not colored in script editor
by Artur T.
Hi all,
it seems that only the "$h" but not the "uge" part of the $huge accessor
is colored in the script editor. This is the case for the latest git
version using ubuntu. Hope that helps.
Best,
Artur
8 years
"Delete" command crashes Gretl
by Henrique Andrade
Dear Allin,
The following script is crashing Gretl (2016d-git 2016-10-23, Windows 7):
<hansl>
open australia.gdt
delete PAU E PUS
delete IAU IAU
</hansl>
Best,
Henrique Andrade
8 years
Translation doubt "rank-deficient"
by Hélio Guilherme
Dear specialists in Math and Anglo to Romanic languages translations,
In this case translation of "rank-deficient" (matrix) to Portuguese.
I am having trouble in finding a good translation for:
Warning: Jacobian is rank-deficient
This is the best I got (I'll keep original words when in doubt):
Aviso: a Jacobiana não é linearmente independente (é "rank-deficient")
Direct translation for the above could be:
Warning: the Jacobian is not linearly independent (it is "rank-deficient")
I know that the rows or columns of the Jacobian matrix are not linear
independent, but what do you think about my choice for the translation?
Note: I have found direct translation in Portuguese used in Brazil, for
"rank-deficient" as "deficiente de posto" but it does not sound right to me.
Thank you very much and keep doing a good job!
Hélio
8 years
Mean Absolute Percentage Error: possible mistake
by Henrique Andrade
Dear Allin and Jack,
I think there is an error in the definition of the Mean Absolute Percentage
Error (chapter 29, section 29.4). I think we should use the modulus of the
entire division:
abs(e_t/y_t)
Now we have:
abs(e_t)/y_t
Um abraço,
Henrique Andrade
8 years
foreign R functions and matrix return values
by Sven Schreiber
Hello,
I'm testing the feature from the section "Further use of the R library"
of the gretl guide (36.7), namely that I can define my own R functions
in a foreign block and call them later. (Which is great!) I'm struggling
with some limitations when I want to get matrices back, and I'm not sure
whether those are bugs or not. Sometimes I'm only getting the first
element of the return matrix, and sometimes there seems to be some
unwanted rounding going on.
Below are some examples (sorry a bit long, but just because it's
repetitive).
Thanks,
Sven
<hansl>
set R_functions on
# matrix in / matrix out (or scalar in /scalar out)
foreign language=R
check1 <- function(x) {
options(digits=10)
return(x)
}
end foreign
# scalar in / matrix out (or matrix in / matrix out)
foreign language=R
check2 <- function(x) {
options(digits=10)
z <- c(x, x)
return(z)
}
end foreign
# both scalar and matrix in / matrix out
foreign language=R
check3 <- function(x, y) {
options(digits=10)
z <- c(x, y)
return(z)
}
end foreign
### calls from hansl
scalar ins = 10
matrix inm = {123456.9, 0}
matrix heym = R.check1(inm) # works
eval heym
scalar heys = R.check1(ins) # works
eval heys
matrix hus = R.check2(ins) # fails
eval hus
matrix hum = R.check2(inm) # fails
eval hum
matrix ouf = R.check3(ins, inm) # fails
eval ouf
## for comparison:
foreign language=R
options(digits=10)
print(c( c(123456.9, 0), c(123456.9, 0) ))
end foreign
</hansl>
8 years