13. Time Series Analysis in the Toolbar of Minitab's Help

35
Time Series Analysis in the Toolbar of Minitab’s Help 1. Example of a simple time series plot You are a sales manager and you want to view your company's quarterly sales for 2001 to 2003. Create a time series plot. 1 Open the worksheet NEWMARKET.MTW. 2 Choose Graph > Time Series Plot or Stat > Time Series > Time Series Plot. 3 Choose Simple, then click OK. 4 In Series, enter SalesB. 5 Click Time/Scale. 6 Under Time Scale, choose Calendar. Then, choose Quarter Year. 7 For start values, under Quarter, type 1. Under Year, type 2000. 8 Click OK in each dialog box.

Transcript of 13. Time Series Analysis in the Toolbar of Minitab's Help

Page 1: 13. Time Series Analysis in the Toolbar of Minitab's Help

Time Series Analysis in the Toolbar of Minitab’s Help

1. Example of a simple time series plot

You are a sales manager and you want to view your company's quarterly

sales for 2001 to 2003. Create a time series plot.

1    Open the worksheet NEWMARKET.MTW.

2    Choose Graph > Time Series Plot or Stat > Time Series > Time Series

Plot.

3    Choose Simple, then click OK.

4    In Series, enter SalesB.

5    Click Time/Scale.

6    Under Time Scale, choose Calendar. Then, choose Quarter Year.

7    For start values, under Quarter, type 1. Under Year, type 2000.

8    Click OK in each dialog box.

Interpreting the results

Overall sales increased over the three years. Sales may be cyclical, with lower

sales in the first quarter of each year.

Page 2: 13. Time Series Analysis in the Toolbar of Minitab's Help

Tip To see the y- and x-values for a symbol in a series, hover your cursor over

the symbol.

2. Example of a time series plot with groups

The ABC company used two advertising agencies in 2000-2001- the Alpha

Advertising Agency in 2000 and the Omega Advertising Agency in 2001. You

want to compare the sales data for the past two years. Create a time series plot

with groups.

1    Open the worksheet ABCSALES.MTW.

2    Choose Graph > Time Series Plot or Stat > Time Series > Time Series

Plot.

3    Choose With Groups, then click OK.

4    In Series, enter Sales.

5    In Categorical variables for grouping (1-3), enter AdAgency.

6   Click Time/Scale.

7    Under Time Scale, choose Calendar, then choose Month Year.

8    For start values, under Month, type 1. Under Year, type 2000.

9    Click OK in each dialog box.

Interpreting the results

Tip To see the y- and x-values for a symbol in a series, hover your cursor over

the symbol.

Sales increased both years. Sales for the Alpha ad agency increased 161, from

210 to 371. Subsequently, sales for the Omega ad agency rose somewhat less

Page 3: 13. Time Series Analysis in the Toolbar of Minitab's Help

dramatically from 368 to 450, an increase of 82.  However, the effects of other

factors, such as amount of advertising dollars spent and the economic conditions,

are unknown.

3. Example of multiple overlaid time series plots

You own stocks in two companies (ABC and XYZ) and you want to compare

their monthly performance for two years. Create an overlaid time series plot of

share prices for ABC and XYZ.

1    Open the worksheet SHAREPRICE.MTW.

2    Choose Graph > Time Series Plot or Stat > Time Series > Time Series

Plot.

3    Choose Multiple, then click OK.

4    In Series, enter ABC XYZ.

5    Click Time/Scale.

6    Under Time Scale, choose Calendar, then choose Month Year.

7    For start values, under Month, enter 1. Under Year, enter 2001.

8    Click OK in each dialog box.

Interpreting the results

Tip To see the y- and x-values for a symbol in a series, hover your cursor over

the symbol.

The solid line for ABC share price shows a slow increase over the two-year

period. The dashed line for XYZ share price also shows an overall increase for the

two years, but it fluctuates more than that of ABC. The XYZ share price starts

Page 4: 13. Time Series Analysis in the Toolbar of Minitab's Help

lower than ABC (30 vs. 36.25 for ABC). By the end of 2002, the XYZ price

surpasses the ABC price by 14.75 (44.50 to 60.25).

4. Example of multiple overlaid time series plots with groups

