Name

da2m — transformation of daily data into monthly ones

CALLING SEQUENCE

ts=da2m(ts,ind,dropna)

PARAMETERS

Input

• ts = a daily timeseries

• ind =

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

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

  * n between 1 and 28 if the monthly data is to be the value of the n-th day of the month

  * n > 29 if the monthly data is to be the value of the last day of the month

• 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 monthly time series

DESCRIPTION

Transforms daily data into monthly 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)tsm=da2m(tsd,0)
2)tsm=da2m(tsd,0,'dropna')
3)tsm=da2m(tsd,1)
4)tsm=da2m(tsd,1,'dropna')
5)tsm=da2m(tsd,31)
6)tsm=da2m(tsd,31,'dropna')
 
you obtain a monthly series 
- in case 1): from 2002m3 to 2007m7 with only NA values
- in case 2): from 2002m3 to 2007m7 with values equal for each month to the mean of all non NA daily values in the month
- in case 3): from 2002m3 to 2007m8 with values equal to the values of each first day in the month, which can be eventually NA
- in case 4): from 2002m3 to 2007m8 with values equal to the values of each first day in the month ('dropna' does not change anything on this case)
- in case 5): from 2002m2 to 2007m7 with values equal to the values of each last day in the month
- in case 6): from 2002m2 to 2007m7 with values equal to last non NA value in the month
 

               

AUTHOR

Eric Dubois (2007)