On Tue, 19 Mar 2019, Sven Schreiber wrote:
<hansl>
function series obsweek(void)
if $pd != 52
funcerr "Not a weekly dataset"
endif
list s = seasonals() # gives S1...S52
series obsweek = NA
loop i=1..$pd -q
obsweek = (S$i == 1) ? i : obsweek
endloop
setinfo obsweek --description="Week indicator"
setinfo obsweek --discrete # doesn't work !?
return obsweek
end function
</hansl>
In general there can be two sorts of weekly data in gretl: one
that's just weeks 1 to N without any calendar dates attached, and
another that is indexed by an actual date for the start of each
week.
Question: now that we have the isoweek() function we could redefine
seasonals() to use ISO 8601 week numbers in the second case rather
than just repeating 1 to 52 without regard to the calendar -- would
that be worthwhile?
(If the answer is No, that's fine by me!)
Allin