Your company uses two different processes to manufacture plastic pellets.

Energy is a major cost, and you want to try a new source of energy. You use

energy source A (your old source) for the first half of the month, and energy

source B (your new source) for the second half. Create a time series plot to

illustrate the energy costs of two processes from the two sources.

1    Open the worksheet ENERGYCOST.MTW.

2    Choose Graph > Time Series Plot or Stat > Time Series > Time Series

Plot.

3    Choose Multiple with Groups, then click OK.

4    In Series, enter 'Process 1'  'Process 2'.

5    In Categorical variables for grouping (1-3), enter 'Energy Source'.

6    Click Time/Scale.

6    Under Time Scale, choose Calendar, then choose Day Month.

7    For start values, under Day, type 1. Under Month, type 3.

8    Click OK in each dialog box.

Interpreting the results

Energy costs for Process 1 are generally greater than those for Process 2. In

addition, costs for both processes were less using source B.

Page 5: 13. Time Series Analysis in the Toolbar of Minitab's Help

Therefore, using Process 2 and energy source B appears to be more cost effective than

using Process 1 and energy source A.

Tip To see the y- and x-values for a symbol in a series, hover your cursor over

the symbol.

5. Example of Trend Analysis

You collect employment data in a trade business over 60 months and wish

to predict employment for the next 12 months. Because there is an overall

curvilinear pattern to the data, you use trend analysis and fit a quadratic trend

model. Because there is also a seasonal component, you save the fits and

residuals to perform decomposition of the residuals (see Example of

Decomposition).

1    Open the worksheet EMPLOY.MTW.

2    Choose Stat > Time Series > Trend Analysis.

3    In Variable, enter Trade.

4    Under Model Type, choose Quadratic.

5    Check Generate forecasts and enter 12 in Number of forecasts.

6    Click Storage.

7    Check Fits (Trend Line), Residuals (detrended data), and Forecasts.

Click OK in each dialog box.

Page 6: 13. Time Series Analysis in the Toolbar of Minitab's Help

Interpreting the results

The trend plot that shows the original data, the fitted trend line, and

forecasts. The Session window output also displays the fitted trend equation and

three Measures of Accuracy to help you determine the accuracy of the fitted

values: MAPE, MAD, and MSD. The trade employment data show a general

upward trend, though with an evident seasonal component. The trend model

appears to fit well to the overall trend, but the seasonal pattern is not well fit. To

better fit these data, you also use decomposition on the stored residuals and add

the trend analysis and decomposition fits and forecasts (see Example of

decomposition).

6. Example of Decomposition

You wish to predict trade employment for the next 12 months using data

collected over 60 months. Because the data have a trend that is fit well by trend

analysis' quadratic trend model and possess a seasonal component, you use the

Page 7: 13. Time Series Analysis in the Toolbar of Minitab's Help

residuals from trend analysis example (see Example of a trend analysis) to

combine both trend analysis and decomposition for forecasting.

1    Do the trend analysis example.

2    Choose Stat > Time Series > Decomposition.

3    In Variable, enter the name of the residual column you stored in the trend

analysis.

4    In Seasonal length, enter 12.

5    Under Model Type, choose Additive. Under Model Components, choose

Seasonal only.

6    Check Generate forecasts and enter 12 in Number of forecasts.

7    Click Storage. Check Forecasts and Fits.

8    Click OK in each dialog box.

Page 8: 13. Time Series Analysis in the Toolbar of Minitab's Help
Page 9: 13. Time Series Analysis in the Toolbar of Minitab's Help
Page 10: 13. Time Series Analysis in the Toolbar of Minitab's Help

Interpreting the results

Decomposition generates three sets of plots:

A time series plot that shows the original series with the fitted trend line,

predicted values, and forecasts.

A component analysis - in separate plots are the series, the detrended data,

the seasonally adjusted data, the seasonally adjusted and detrended data (the

residuals).

A seasonal analysis - charts of seasonal indices and percent variation within

each season relative to the sum of variation by season and boxplots of the

data and of the residuals by seasonal period.

In addition, Minitab displays the fitted trend line, the seasonal indices, the three

accuracy measures- MAPE, MAD, and MSD (see Measures of accuracy) - and

