Range frequency and input frequency

Topics: Database Management, Dates, Kalman Filtering
Nov 12, 2015 at 5:01 PM
Dear all,

I have a rather basic question I hope you can help me with.

I am writing a code to compute output gaps that uses the functions "hpf" and "filter". When I run the function hpf, I get the following error: "Input range frequency fails to match input time series frequency." .

Similarly when I use filter, I get "Input range frequency fails to match input time series frequency.". IRIS solves the model but I get a series of zeros for output gap and trend.

My data are at yearly frequency and when I upload them I write the following:
da = dbload('EM_AG.csv', 'freq',1);
range = yy(1998):yy(2015);    
and then I run
[gdp,gdp_gap]= hpf(gdp_full,(range), 'lambda=',6.5);
[m,smooth,v]= filter(m,d,range,d,'relative',true);
Am I missing something when uploading the data? What can be the cause of the error?

Best regards,

z
Coordinator
Nov 12, 2015 at 6:11 PM
Hi,

In the code you posted, did you mean to write
[gdp,gdp_gap]= hpf(da.gdp_full,(range), 'lambda=',6.5);
i.e. reference to gdp_full in the da database as the first input argument (da.gdp_full instead of gap_full). If not, where does the gap_full series come from?

Please email me the files that produce the error: jaromir (dot) benes (at) gmail (dot) com.

Best,
Jaromir
Nov 12, 2015 at 7:06 PM
Hi Jaromir,

please find attached the files and the data to run the code. The variables' specification should be fine. If i switch from quarterly to annual frequency it doesn't go through.

Best,

fadi

Coordinator
Nov 12, 2015 at 7:30 PM
Could you please attach the files? :) Email me at the address above.

J.
Coordinator
Nov 12, 2015 at 8:06 PM

Hi Fadi

I see the problem now. In the CSV data file, the date column contains numbers 1998, 1999, etc. which are not considered dates but just plain numbered observations in IRIS, and hence the resulting time series in the database are not time series based on annual (yearly) frequency but time series with indeterminate frequency. The option ‘freq=‘ in dbload() does not work in this context (with indeterminate frequency), it only works with proper date frequencies.

The fix is very simple though. Replace the numbers in the first column with strings 1998Y, 1999Y, etc. which is the default way annual dates are represented in IRIS. If the file contains a continuous (uninterrupted) range, you can simply put the date only to the first observation, and leave the rest beneath it empty (comes handy if the series are long…) — in other words, you only need to write 1998Y, and delete the rest of the dates.

Hope this help.

Best
Jaromir




Marked as answer by jaromirbenes on 11/12/2015 at 1:06 PM
Nov 12, 2015 at 9:38 PM
You can also specify the date format (without changing the csv file to 1998Y):
da = dbload('EM_AG.csv','dateFormat','YYYY');
Marked as answer by jaromirbenes on 11/12/2015 at 10:23 PM
Nov 13, 2015 at 1:01 AM
Thanks a lot!