Time series data is a collection of data points recorded over time, that are used to analyse trends and patterns in a specific variable. This type of data is commonly used to track financial indicators, weather conditions, and website metrics. Forecasting time series data is an important task that can be achieved using various methods. Two naive approaches are to use the last observation or the average of all past observations as the basis for future predictions. A more sophisticated approach is to combine these two strategies using exponential smoothing.
Simple exponential smoothing is a weighted average method that assigns larger weights to more recent observations and smaller weights to older observations. The weights decrease exponentially as the observations get further from the present. The choice of smoothing weight, or α, is an important decision that can significantly impact the accuracy of the forecast. A higher smoothing weight gives more weight to the most recent observations. On the other hand, a lower smoothing weight gives more weight to past observations, and has a greater smoothing effect.
While simple exponential smoothing is a good starting point for forecasting time series, it does have limitations. The main drawback is that it assumes no trend or seasonality. If there is a trend in the data, such as a gradual increase over time, simple exponential smoothing will not capture it. Similarly, if there is seasonality in the data, such as a monthly pattern, simple exponential smoothing will not account for it.
Holt-Winters Exponential Smoothing
To capture trend and seasonality, the Holt-Winters (also known as ETS; error, trend, season) method can be used. This method extends simple exponential smoothing by adding a trend and seasonal component to the model. The trend component captures the direction and magnitude of any overall trend in the data. The seasonal component captures any seasonal patterns that repeat over a fixed period of time.
In some cases, it may be useful to incorporate a damping effect in the trend, as the trend has a tendency to be over exaggerated. This can be accomplished by introducing a parameter into the trend equation, which is a constant value that controls the damping. This results in a trend that gradually approaches a steady state, rather than continuing to increase or decrease indefinitely
The seasonal component is calculated by averaging the values of the same season across all years in the time series, with a weighted average. For example, if the time series has monthly data, the expected seasonal value for January would be the weighted average of all January values in the time series.
The final equation is as follows:
Forecast t+1 = Level t + Trend t + Season t
Where level, trend and season are all based on the weighted average of past values.
The three elements can be combined either by addition or multiplication.
Additive combination is used when the amplitude of the seasonal pattern does not depend on the level or trend of the time series. It is best suited for data where the seasonal fluctuations are relatively constant over time. In this case, the seasonal component is simply added to the equation to produce the forecast.
Multiplicative combination is used when the amplitude of the seasonal pattern varies with the level of the time series. This is best suited for data where the seasonal fluctuations increase or decrease proportionally with the level of the time series. In this case, the seasonal component is multiplied by the level of the time series to produce the forecast.
This means there are ways to combine the three components together, represented using a three letter abbreviation. For example ETS(A,Ad,M) would mean an Additive error, Additive damped trend and Multiplicative season. One point to watch out for, is that depending on the data some of these models can be unstable. As an example, if the data contain 0’s or negative values, then multiplication can cause errors.
We have many potential combinations of parameters and smoothing coefficients. Fortunately, most programs will automatically try many different combinations. However we still need a way to select the best model. It would be a mistake to use something such as R2 , as that could lead to overfitting. Instead a measure known as an information criterion is used, which is a statistical method for evaluating a model’s performance.
ETS can be directly implemented using a programming language such as python. Alternatively, a no-code tool with this functionality, such as Alteryx could be used. This allows you to implement a forecast with just a few clicks. Here is what a barebones implementation in Alteryx looks like.
We can see that our forecast has successfully captured the trend and seasonality of our data. In this case we use a multiplicative model, because the seasonal swings grow in size as the trend increases.
Exponential smoothing is a tried and tested technique for forecasting time series data. When used correctly it can produce accurate forecasts that take the seasonality and trend of your data into account. To learn more, Forecasting principles and Practice is a good starting place. The authors provide a clear overview of important fundamentals without going into the weeds. To learn more about visualizing time series data, check this post out.
Data ya mfululizo wa wakati ni mkusanyiko wa pointi za data zilizorekodiwa kwa muda, ambazo hutumiwa kuchambua mwenendo na mifumo katika kutofautiana maalum. Aina hii ya data ni kawaida kutumika kufuatilia viashiria vya kifedha, hali ya hewa, na vipimo tovuti. Utabiri wa data ya mfululizo wa wakati ni kazi muhimu ambayo inaweza kupatikana kwa kutumia mbinu mbalimbali. Njia mbili za upumbavu ni kutumia uchunguzi wa mwisho au wastani wa uchunguzi wote wa zamani kama msingi wa utabiri wa baadaye. Mbinu ya kisasa zaidi ni kuchanganya mikakati hii miwili kwa kutumia kufuta kwa kasi. Simple exponential smoothing ni njia ya wastani wa uzito ambayo inatoa uzito mkubwa kwa uchunguzi wa hivi karibuni na uzito mdogo kwa uchunguzi wa zamani. Uzito hupungua kwa kasi kadiri uchunguzi unavyosonga mbali na wakati uliopo. Uchaguzi wa smoothing uzito, au α, ni uamuzi muhimu ambayo inaweza kwa kiasi kikubwa kuathiri usahihi wa utabiri. Uzito wa juu wa kusawazisha hutoa uzito zaidi kwa uchunguzi wa hivi karibuni. Kwa upande mwingine, uzito wa chini wa kusawazisha hutoa uzito zaidi kwa uchunguzi wa zamani, na ina athari kubwa ya kusawazisha. Wakati rahisi exponential smoothing ni nzuri kuanzia hatua kwa ajili ya utabiri wa mfululizo wa muda, haina mipaka. Hasara kuu ni kwamba haina dhana ya mwenendo au msimu. Kama kuna mwelekeo katika data, kama vile ongezeko la hatua kwa hatua kwa muda, rahisi exponential smoothing si kukamata yake. Vivyo hivyo, kama kuna msimu katika data, kama vile muundo wa kila mwezi, rahisi exponential smoothing si akaunti kwa ajili yake. Holt-Winters Exponential Smoothing (HWES) ni njia ya kawaida ya kuashiria mwenendo wa msimu wa msimu wa msimu wa msimu wa msimu wa msimu wa msimu wa msimu wa msimu wa msimu wa msimu wa msimu wa msimu wa msimu wa msimu wa msimu wa msimu wa msimu. Mbinu hii inaongeza rahisi exponential smoothing kwa kuongeza mwelekeo na msimu sehemu ya mfano. kipengele mwenendo inachukua mwelekeo na ukubwa wa mwenendo wowote wa jumla katika data. Sehemu ya msimu inachukua mifumo yoyote ya msimu ambayo hurudiwa kwa kipindi fulani cha muda. Katika baadhi ya kesi, inaweza kuwa na manufaa ya kuingiza damping athari katika mwenendo, kama mwenendo ina mwelekeo wa kuwa juu ya exaggerated. Hii inaweza kutimizwa kwa kuanzisha parameter katika equation mwelekeo, ambayo ni thamani ya mara kwa mara kwamba udhibiti damping. Hii inaongoza kwa mwenendo ambao unakaribia hatua kwa hatua hali ya kudumu, badala ya kuendelea kuongezeka au kupungua kwa muda usiojulikana, kipengele cha msimu kinahesabiwa kwa wastani wa maadili ya msimu huo katika miaka yote katika mfululizo wa wakati, na wastani wa uzito. Kwa mfano, ikiwa mfululizo wa muda una data ya kila mwezi, thamani ya msimu inayotarajiwa kwa Januari itakuwa wastani wa uzito wa maadili yote ya Januari katika mfululizo wa muda. Kwa mfano, kwa mfano, t + 1 = kiwango cha t + mtiririko wa t + msimu wa t, ambapo kiwango, mwelekeo na msimu wote hutegemea wastani wa uzito wa maadili ya zamani. Vitu hivyo vitatu vinaweza kuchanganywa kwa kuongeza au kuzidisha. Mchanganyiko wa kuongeza hutumiwa wakati amplitude ya muundo wa msimu haitegemei kiwango au mwelekeo wa mfululizo wa wakati. Ni bora inafaa kwa ajili ya data ambapo fluctuations msimu ni kiasi mara kwa mara kwa muda. Katika kesi hii, sehemu ya msimu ni tu aliongeza kwa equation kuzalisha utabiri. Mchanganyiko multiplicative ni kutumika wakati amplitude ya muundo wa msimu inatofautiana na ngazi ya mfululizo wa muda. Hii ni bora inafaa kwa ajili ya data ambapo fluctuations msimu kuongezeka au kupungua kwa usawa na ngazi ya mfululizo wa muda. Katika kesi hii, sehemu ya msimu ni kuzidishwa na ngazi ya mfululizo wa muda ili kuzalisha utabiri. Hii ina maana kuna njia ya kuchanganya vipengele vitatu pamoja, kuwakilishwa kwa kutumia kifupi cha herufi tatu. Kwa mfano, ETS (A, Ad, M) inamaanisha kosa la kuongeza, mwelekeo wa kuongeza na msimu wa kuzidisha. Jambo moja ya kuangalia nje kwa, ni kwamba kulingana na data baadhi ya mifano hii inaweza kuwa imara. Kwa mfano, kama data zina 0 au maadili hasi, basi kuzidisha inaweza kusababisha makosa. Tuna mchanganyiko wengi wa uwezekano wa vigezo na smoothing coefficients. Kwa bahati nzuri, programu nyingi zitajaribu moja kwa moja mchanganyiko mwingi tofauti. Hata hivyo bado tunahitaji njia ya kuchagua mfano bora. Ni kosa kutumia kitu kama vile R2 kama kwamba inaweza kusababisha overfitting. Badala yake kipimo kinachojulikana kama kigezo cha habari hutumiwa, ambayo ni njia ya takwimu ya kutathmini utendaji wa mfano. ETS inaweza kutekelezwa moja kwa moja kwa kutumia lugha ya programu kama vile python. Vinginevyo, chombo cha hakuna-nambari na utendaji huu, kama vile Alteryx inaweza kutumika. Hii inaruhusu wewe kutekeleza utabiri na mibofyo michache tu. Hapa ni nini utekelezaji barebones katika Alteryx inaonekana kama. Tunaweza kuona kwamba utabiri wetu umefanikiwa kukamata mwenendo na msimu wa data zetu. Katika kesi hii sisi kutumia mfano multiplicative, kwa sababu swings msimu kukua katika ukubwa kama mwenendo huongezeka. Exponential smoothing ni mbinu majaribio na kupimwa kwa ajili ya utabiri wa data mfululizo wa muda. Wakati kutumika kwa usahihi inaweza kuzalisha utabiri sahihi kwamba kuchukua msimu na mwelekeo wa data yako katika akaunti. Ili kujifunza zaidi, Miongozo ya Utabiri na Mazoezi ni mahali pazuri pa kuanza. Waandishi hutoa muhtasari wazi wa misingi muhimu bila kwenda katika magugu. Ili kujifunza zaidi kuhusu visualizing data mfululizo wa muda, angalia chapisho hili nje.