forecasts in the Session window.

In the example, the first graph shows that the detrended residuals from trend

analysis are fit fairly well by decomposition, except that part of the first annual

cycle is underpredicted and the last annual cycle is overpredicted. This is also

evident in the lower right plot of the second graph; the residuals are highest in

the beginning of the series and lowest at the end.

Page 11: 13. Time Series Analysis in the Toolbar of Minitab's Help

7. Example of Fits and Forecasts of Combined Trend Analysis and

Decomposition

You collect employment data in a trade business over 60 months and wish

to predict employment for the next 12 months. Because there is an overall

curvilinear pattern to the data, you use trend analysis and fit a quadratic trend

model (see Example of Trend). Because a seasonal component also exists, you

save the fits and forecasts to perform decomposition of the residuals (see

Example of Decomposition). You now want to combine the trend analysis and

decomposition results.  

Step 1: Calculate the fits and forecasts of the combined trend analysis and

decomposition

1    Open the worksheet EMPLOY.MTW.

2    Choose Calc > Calculator.

3    In Store result in variable, enter NewFits.

4    In Expression, add the fits from trend analysis to the fits from

decomposition. Click OK.

5    Choose Calc > Calculator.

6    Clear the Expression box by selecting the contents and pressing [Delete].

7    In Store result in variable, enter NewFore.

8    In Expression, add the forecasts from trend analysis to the forecasts from

decomposition. Click OK.

Step 2: Plot the fits and forecasts of the combined trend analysis and

decomposition

1    Choose Stat > Time Series > Time Series Plot > choose Multiple > OK.

2    Under Series, enter Trade NewFits NewFore.

3    Click Time/Scale.

4    Under Start Values, choose One set for each variable, then enter 1 1 61

in rows 1-3, respectively.

5    Click OK in each dialog box.

Step 3: Calculate MSD

1    Choose Calc > Calculator.

2    In Store result in variable, enter MSD.

3    Clear the Expression box by selecting the contents and pressing [Delete].

Page 12: 13. Time Series Analysis in the Toolbar of Minitab's Help

4    In Functions, double-click Sum.

5    Within the parentheses in Expression, enter ((Trade - NewFits)**2) / 60.

Click OK.

6    Choose Data > Display Data.

7    In Columns, constants, and matrices to display, enter MSD. Click OK.

Interpreting the results

In the time series plot, the combined fits from the trend analysis and

decomposition (NewFits) are close to the actual Trade graphed values (Trade).

You can compare fits of different models using MSD. MSD for the quadratic trend

model was 59.13. Additive and multiplicative decomposition models with a

linear trend (not shown) give MSD values of 20.39 and 18.54, respectively. The

MSD value of 11.8989 for the combined quadratic trend and decomposition of

residuals indicates a better fit using the additive trend analysis and

decomposition models. You might also check the fit to these data of the

multiplicative trend analysis and decomposition models.

Page 13: 13. Time Series Analysis in the Toolbar of Minitab's Help

8. Example of Moving Average

You wish to predict employment over the next 6 months in a segment of the

metals industry using data collected over 60 months. You use the moving

average method as there is no well-defined trend or seasonal pattern in the data.

1    Open the worksheet EMPLOY.MTW.

2    Choose Stat > Time Series > Moving Average.

3    In Variable, enter Metals. In MA length, enter 3.

4    Check Center the moving averages.

5    Check Generate forecasts, and enter 6 in Number of forecasts. Click OK.

Page 14: 13. Time Series Analysis in the Toolbar of Minitab's Help

Interpreting the results

Minitab generated the default time series plot which displays the series and

fitted values (one-period-ahead forecasts), along with the six forecasts. Notice

that the fitted value pattern lags behind the data pattern. This is because the

fitted values are the moving averages from the previous time unit. If you wish to

visually inspect how moving averages fit your data, plot the smoothed values

rather than the predicted values.

To see exponential smoothing methods applied to the same data, see Example of

single exponential smoothing and Example of double exponential smoothing.

In the Session window, Minitab displays three measures to help you

determine the accuracy of the fitted values: MAPE, MAD, and MSD. See Measures

of accuracy. Minitab also displays the forecasts along with the corresponding

