On Tue, 19 Mar 2019, Sven Schreiber wrote:
Am 19.03.2019 um 17:21 schrieb Allin Cottrell:
> See https://en.wikipedia.org/wiki/ISO_week_date
> It's not trivial to come up with a coherent week numbering system but I
> guess we could implement ISO 8601 week numbers (in some form) if there's
> a real use case for them.
Earlier in this thread we noted that gretl already must have week
numbers internally, because creation of seasonal dummies works.
Well, it sort-of works. The weeks won't be the same as in ISO 8601. An
obsweek series based on gretl's weekly seasonals will just repeat
1,2,...,52 across the observations in the dataset, starting at 1
without regard to the starting date (if the observations are dated).
And each pd=52 "year" has exactly 52 weeks, so it's not equivalent to
a real calendar year in either starting-point or length.
set verbose off
function void make_obsweek(series *ow)
if $pd != 52
funcerr "Not a weekly dataset"
list s = seasonals() # gives S1...S52
ow = NA
loop i=1..$pd -q
ow = (S$i == 1) ? i : ow
setinfo ow --description="Week indicator"
setinfo ow --discrete
# start in the first week of April, 2016
setobs 52 2016-04-04