m2q — transforms monthly data into quarterly ones
tsout=m2q(tsin,ind)
tsin = a monthly timeseries
ind =
- -1 if the quarterly data is to be the sum of the corresponding months
- 0 if the quarterly data is to be the mean of the corresponding months
- 1 if the quarterly data is to be the value of the first month
- 2 if the quarterly data is to be the value of the second month
- 3 if the quarterly data is to be the value of the third month
ind is optional; if not provided, it is set to -1
tsout = the corresponding quarterly time series
if x is a monthly ts (such as reshape([1:24],'1978m2') then 1) y = m2q(x) 2) y = m2q(x,-1) 3) y = m2q(x,3) Examples 1 and 2 give exactly the same result: a quarterly ts (from 1978q2 to 1979q4 with values 12, 21, 30, 39, 48, 57, 66 with the ts x above). Example 3 gives a quarterly ts whose values come from the third month of each quarter (from 1978q1 to 1979q4 with values 2, 5, 8, 11, 14, 17, 20, 23 with the ts x above).