Monday, April 7, 2014

several methods collecting for time series analysis

It is normal for data analysis processing have missing data for reasons. Once the data is missing. It is nature for people ask how the gap on the plot can be "fixed/smoothed". Also, it is very often to be asked to predict next several points ased on previous 7 to 8 points. For example, given history stock level, I am asked to predict stock level for beverage market data analysis.
With the asspumption of whatever has occured in the past will continue to happen in the future, we can treat these questions as time series analysis. Below are list of four methods to do forcecasting for a short time series.

  1. Moving averages
    install.packages("zoo")
    library(zoo)
    ma = rollmean(ts, k)
    
  2. For data without any systematic trend or seasonal components, we can use exponential smoothing
  3. Accounting for data seasonality using Winter's smoothing
  4. Accounting for data trend using Holt's smoothing
  5. install.packages("forecast")
    library(forecast)
    x = c(1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5 )
    x = ts(x, frequency = 5)
    plot(hw(x, 5), byt = "1")
    
Below a few collected videos about exponential smoothing and Holt-Winter forecasting method

1.11 Time Series- exponential smoothing


1.12 Time Series- moving averages