Name

da2q — transformation of daily data into quarterly ones

CALLING SEQUENCE

ts=da2q(ts,ind,dropna)

PARAMETERS

Input

• ts = a daily timeseries

• ind =

  * -1 if the quarterly data is to be the sum of the corresponding days

  * 0 if the  quarterly data is to be the mean of the corresponding days

  * n between 1 and 90 if the quarterly data is to be the value of the n-th day of the quarter

  * n > 90 if the quarterly data is to be the value of the last day of the quarter

• dropna = 'dropna' if the user wants to withdraw all NA values from the calculations (case ind=0 or -1) or to take the last non NA value of the quarter (case ind > 90)

• if not entered then all NA values are considered

Output

• ts = the corresponding quarterly time series

DESCRIPTION

Transforms daily data into quarterly ones.

EXAMPLE

Let tsd be a daily ts from 2000/02/15 to 20007/08/18 with all week-end values set to %nan
then if you run:
1)tsq=da2q(tsd,0)
2)tsq=da2q(tsd,0,'dropna')
3)tsq=da2q(tsd,1)
4)tsq=da2q(tsd,1,'dropna')
5)tsq=da2q(tsd,91)
6)tsq=da2q(tsd,91,'dropna')
 
you obtain a quarterly time series 
- in case 1): from 2002q2 to 2007q2 with only NA values
- in case 2): from 2002q2 to 2007q2 with values equal for each quarter to the mean of all non NA daily values in the quarter
- in case 3): from 2002q2 to 2007q3 with values equal to the values of each first day in the quarter, which can be eventually NA
- in case 4): from 2002q2 to 2007q3 with values equal to the values of each first day in the quarter ('dropna' does not change anything on this case)
- in case 5): from 2002q2 to 2007q2 with values equal to the values of each last day in the quarter
- in case 6): from 2002q2 to 2007q2 with values equal to last non NA value in the quarter
 

               

AUTHOR

Eric Dubois (2007)