Contents
- What is time series data?
- Why does forecasting matter?
- Which methods are used to forecast time series?
- How is forecast accuracy measured?
- A worked example
- Practical steps for a time series analysis
- Frequently asked questions
- What is time series data in simple terms?
- What is the difference between time series and cross-sectional data?
- Which error measure is best for comparing forecasts?
- How many observations are needed for forecasting?
- Can time series be forecast with Excel?
- What is the difference between forecasting and prediction?
- References
Versi bahasa Indonesia: Time Series Adalah: Data yang Bisa Meramal
Short answer: time series data are observations collected in time order, such as monthly prices or annual production, and they are used to forecast future values from past patterns. A time series is usually described by four components: trend, seasonality, cycles, and irregular variation. The accuracy of competing forecasting methods is compared with error measures such as MAE, MSE, RMSE, and MAPE; the smaller the error, the better the method.
| Component | What it describes | Example |
|---|---|---|
| Trend | Long-run upward or downward movement | Rising rice consumption as population grows |
| Seasonality | Pattern that repeats within a fixed period | Higher food prices before major holidays every year |
| Cycle | Longer waves without a fixed period | Commodity booms and busts over several years |
| Irregular | Random shocks left after the other components | A sudden flood that disrupts supply for one month |
What is time series data?
Time series data record one variable for one unit at successive points in time. The intervals may be hours, days, weeks, months, quarters, or years, but they must be regular and in order. Daily exchange rates, monthly rainfall at one weather station, quarterly GDP, and annual national rice production are all time series. The ordering is what makes them special: each observation carries information about its neighbors, and the past contains clues about the future.
Football fans use the same logic without calling it time series analysis. Before a match, commentators recall the history between the two clubs. When one club has beaten the other in every recent meeting, home or away, most fans expect the same result again. When two clubs have a balanced record, predictions split evenly. Thus, the history of past results becomes the basis for expecting the next one, which is exactly the idea behind forecasting from a time series.
The same reasoning appears in many fields. Meteorological agencies combine climate models with decades of rainfall records to predict when the rainy season will start. Shopping centers know from years of visitor data that traffic peaks after office hours and in the weeks before major holidays. Commodity traders know that prices tend to fall after the main harvest. In each case, a pattern observed repeatedly over time supports a decision about the future.
Why does forecasting matter?
Forecasts drive decisions. When the rainy season is expected from October to April, city governments clean drainage channels before October to reduce flooding, and farmers prepare land so that planting coincides with the first reliable rains. Some ministries of agriculture publish planting calendars that combine rainfall forecasts with soil conditions to guide farmers on when to plant which crop.
In business, the stakes are equally concrete. A manufacturer supplying a retail chain must decide how much to produce in the months before a holiday season, how much to ship, and how much safety stock to hold. An underestimate leads to empty shelves; customers switch to a competitor’s product and may never return. An overestimate ties up capital in unsold goods and storage. Supply chain and production planning teams therefore rely on time series forecasts to balance these risks. Consequently, the quality of a forecast translates directly into profit or loss.
Which methods are used to forecast time series?
Forecasting methods range from simple to complex, and simple methods often perform surprisingly well. Firstly, naive methods use the last observed value, or the value from the same season last year, as the forecast. Secondly, moving averages smooth the series by averaging the most recent observations. Thirdly, exponential smoothing gives more weight to recent observations; Holt’s method adds a trend, and the Holt-Winters method adds seasonality. Fourthly, ARIMA and SARIMA models describe the series through its own lags and past errors, and they are the standard statistical approach for many economic and agricultural series. Finally, regression with time trends, VAR models for several related series, and machine learning methods are used when other information or several variables are involved.
No single method is best for every series. A series with a strong and stable seasonal pattern may be forecast well by Holt-Winters, while a series with complex autocorrelation may need SARIMA. The practical approach is to try several candidate methods and compare their accuracy on data that were not used to fit them.
How is forecast accuracy measured?
Forecast accuracy is measured by comparing forecasts with actual values. The forecast error for period t is et = At − Ft, where At is the actual value and Ft the forecast. Four measures summarize these errors:
| Measure | Formula | Interpretation |
|---|---|---|
| MAE (mean absolute error) | Σ|et| / n | Average size of the error, in the original units |
| MSE (mean squared error) | Σet² / n | Penalizes large errors more heavily |
| RMSE (root mean squared error) | √MSE | Like MSE, but back in the original units |
| MAPE (mean absolute percentage error) | (Σ|et / At| / n) × 100% | Average error as a percentage of the actual value |
A worked example
Two methods forecast monthly sales (in tons) for four months:
| Month | Actual | Method A | Error A | Method B | Error B |
|---|---|---|---|---|---|
| 1 | 100 | 96 | 4 | 110 | −10 |
| 2 | 120 | 114 | 6 | 118 | 2 |
| 3 | 110 | 115 | −5 | 108 | 2 |
| 4 | 130 | 125 | 5 | 131 | −1 |
For Method A, MAE = (4 + 6 + 5 + 5) / 4 = 5.0 tons, MSE = (16 + 36 + 25 + 25) / 4 = 25.5, and RMSE = 5.05. For Method B, MAE = (10 + 2 + 2 + 1) / 4 = 3.75 tons, MSE = (100 + 4 + 4 + 1) / 4 = 27.25, and RMSE = 5.22. Method B has the smaller MAE, but Method A has the smaller MSE and RMSE, because Method B made one large error in month 1. MAPE gives A = (4/100 + 6/120 + 5/110 + 5/130) / 4 × 100% = 4.35% and B = (10/100 + 2/120 + 2/110 + 1/130) / 4 × 100% = 3.56%.
The example shows that the measures can disagree. MAE and MAPE favor the method that is usually closer, while MSE and RMSE favor the method that avoids large misses. The choice therefore depends on the cost of errors. When one large error is very costly, for example a stock-out before a holiday, RMSE is the better guide. When errors of all sizes cost about the same per unit, MAE is appropriate. MAPE is convenient for comparing series of different scales, but it becomes unstable when actual values are close to zero.
Practical steps for a time series analysis
A typical analysis follows a sequence. Firstly, the series is plotted to reveal trend, seasonality, outliers, and structural breaks. Secondly, the series is decomposed into its components, which shows how strong the trend and seasonal patterns are. Thirdly, stationarity is tested with the augmented Dickey-Fuller test, and the series is differenced when necessary. Fourthly, candidate models are fitted to a training period. Fifthly, each model forecasts a hold-out period, and the errors are compared using the measures above. Finally, the best model is refitted on all data and used for the actual forecast, with prediction intervals that show the uncertainty. Thus, the choice of method is based on evidence from the data rather than on habit. The same sequence applies whether the analysis is done in Excel, R, Python, or dedicated forecasting software.
Related guides on Catatan Budi: ACF and PACF for SARIMA, auto ARIMA in Python, ARCH and GARCH models, and cross-sectional, time series, and panel data.
Frequently asked questions
What is time series data in simple terms?
Time series data are measurements of the same thing taken repeatedly over time at regular intervals, such as daily temperature or monthly sales.
What is the difference between time series and cross-sectional data?
Time series data follow one unit over many periods, whereas cross-sectional data compare many units at one point in time.
Which error measure is best for comparing forecasts?
No single measure is always best. RMSE is preferred when large errors are especially costly, MAE when all errors matter equally, and MAPE when series of different scales are compared.
How many observations are needed for forecasting?
Simple methods can work with a few dozen observations. Seasonal models usually need at least three to four full seasonal cycles, for example 36 to 48 monthly observations.
Can time series be forecast with Excel?
Yes. Excel provides moving averages, exponential smoothing, and the FORECAST.ETS function, which implements a seasonal exponential smoothing method. More advanced models such as SARIMA require statistical software or Python.
What is the difference between forecasting and prediction?
In time series work, forecasting refers to estimating future values from past observations. Prediction is a broader term that also includes estimating values for new cases in cross-sectional data, for example with a regression model.
References
- Box, G. E. P., Jenkins, G. M., Reinsel, G. C., and Ljung, G. M. (2015). Time Series Analysis: Forecasting and Control (5th ed.). Wiley.
- Hyndman, R. J., and Athanasopoulos, G. (2021). Forecasting: Principles and Practice (3rd ed.). OTexts.
Discussion
No comments yet. Have a question about this topic? Write it below and I will do my best to answer.