Main Content

Data Preprocessing

Format, plot, and transform time series data

Economic and financial time series data can require preprocessing or transforming before you can analyze or model them. While base MATLAB® has general purpose and timetable functionality for preprocessing or cleaning data (for example, the log function removes an exponential trend from series and Data Cleaner enables you to clean messy data interactively), Econometrics Toolbox™ has specialized functionality for preprocessing financial time series. For example, you can obtain a common or desired time base by aggregating multiple series, convert price series to growth rates, or decompose series into additive trend and cyclical components.


Econometric ModelerAnalyze and model econometric time series


LagOpCreate lag operator polynomial


expand all

convert2dailyAggregate timetable data to daily periodicity (Since R2021a)
convert2weeklyAggregate timetable data to weekly periodicity (Since R2021a)
convert2monthlyAggregate timetable data to monthly periodicity (Since R2021a)
convert2quarterlyAggregate timetable data to quarterly periodicity (Since R2021a)
convert2semiannualAggregate timetable data to semiannual periodicity (Since R2021a)
convert2annualAggregate timetable data to annual periodicity (Since R2021a)
addBusinessCalendarAdd business calendar awareness to timetables (Since R2020b)
price2retConvert prices to returns
ret2priceConvert returns to prices
lagmatrixCreate lagged time series data
hpfilterHodrick-Prescott filter for trend and cyclical components
bkfilterBaxter-King filter for trend and cyclical components (Since R2023a)
cffilterChristiano-Fitzgerald filter for trend and cyclical components (Since R2023a)
hfilterHamilton filter for trend and cyclical components (Since R2023a)
recessionplotOverlay recession bands on time series plot
filterApply lag operator polynomial to filter time series
isStableDetermine stability of lag operator polynomial
reflectReflect lag operator polynomial coefficients around lag zero
toCellArrayConvert lag operator polynomial object to cell array
isEqLagOpDetermine if two LagOp objects are same mathematical polynomial
isNonZeroFind lags associated with nonzero coefficients of LagOp objects
minusLag operator polynomial subtraction
mldivideLag operator polynomial left division
mrdivideLag operator polynomial right division
mtimesLag operator polynomial multiplication
plusLag operator polynomial addition


Interactive Workflows

Transform Time Series Data

Decompose Time Series Data

Lag Operator Polynomial Operations