On Tue, 19 Mar 2019, Sven Schreiber wrote:
Am 18.03.2019 um 20:53 schrieb Artur Tarassow:
> Just as a follow up: Python's Pandas library also keeps the structure
> <year:month:day> for weekly data. Also <pandas.DatetimeIndex.freq>
> involves a series with 52 unique discrete values exactly corresponding
> to what gretl's seasonals() function returns (even though you get a list
> of series here). So I guess things are fine as they are in gretl ;-)
Maybe so, but weeks defined in that way will not keep in step with the
true calendar and hence will not serve as true seasonals -- though if
the time series is not too long the approximation may be acceptable.
Anyway, in git we now have the function isoweek() which gives the ISO
8601 week number for given year, month and day. Not documented yet but
here's an example (with bonus printing of the "ISO week date" of each
observation):
<hansl>
nulldata 120
setobs 52 2016-04-04
series obsweek = isoweek($obsmajor, $obsminor, $obsmicro)
series isowkdate = index
strings S = array($nobs)
loop i=1..$nobs -q
S[i] = sprintf("%d-W%02d-1", $obsmajor[i], obsweek[i])
endloop
stringify(isowkdate, S)
print obsweek isowkdate -o
</hansl>
Allin