lower and upper 95% prediction limits.

9. Example of Single Exponential Smoothing

You wish to predict employment over 6 months in a segment of the metals

industry using data collected over 60 months. You use single exponential

smoothing because there is no clear trend or seasonal pattern in the data.

1    Open the worksheet EMPLOY.MTW.

2    Choose Stat > Time Series > Single Exp Smoothing.

3    In Variable, enter Metals.

4    Check Generate forecasts, and enter 6 in Number of forecasts. Click

OK.

Page 15: 13. Time Series Analysis in the Toolbar of Minitab's Help

Interpreting the results

Minitab generated the default time series plot which displays the series and

fitted values (one-period-ahead forecasts), along with the six forecasts.

In both the Session and Graph windows, Minitab displays the smoothing constant

(weight) used and three measures to help you to determine the accuracy of the

fitted values: MAPE, MAD, and MSD (see Measures of accuracy). The three

accuracy measures, MAPE, MAD, and MSD, were 1.12, 0.50, and 0.43, respectively

Page 16: 13. Time Series Analysis in the Toolbar of Minitab's Help

for the single exponential smoothing model, compared to 1.55, 0.70, and 0.76,

respectively, for the moving average fit (see Example of moving average).

Because these values are smaller for single exponential smoothing, you can judge

that this method provides a better fit to these data.

10. Example of Double Exponential Smoothing

 You wish to predict employment over six months in a segment of the

metals industry. You use double exponential smoothing as there is no clear trend

or seasonal pattern in the data, and you want to compare the fit by this method

with that from single exponential smoothing (see Example of single exponential

smoothing).

1    Open the worksheet EMPLOY.MTW.

2    Choose Stat > Time Series > Double Exp Smoothing.

3    In Variable, enter Metals.

4    Check Generate forecasts and enter 6 in Number of forecasts. Click OK.

Page 17: 13. Time Series Analysis in the Toolbar of Minitab's Help

Interpreting the results

Minitab generated the default time series plot which displays the series and

fitted values (one-step-ahead forecasts), along with the six forecasts.

In both the Session and Graph windows, Minitab displays the smoothing

constants (weights) for the level and trend components and three measures to

help you determine the accuracy of the fitted values: MAPE, MAD, and MSD (see

Measures of accuracy).

The three accuracy measures, MAPE, MAD, and MSD, were respectively

1.19684, 0.54058, and 0.46794 for double exponential smoothing fit, compared

to 1.11648, 0.50427, and 0.42956 for the single exponential smoothing fit (see

Example of single exponential smoothing). Because these values are smaller for

single exponential smoothing, you can judge that this method provides a slightly

better fit to these data.

Because the difference in accuracy measures for the two exponential

smoothing methods are small, you might consider the type of forecast

(horizontal line versus line with slope) in selecting between methods. Double

exponential smoothing forecasts an employment pattern that is slightly

increasing though the last four observations are decreasing. A higher weight on

the trend component can result in a prediction in the same direction as the data,

which may be more realistic, but the measured fit may not be as good as when

Minitab generated weights are used.

Page 18: 13. Time Series Analysis in the Toolbar of Minitab's Help

11. Example Winters' Method

You wish to predict employment for the next six months in a food

preparation industry using data collected over the last 60 months. You use

Winters' method with the default multiplicative model, because there is a

seasonal component, and possibly trend, apparent in the data.

1    Open the worksheet EMPLOY.MTW.

2    Choose Stat > Time Series > Winters' Method.

3    In Variable, enter Food. In Seasonal length, enter 12.

4    Under Model Type, choose Multiplicative.

5    Check Generate forecasts and enter 6 in Number of forecasts. Click OK.

Page 19: 13. Time Series Analysis in the Toolbar of Minitab's Help

Interpreting the results

Minitab generated the default time series plot which displays the series and

fitted values (one-period-ahead forecasts), along with the six forecasts.

In both the Session and Graph windows, Minitab displays the smoothing

constants (weights) used for level, trend, and seasonal components used and

three measures to help you determine the accuracy of the fitted values: MAPE,

MAD, and MSD (see Measures of accuracy).

For these data, MAPE, MAD, and MSD were 1.88, 1.12, and 2.87, respectively,

