transformation of daily data into monthly ones
ts=da2m(ts,ind,dropna)
* 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)
* ts = the corresponding monthly time series
load(GROCERDIR+'/data\tsd.dat') // tsd is a daily ts from 95/01/02 to 96/02/16 with all week-end values lacking tsm=da2m(tsd,0) //you obtain a monthly series from 2002m3 to 2007m7 with only NA values tsm=da2m(tsd,0,'dropna') //you obtain a monthly series from 2002m3 to 2007m7 with values equal for each month to the mean of all non NA daily values in the month tsm=da2m(tsd,1) //you obtain a monthly series from 2002m3 to 2007m8 with values equal to the values of each first day in the month, which can be eventually NA sm=da2m(tsd,1,'dropna') //you obtain a monthly series 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) tsm=da2m(tsd,31) //you obtain a monthly series from 2002m2 to 2007m7 with values equal to the values of each last day in the month tsm=da2m(tsd,31,'dropna') //you obtain a monthly series from 2002m2 to 2007m7 with values equal to last non NA value in the month | ![]() | ![]() |