Gestalte GoConqr mit. Was sollen wir als Nächstes hinzufügen?

Mindmap

Time Series BKP

Carlos Guimarães Estatística Portugiesisch

Time Series BKP

Inhalt der Mindmap

Time Series BKP

  1. Time Series Forecasting

    • Time series forecasting is the use of a model to predict future values based on previously observed values. While regression analysis is often employed in such a way as to test theories that the current values of one or more independent time series affect the current value of another time series, this type of analysis of time series is not called "time series analysis", which focuses on comparing values of a single time series or multiple dependent time series at different points in time.
      • Forecasting: A Practical Guide DRAFT
        • Forecasting Methods
          • Source:
            • https://en.wikipedia.org/wiki/Time_series https://en.wikipedia.org/wiki/Forecasting
            • ”Scaled Blessington, Mark. Sales Forecasting: A Practical Guide (Locais do Kindle 89). Mark Blessington Inc. Edição do Kindle.
            • emodels. Batterson, Blake. Sales Forecasting Basics (Locais do Kindle 190-191). Unknown. Edição do Kindle.
          • Excel, SPSS, Minitab, R, Stata and so on. (R Scrits here!!!) * Forecast package
          • Time-Series Models Time-series models are a forecasting technique that uses past data points to forecast sales. These models assume that the past is an indication of the future. So if your sales have been growing in the past, they will continue to grow in the future.
            • Qualitative
              • Jury of Executive Opinion
              • Delphi Method
              • Consumer Market Survey
              • Sales Force Composite
            • Quantitative
              • Quantitative forecasting models allow you to take your data and use mathematical modeling to forecast your sales. The data you will need will come from your past sales. But first, there are two quantitative forecasting methods: time-series models and an associative model. In this chapter we will discuss the time-series models which are the naïve approach, moving averages, and exponential smoothing.
                • 5. PARTITION SERIES
                  • Hold Out
                    • In and out sample dataset http://people.duke.edu/~rnau/three.htm
                      • DSTreino = ts(dataset, start = c(year,month), end = c(year,month), frequency=12) DSTeste = ts(dataset, start = c(year,month), end = c(year,month), frequency=12)
                • 4. PRE-PROCESS
                • 3. EXPLORE E VISUALIZE SERIES
                  • Exploratory analysis
                    • Correlograma
                      • O correlograma é uma ferramenta comumente usado para checar a aleatoriedade de um conjunto de dados. Esta aleatoriedade é verificada ao computar autocorrelações para valores de dados em intervalo de tempo variantes. Em caso de aleatoriedade, tais autocorrelações devem ser próximas de zero para quaisquer e todas as separações de intervalo de tempo. Em caso de não aleatoriedade, então uma ou mais autocorrelações devem ser significantemente diferentes de zero. Além disso, correlogramas são usados no estágio da identificação de modelo para os modelos de série temporal autorregressivos de médias móveis de Box-Jenkins. Autocorrelações devem ser próximas de zero para aleatoriedade. Se o analista não verificar a aleatoriedade, então, a validade de muitas conclusões estatísticas se torna suspeita. O correlograma é uma forma adequada de checar tal aleatoriedade.
                        • O correlograma pode ajudar a fornecer respostas para as seguintes questões:[4] Os dados são aleatórios? A observação está relacionada a uma observação adjacente? A observação está relacionada a uma observação duplamente removida? A série temporal observada é ruído branco? A série temporal observada é senoide? A série temporal observada é autorregressiva? Qual é o modelo apropriado para a série temporal observada?
                          • O correlograma também é utilizado (e talvez até com maior relevância) para analisar os resíduos de um modelo. Quando você faz, por exemplo, uma projeção (forecast) do preço de uma ação, o correlograma do resíduo desse modelo deve estar contido no tracejado azul. Ou seja, os resíduos não podem ter autocorrelação. Caso contrário, sua projeção pode ser melhorada, pois alguma informação relevante no modelo está contida nos resíduos.
                            • Quando falamos de resíduos, o objetivo é verificar a não presença de autocorrelação. Na previsão, seu objetivo é "capturar" o padrão da série e colocar este padrão no seu modelo. O que "sobra" do seu modelo são os resíduos. Se existe autocorrelação nos resíduos, indica que o seu modelo deixou algo de fora, que poderia estar no modelo e tornaria ele, provavelmente, um modelo melhor. Se existe autocorrelação significativa no seu modelo, você pode tentar um modelo diferente ou algum tipo de transformação em seus dados.
                              • https://en.wikipedia.org/wiki/Autocorrelation
                              • https://estatsite.com/2017/06/22/series-temporais-correlograma-interpretacao-e-codigo-em-r/
                              • https://pt.wikipedia.org/wiki/Função_correlograma
                              • A time series with constant mean and variance, normally distributed, which is totally random and does contain any pattern (no autocorrelation).
                              • When you have a non seasonal dataset 20 is a very good choice since you have 1 pass at a 95% confidence level. that is the reason why you see 20 as default. When you have a seasonal dataset I would get a bit more than 3 full seasonal cycles to see seasonal autocorrelation.
                                • ggAcf( )
                    • Estacionariedade
                      • É quando a média e a variância mantem se constante. Em principio, séries com sazonalidade (mas pode ser) e tendência não são estacionárias. Existem técnicas analíticas de séries temporais que dependem da estacionariedade da série para funcionarem •Se a série não é estacionária, pode-se aplicar algum tipo de transformação
                        • Para saber se a sérei é ou não estacionária, o processo é Visualmente ou através de Testes Estatísticos (Dickey-Fuller, KPSS, Philips-Perron)
                          • Diferenciação: Caso a série não seja estacionária e queira trabalhar com modelos que necessitem estacionariedade (ex: ARIMA), é necessário aplicar a técnica de Diferenciação (Lambda, Dif (mais utilizada), logaritmica, etc).
                            • diff( )
                          • ur.kpss( )
                    • Decomposition
                      • métodos de decomposição: "Clássica vs X-13ARIMA-SEATS vs STL. STL mais robusta, aceita qualquer tipo de sazonalidade e suporte melhor para lidar com outliers. As demais funcionam melhor quando a frequencia da série é mensal e trimestral. A clássica é a mais simples.
                        • https://estatsite.com/2017/06/12/series-temporais-introducao-e-decomposicao-em-r/
                      • Modelo Aditivo: melhor quando a elemento sazonal ou tendência não é proporcional com o nível da série Modelo Multiplicativo: melhor quando o elemento sazonal ou tendência muda com o nível da serie. OBS: Muitos modelos de previsão, já adotam automaticamente o aditivo ou o multiplicativo
                      • Level: Horizontal pattern in a time series. No change in the data. We saw in the past what we see in the future, no change.
                      • 1. Trend: is the gradual movement of data over time. This movement can be upward, downward, or sideways. Trend is a clear indicator of autocorrelation.
                        • Linear trend: http://people.duke.edu/~rnau/411trend.htm
                          • autoplot(x$trend)
                      • decompose( )
                      • 2. Seasonality: is a data pattern that repeats itself. Seasonality is the time used to forecast. This is the different time frames—such as day, week, months, or years—that was mentioned earlier.
                        • https://onlinecourses.science.psu.edu/stat510/node/86/
                          • ggmonth( ) ggseason( )
                      • 3. Cycles: are patterns that appear in the data. Cycles occur at various times. It may be every so many years. It could be tied to the holiday seasons. It is usually tied into the business cycle. Cycles are important when analyzing and planning in the short-term. These cycles will become obvious to you through experience and will give you an idea of what to expect. Cycles allow us to infer future expectations through the use of forecasting.
                        • Peridiogram: https://onlinecourses.science.psu.edu/stat510/node/71
                          • Apenas para entendimento, não faz parte da decomposição
                      • 4. Random Variations: are data which are caused by chance or unusual situations. These random variations are sometimes referred to as blips or outliers. These anomalies don’t seem to follow any kind of a discernible pattern. Because they don’t follow a pattern, they cannot be predicted.
                • 2. GET DATA
                  • Data Quality / Preparation
                    • Outliers
                      • Estabilizar os dados
                        • myts1 = tsoutliers(myts)
                    • Variables
                      • Types
                      • Number of...
                        • Time stamp interval
                          • days, weeks, quarters
                            • ts(dataset, start = c(2003,1), end = c(2017,12), frequency=12)
                    • Clean Data
                      • Missing Data (Null, Gaps)
                        • melhor forma é repetir a última ocorrência (naive)
                          • mytsclean = tsclean(myts)
                    • Irregular
                      • Aggregate function
                        • ag.irregtime1 = aggregate(dataset, as.Date, mean)
                • 1. DEFINE GOAL
                  • Short-Therm: 1 year - Use simple quantitative methods because of nimber of forecasts Medium term 1 - 2 years - Mix of Judgmental and quantitative. Analyze monhs worth of data (12 months). Seasonal adjustments Long term: > 2 years - Requires many years worth of data
                    • Pricing / Revenue management
                • Multivariadas: duas ou mais variáveis conectadas ao tempo
                • Univariadas: apenas uma variável conectada ao tempo
                  • 6. APPLY FORECASTING METHODS
                    • 7. EVALUATE E COMPARE ACCURACY
                      • Error
                        • Forecasting is all about managing error. Forecasts are rarely perfect. The important questions are: “How wrong was I or what margin of error is acceptable?
                          • The first and biggest leap in accuracy is achieved by learning how to measure error correctly. Next, you need to test your forecasts before making real-world predictions. It is also important to avoid one of the big-gest rookie mistakes: using linear extensions.
                            • The four most popular measurements are deviation, mean absolute deviation, mean squared error, and mean absolute error.
                              • 7. Mean Percentage Error (MPE):
                                • independente de Escala (%)
                              • 6. Root Mean Square Erro (RMSE):
                                • Independente de Escala. Quanto menor, melhor.
                              • 5. Mean Error (ME):
                                • Mean Error (ME) - Dependente de escala, ou seja, você não pode comparar previsões diferentes com dados diferentes (apenas para mesmo conjunto de dados com modelo de previsões diferentes). É a média da diferença entre o realizado e o previsto. Quanto menor, melhor. Não é uma boa métrica.
                              • 8. Mean Absolute Naive Error (MANE):
                                • Benchmark error approach
                              • 1. Deviation:
                                • The fundamental error calculation subtracts forecast and actual. But then we need to decide whether to use forecast minus actual, or actual minus forecast. Forecast minus Actual: This formula establishes actual as the benchmark. With this formula, negative error means the forecast was too low. Technically, this measure is best because real-world reality is used as the standard, not an estimate of reality.
                                  • Actual minus Forecast: This formula uses Forecast as thebenchmark. A negative error means the actual result was below forecast. This formula is more common because “forecast” is often synonymous with “business plan.” In this book, I use Actual minus Forecast, because of its popularity. Also, as explained next, the choice is less critical with the use of absolute value.
                                    • The solution involves absolute value, where the difference between Forecast and Actual is calculated, and all negative signs are removed. In other words, absolute value allows us to calculate the “distance” between forecast and actual. This way, it does not matter whether we subtract forecast from actual, or actual from forecast. Once the absolute error for each forecast is calculated, we can sum all the errors. Now each absolute error contributes to the sum.
                              • 3. Mean Squared Error (MSE):
                                • is the average of the squared differences between the forecasted sales and actual sales. The biggest problem with this measurement is that it accentuates large deviations due to the squared term. The reason the forecast errors are squared is to get rid of negative numbers.
                              • 2. Mean Absolute Deviation (MAD):
                                • is a measure of the overall forecast error for a model. The MAD is useful because sometimes when comparing two or more forecasts, the deviations per forecast may be in favor of one forecast model and then in favor of another. So it is hard to tell which one overall is more accurate. The MAD will help with that. The formula for MAD is:
                              • 4. Mean Absolute Error (MAE):
                                • is the average of absolute differences between the forecasted sales and the actual sales. The difference here is that the answer is expressed as a percentage of actual values. This is nice for forecasts that have large values. Dependente de escala. Quanto menor, melhor. (Melhor que o ME).
                      • 8. IMPLEMENT FORECAST
                        • Best Forecasting Method (Best Accuracy Model)
                    • Methods
                      • Linear Models
                        • Simple Methods
                          • Linear regression
                            • Univariada
                              • http://www.tylervigen.com/spurious-correlations
                                • lm( )
                          • Naive
                            • The Naïve approach is a forecasting technique which assumes the demand in the most recent period is what the demand will be in the next period. This is the simplest way to forecast. Unfortunately, it won’t be as accurate as other methods, but it will get you close. Also, it is better than random guessing.To use this aproach, simply look at what your sales were in the last period and assume that this is what they will be in the next period.
                              • naive( )
                            • Seasonal Naive
                              • A similar naive method, however is useful for highly seasonal data. In this case, we set each forecast to be equal to the last observed value from the same season of the year (e.g., the same month of the previous year).
                                • snaive( )
                          • Moving Average
                            • The moving average is a forecasting method that uses an average of the number () of the most recent periods of data to forecast the next period. This is simply an average of previous sales, and then using that answer as your sales forecast. These are useful if you assume that your sales will remain fairly steady over time. This method works well in an uptrend or downtrend; however, it does not work well when there is a trend reversal.
                          • Drift
                            • A variation on the naïve method is to allow the forecasts to increase or decrease over time, where the amount of change over time (called the drift) is set to be the average change seen in the historical data. This is equivalent to drawing a line between the first and last observation, and extrapolating it into the future.
                              • rwf( )
                          • Benchmarking Methods. These time-series models are good for short-to medium-range forecasts.
                        • Others
                          • No geral, o melhor modelo
                          • ARIMAX
                          • ARIMA
                            • Seasonal ARIMA
                              • linear assumption, the forecast will be constant for the forecasted weeks, the data doesn't show any exponential character and no trend is present
                            • Explain patterns in the data based on autoregression. No método Arima, é necessário que a série seja estacionária. Diferenciação: Series não estacionárias, objetivo é transformar a série em estacionária (i.e. log)
                              • auto.arima(dataset, trace = T,stepwise = F, approximation = F )
                                • ou o próprio arima ao invés do Auto
                        • Powerful
                          • Simple Exponencial Smooth
                            • Previsão linear sem tendencia e sem sazonalidade.
                          • Exponential Smooth
                            • Exponential Smoothing Exponential smoothing is a weighted moving average forecasting technique where data points are weighted by an exponential function. This technique is nice because it requires very little record keeping of past data. The exponential smoothing model will always move to the most recent data just like the moving averages. Trend and seasonality are key determinants.
                              • ETS (Error, Trend, Sazonal
                                • Poderoso método de previsão por suavização exponencial. Se adapta automaticamente
                              • Holt-Winters Sazonal
                                • Inclui captura para sazonalidade / Ideal para tendência
                                  • Multiplicativo: Variação sazonal varia na série
                                  • Aditivo: Variação sazonal constante
                              • Dumped
                                • Amortece a tendência do Holt's Method
                              • Holt's Method
                                • Suavização exponencial para dados com tendencia. Gera uma tendencia linear para o futuro.
                          • weighted moving average
                            • Weighted Moving Average A weighted moving average is very similar to the moving average. The difference is that weights are assigned to each period of data to place more emphasis on recent values. The reason higher weight is put on the most recent value is because it is always more accurate. As the values move away from the time you are forecasting, they become less accurate. Therefore, the highest weight is always assigned to the most recent value, and the remaining weights are listed in decreasing order.
                          • These time-series models are good for short-to medium-range forecasts.
                      • Non Linear Models
                        • Clustering
                        • Support Vector Machine
                        • Neural Network
  2. Time Series Analysis

    • Time series analysis comprises methods for analyzing time series data in order to extract meaningful statistics and other characteristics of the data.

Bilder und Dateien der Mindmap

  • Time Series BKP
  • Time Series BKP
  • Time Series BKP

Informationen

Beschreibung
Passo a passo para realizar time series forecasting
Erstellt von
Carlos Guimarães
Aufrufe
1
Tags
forecastingtime series
Verlauf
  • Erstellt von Carlos Guimarães · 6 Nov 2017
  • Kopiert von Carlos Guimarães · 9 Nov 2017
  • Kopiert von Carlos Guimarães · 2 Okt 2018
Bewertung

Mehr zu Modelos e previsão de séries temporais

Feedback

Worum geht es?

Was sollen wir als Nächstes hinzufügen?