with the multiplicative model. MAPE, MAD, and MSD were 1.95, 1.15, and 2.67,

respectively (output not shown) with the additive model, indicating that the

multiplicative model provided a slightly better fit according to two of the three

accuracy measures.

12. Example of Autocorrelation

You wish to predict employment in a food preparation industry using past

employment data. You want to use ARIMA to do this but first you use

autocorrelation in order to help identify a likely model. Because the data exhibit

a strong 12 month seasonal component, you take a difference at lag 12 in order

to induce stationarity and look at the autocorrelation of the differenced series.

There may be some long-term trend in these data, but the magnitude of it

appears to be small compared to the seasonal component. If the trend was larger,

you might consider taking another difference at lag 1 to induce stationarity.

1    Open the worksheet EMPLOY.MTW.

Page 20: 13. Time Series Analysis in the Toolbar of Minitab's Help

2    Choose Stat > Time Series > Differences.

3    In Series, enter Food.

4    In Store differences in, enter Food2.

5    In Lag, enter 12. Click OK.

6    Choose Stat > Time Series > Autocorrelation.

7    In Series, enter Food2. Click OK.

Interpreting the results

In the Session window, Minitab displays the autocorrelations, associated t-

statistics, and Ljung-Box Q statistics. Because you did not specify the lag length,

autocorrelation uses the default length of n/4 for a series with less than or equal

to 240 observations. Minitab generates an autocorrelation function (ACF) with

Page 21: 13. Time Series Analysis in the Toolbar of Minitab's Help

approximate = 0.05 critical bands for the hypothesis that the correlations are

equal to zero.

The ACF for these data shows large positive, significant spikes at lags 1 and 2

with subsequent positive autocorrelations that do not die off quickly. This

pattern is typical of an autoregressive process.

See Example of Testing Autocorrelations to test the null hypothesis that the

autocorrelations for all lags up to a lag of 6 are zero.

13. Example of Testing Autocorrelations

Using the results from the Example of Autocorrelation, you can use the

Ljung-Box Q (LBQ) statistic to test the null hypothesis that the autocorrelations

for all lags up to lag k equal zero. Let's test that all autocorrelations up to a lag of

6 are zero. The LBQ statistic is 56.03.

Step 1: Compute the cumulative probability function

1    Choose Calc > Probability Distributions > Chi-Square.

2    Choose Cumulative Probability.

3    In Degrees of freedom, enter 6 (the lag of your test).

4    Choose Input constant and enter 56.03 (the LBQ value).

5    In Optional storage, enter Cumprob. This stores the cumulative

probability function in a constant named Cumprob. Click OK.

Step 2: Compute the p-value

1    Choose Calc > Calculator.

2    In Store result in variable enter pvalue.

3    In Expression, enter 1 - 'Cumprob'. Click OK.

Interpreting the results

Examine the value in the Data window. In this example, the p-value is

0.000000, which means the p-value is less than 0.0000005. The very small p-

value implies that one or more of the autocorrelations up to lag 6 can be judged

as significantly different from zero at any reasonable a level.

 

Page 22: 13. Time Series Analysis in the Toolbar of Minitab's Help

14. Example of partial autocorrelation

You obtain a partial autocorrelation function (PACF) of the food industry

employment data, after taking a difference of lag 12, in order to help determine a

likely ARIMA model.

1    Open the worksheet EMPLOY.MTW.

2    Choose Stat > Time Series > Differences.

3    In Series, enter Food.

4    In Store differences in, enter Food2.

5    In Lag, enter 12. Click OK.

6    Choose Stat > Time Series > Partial Autocorrelation.

7    In Series, enter Food2. Click OK.

Interpreting the results

Page 23: 13. Time Series Analysis in the Toolbar of Minitab's Help

Minitab generates a partial autocorrelation function with critical bands at

approximately = 0.05 for the hypothesis that the correlations are equal to zero.

In the Data window, Minitab stores the partial autocorrelations and associated t-

statistics.

In the food data example, there is a single large spike of 0.7 at lag 1, which

is typical of an autoregressive process of order one. There is also a significant

spike at lag 9, but you have no evidence of a nonrandom process occurring there.

15. Example of ARIMA

