Thanks for so quick a solution. I have tried and can confirm that the
ods importer now respects the dates in the ods file. I think that
what you are doing is probably what most people will want. In
Rmetrics it is possible to strip the NAs from a daily series (all 5
days per week) and retain what you are proposing. It is also possible
to add back in the na's to the reduced series to recover the original
5-day per week series with missing values. I have used this facility
to then interpolate for the missing values.
I have also had a look at adding data cells containing =NA() (or #N/A)
opposite the holiday dates in the ods file. These are imported into
gretl as 0. If I replace the =NA() by any string such as NA then that
is also imported as 0. If I just enter the date in the first column
and leave the data entries blank they appear as blank in gretl's |
data | display values | and I presume are then treated as missing by
gretl.
Should the =NA() in ods file be also treated as missing? As one who
uses R it might also be useful to recognise NA as a missing value.
Best regards
John
On 08/11/2007, Allin Cottrell <cottrell(a)wfu.edu> wrote:
On Thu, 8 Nov 2007, John C Frain wrote:
> I imported some daily daily data into gretl using the ods importer.
> Dates were in column one and variable names in row 1. It recognised
> my data as a daily time series with 5 days per week and had the
> correct start date. Excellent!!
So far, so good.
> However I found a small problem (or at least it did not do
> exactly what i wanted). The first few rows of the ods file were
>
> Date Alpha Beta Gamma Delta
> 1991-12-30 1.6490 -0.0307 0.5301 -0.0587
> 1991-12-31 1.6497 -0.0303 0.5303 -0.0588
> 1992-01-02 1.6510 -0.0273 0.5304 -0.0583
> 1992-01-03 1.6517 -0.0260 0.5305 -0.0581
> 1992-01-06 1.6517 -0.0258 0.5305 -0.0582
> 1992-01-07 1.6515 -0.0245 0.5301 -0.0576
>
> The first of these is a Monday. Note that Wednesday 1992-01-01
> was missing from my data set as this is a bank holiday. Gretl
> however inserted a 1 January date and allocated the data from 2
> January to 1 January. I assume that gretl decides correctly
> that the series is daily, 5 days per week, and starts on
> 1991-12-30. It then sets up a list of dates with 5 days per
> week and allocates the data to those dates without reference to
> the dates on the ods file.
Yes, that's what happened, though in fact it was not what was
intended. Fixed in CVS and snapshot.
> Would it be possible for a future version of the ods importer to
> check that the dates correspond. If they did not perhaps it
> could write NAs in the gretl file against the missing date and
> then check the next date.
The importer should now respect the date labels, provided they're
consistent. It would be possible to insert NAs, but I think in
most cases that's not what one wants. With NAs, you can't do
anything autoregressive. And with daily market data where the NAs
(if inserted) represent non-trading days it's probably legitimate
to treat the data as if there's nothing missing.
Suppose the markets didn't trade on a certain Thursday. Do we say
that Friday's y(-1) is NA, or that it is Wednesday's observation
on y? I suspect most of the time you'd want the latter (and would
be annoyed if gretl stuck in NAs that weren't there in the
original file).
Allin.
_______________________________________________
Gretl-users mailing list
Gretl-users(a)lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users
--
John C Frain
Trinity College Dublin
Dublin 2
Ireland
www.tcd.ie/Economics/staff/frainj/home.html
mailto:frainj@tcd.ie
mailto:frainj@gmail.com