On Thu, 10 Dec 2015, Marc O'Callaghan wrote:
Greetings to all,
Being a very inexperienced Gretl user, I ran into an issue which
must have a simple solution, however I could find it nowhere.
My question is the following :
In a time series which comprises daily entries over 10 years, how
may I select a certain period of each year, i.e. only March-April
for instance ? Up to now I have had to resort to a most
inefficient solution, although it seems to work, whereby a given
variable time (containing only the dates of the entries under a
format 20040101, which Gretl doesn't recognise as a date) [...]
Just pointing out, if these dates contained punctuation --
2004-01-01 or 2004/01/01 -- and they're in the first column of
imported data, they'd be recognized OK. In addition, if the
daily data is complete (with regular 5, 6, or 7 days per week) you
can get the dates set in gretl using the "setobs" command, or the
"Dataset structure" item under the "Data" menu. Then the $obsminor
accessor would get you a series of months.
was used to open a new variable
month=int((time-10000*int(time/10000))/100) This works, in that I
now have a variable returning the number of each month. I then
proceeded to restrict based on the criterion month >= 2 && month
<= 4 However the result of this is that I have a series which is
not chronological any more.
The data will still be in chronological order, surely? But they
won't be a time series in the usual sense, since the sequence
contains huge gaps.
If I convert it back to a time series, it logically gives me a
roughly two-year-long period with daily entries. Which means I
should proceed to isolate the trimester of each year manually.
This is very inefficient and time-consuming.
Sorry, I don't understand what exactly it is that's inefficient and
time-consuming.
As this is surely not an over-the-top functionality, I assume
there must be a simpler and more efficient way of selecting a
given period within each year, repetitively over several years.
Can someone kindly help me out ?
If you want to treat the March-April data for several years as if
they were a time series (i.e. ignore the gaps), you can give a
special periodicity with the "setobs" command, for example:
series month = $obsminor
smpl month==3 || month==4 --restrict
setobs 61 2004.1 --time-series
This will give you a "calendar" with 61 days per year.
Allin Cottrell