The ACF and PACF of the food employment data (see Example of

autocorrelation and Example of partial autocorrelation) suggest an

autoregressive model of order 1, or AR(1), after taking a difference of order 12.

You fit that model here, examine diagnostic plots, and examine the goodness of

fit. To take a seasonal difference of order 12, you specify the seasonal period to

be 12, and the order of the difference to be 1. In the subsequent example, you

perform forecasting.

1    Open the worksheet EMPLOY.MTW.

2    Choose Stat > Time Series > ARIMA.

3    In Series, enter Food.

4    Check Fit seasonal model. In Period, enter 12. Under Nonseasonal, enter

1 in Autoregressive. Under Seasonal, enter 1 in Difference.

5    Click Graphs. Check ACF of residuals and PACF of residuals.

6    Click OK in each dialog box.

Page 24: 13. Time Series Analysis in the Toolbar of Minitab's Help
Page 25: 13. Time Series Analysis in the Toolbar of Minitab's Help

Interpreting the results

The ARIMA model converged after nine iterations. The AR(1) parameter had a t-

value of 7.42. As a rule of thumb, you can consider values over two as indicating

that the associated parameter can be judged as significantly different from zero.

The MSE (1.1095) can be used to compare fits of different ARIMA models.

The Ljung-Box statistics give nonsignificant p-values, indicating that the

residuals appeared to uncorrelated. The ACF and PACF of the residuals

corroborate this. You assume that the spikes in the ACF and PACF at lag 9 are the

result of random events. The AR(1) model appears to fit well so you use it to

forecast employment in the Example of Forecasting with ARIMA.

16. Example of Forecasting with ARIMA

In the example of fitting an ARIMA model, you found that an AR(1) model

with a twelfth seasonal difference gave a good fit to the food sector employment

data. You now use this fit to predict employment for the next 12 months.

Step 1: Refit the ARIMA model without displaying the acf and pacf of the

residuals

1    Perform steps 1- 4 of Example of ARIMA.

Step 2: Display a time series plot

1    Click Graphs. Check Time series plot. Click OK.

Step 3: Generate the forecasts

1    Click Forecast. In Lead, enter 12. Click OK in each dialog box.

Page 26: 13. Time Series Analysis in the Toolbar of Minitab's Help
Page 27: 13. Time Series Analysis in the Toolbar of Minitab's Help

Interpreting the results

ARIMA gives forecasts, with 95% confidence limits, using the AR(1) model

in both the Session window and a Graph window. The seasonality dominates the

forecast profile for the next 12 months with the forecast values being slightly

higher than for the previous 12 months.

References

[1] B.L. Bowerman and R. T. O' Connell (1993). Forecasting and Time Series: An

Applied Approach, 3rd edition. Duxbury Press.

[2] G.E.P. Box and G.M. Jenkins (1994). Time Series Analysis: Forecasting and

Control, 3rd Edition. Prentice Hall.

[3] J.D. Cryer (1986). Time Series Analysis. Duxbury Press.

[4] N.R. Farnum and L.W. Stanton (1989). Quantitative Forecasting Methods.

PWS-Kent.

[5] G.M. Ljung and G.E.P. Box (1978). "On a Measure of Lack of Fit in Time

Series Models," Biometrika, 65, 67-72.

[6] S. Makridakis, S.C. Wheelwright, and R. J. Hyndman (1998). Forecasting:

Methods and Applications. Wiley.

[7] D.W. Marquardt (1963). "An Algorithm for Least Squares Estimation of

Nonlinear Parameters," Journal Soc. Indust. Applied Mathematics, 11, 431-

441.

Page 28: 13. Time Series Analysis in the Toolbar of Minitab's Help

[8] W.Q. Meeker, Jr. (1977). "TSERIES-A User-oriented Computer Program for

Identifying, Fitting and Forecasting ARIMA Time Series Models," ASA 1977

Proceedings of the Statistical Computing Section.

[9] W.Q. Meeker, Jr. (1977). TSERIES User's Manual, Statistical Laboratory, Iowa

State University.

[10] W. Vandaele (1983). Applied Time Series and Box-Jenkins Models. Academic

Press, Inc.

http://statsdata.blogspot.com/