Y = convert(X,NewFreq,...)
Y = convert(X,NewFreq,Range,...)
X
[ tseries ] - Input tseries object that will be converted to a new frequency, freq
, aggregating or intrapolating the data.
NewFreq
[ numeric | char ] - New frequency to which the input data will be converted: 1
or 'A'
for yearly, 2
or 'H'
for half-yearly, 4
or 'Q'
for quarterly, 6
or 'B'
for bi-monthly, and 12
or 'M'
for monthly.
Range
[ numeric ] - Date range on which the input data will be converted.
Y
[ tseries ] - Output tseries created by converting X
to the new frequency.'ignoreNaN='
[ true
| false
] - Exclude NaNs from agreggation.
'missing='
[ numeric | NaN
| 'last'
] - Replace missing observations with this value.
'method='
[ function_handle | 'first'
| 'last'
| @mean
] - Method that will be used to aggregate the high frequency data.
'select='
[ numeric | Inf
] - Select only these high-frequency observations within each low-frequency period; Inf means all observations will be used.
'method='
[ char | 'cubic'
| 'quadsum'
| 'quadavg'
] - Interpolation method; any option available in the built-in interp1
function can be used.
'position='
[ 'centre'
| 'start'
| 'end'
] - Position of the low-frequency date grid.
The function handle that you pass in through the 'method' option when you aggregate the data (convert higher frequency to lower frequency) should behave like the built-in functions mean
, sum
etc. In other words, it is expected to accept two input arguments:
The function will be called with the second input argument set to 1, as the data are processed en block columnwise. If this call fails, convert
will attempt to call the function with just one input argument, the data, but this is not a safe option under some circumstances since dimension mismatch may occur.