different trading days

Use this forum to post questions about syntax problems or general programming issues. Questions on implementing a particular aspect of econometrics should go in "Econometrics Issues" below.

different trading days

Postby turkhanali » Mon Oct 25, 2010 5:24 am

I want to estimate a multivariate garch model for a few countries. Removing the weekends is easy. But non-trading holidays are different for different countries . How can I deal with this problem for multivariate garch?

I am thinking to drop the data point that is non-trading before computing returns for series over the two days which have trading data. The problem is that data of different countries in excel does not match each other in same row for same day due to different trading days . I am planing to manually adjust it so that two data shown in same day to be in same row. After that I drop all the non trading days so that every data have same trading days returns. However, giving more than 9000 observations for each series, it is really tough. I am wondering is there any better way let the RATS automatically match the different series according to date and let the non-trading day shows na.

I really appreciate your kind suggestion on this matter.
turkhanali
 
Posts: 16
Joined: Fri Jul 17, 2009 1:47 am

Re: different trading days

Postby moderator » Mon Oct 25, 2010 9:54 am

So, you have several series that (may) contain NAs, and you want to determine a common sample range that

a) excludes entries where any series is NA and
b) the entries prior to any NAs

Is that correct?

And how many countries do you have? If it's just one or two, a single SET instruction is probably all you need, but if you might have quite a few, a slightly more general approach might make sense. Let me know and I'll try to suggest something.

Regards,
Tom Maycock
moderator
Site Admin
 
Posts: 306
Joined: Thu Oct 19, 2006 4:33 pm

Re: different trading days

Postby TomDoan » Mon Oct 25, 2010 10:55 am

If you have the original price data, the most common way of handling this that I've seen is to duplicate the price from the last trading day before converting to returns, so the return on a non-trading day is 0, by definition. If you have return data only, with gaps in the date sequence for non-trading days, you can just patch over the NA's in the returns with 0's. Do you have a single data file with all countries? If so, how is the non-trading day information shown?
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Re: different trading days

Postby turkhanali » Mon Oct 25, 2010 8:05 pm

Dear Tom,

Thank you fro your reply. Sorry for not making myself clear. In fact I have 10 countries data series in 10 worksheet of excel. every data series with its own date and corresponding data. If I combine all the series into one sheet. the dates will not match each other. part of the series after combine in excel looks as follows:

price1 price2 price3 price4 price5
1999-11-1 1493.096 1999-10-6 714.19 1999-10-21 367.23 1999-10-6 588.749 1999-10-12 1542.8
1999-11-2 1487.469 1999-10-7 734.73 1999-10-22 377.16 1999-10-7 585.345 1999-10-13 1526.96
1999-11-3 1475.684 1999-10-8 743.84 1999-10-26 379.54 1999-10-8 588.237 1999-10-14 1536.74
1999-11-4 1464.828 1999-10-11 747.39 1999-10-27 379.61 1999-10-11 584.06 1999-10-15 1510.26
1999-11-5 1465.232 1999-10-12 745.57 1999-10-28 389.76 1999-10-12 571.382 1999-10-18 1460.23
1999-11-8 1471.375 1999-10-13 737.28 1999-10-29 395.55 1999-10-13 571.947 1999-10-19 1471.8
1999-11-9 1464.03 1999-10-14 738.05 1999-11-1 391.55 1999-10-14 567.777 1999-10-20 1507.31

In this case, simply drop out the na or empty series may lead to spurious results if I am going to do multivariate analysis. I mean the return I got for price1 will not match same return for price2 and others will not match too.

I want try to read the whole data series including the data into RATS. Then create a matrix of length*var where length equals to number of entry created by the data wizard, say it from Nov 29, 1980 to Oct. 25, 2010 with 5 days per week. using loops to fill the matrix with the data if the corresponding date of that data match with the reference date of the matrix. Then we should end up a matrix with data that match dates each other. For instance, the dat shown above should look as follows:

date price1 price2 price3 price4 price5
1999-10-6 na 714.19 na 588.749 na
1999-10-7 na 734.73 na 585.345 na
1999-10-8 na 743.84 na 588.237 na
1999-10-11 na 747.39 na 584.06 na
1999-10-12 na 745.57 na 571.382 1542.8
1999-10-13 na 737.28 na 571.947 1526.96
1999-10-14 na 738.05 na 567.777 1536.74
1999-10-15 na na na na 1510.26
1999-10-18 na na na na 1460.23
1999-10-19 na na na na 1471.8
1999-10-20 na na na na 1507.31
1999-10-21 na na 367.23 na na
1999-10-22 na na 377.16 na na
1999-10-26 na na 379.54 na na
1999-10-27 na na 379.61 na na
1999-10-28 na na 389.76 na na
1999-10-29 na na 395.55 na na
1999-11-1 1493.096 na 391.55 na na
1999-11-2 1487.469 na na na na
1999-11-3 1475.684 na na na na
1999-11-4 1464.828 na na na na
1999-11-5 1465.232 na na na na
1999-11-8 1471.375 na na na na
1999-11-9 1464.03 na na na na
(note: This is special case where there is no date with prices available across different countries. However, giving 9000 observations, there are plenty price available for same date)

Then we can drop out all the entry with nas and do the analysis with data commonly available for the same day across prices. In this case we take log difference. It should represent returns on same days.

I hope I made myself clear in this case.

Thanks in advance.
turkhanali
 
Posts: 16
Joined: Fri Jul 17, 2009 1:47 am

Re: different trading days

Postby TomDoan » Tue Oct 26, 2010 10:02 am

If they're already in separate worksheets in Excel, I would leave them that way. Do a separate DATA instruction for each, using the SHEET option to read the sheet that you want. That will give you NA's for the missing data points. At that point, you might want to export the series together to a single spreadsheet which will have all the dates aligned. That's probably much easier than trying to do the same type of alignment in Excel itself.
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Re: different trading days

Postby turkhanali » Tue Oct 26, 2010 9:19 pm

Dear Tom,

Thank you very much for quick reply. RATS is fantastic.

I got it.
turkhanali
 
Posts: 16
Joined: Fri Jul 17, 2009 1:47 am


Return to Help With Programming

Who is online

Users browsing this forum: No registered users and 0 guests

cron