business modelling using holos interactive services

60
Page 1 Business modelling using Holos Interactive Services Introduction Most users will be familiar with Holos models, which are a collection of structures, rules and ruletables. The database structure of Holos allows access to information everywhere. The Holos models are deterministic rules-based and have much in common with accountancy-type models, which consist of a conglomeration of simple self-evident statements such as revenue = price * quantity sold profit = revenue - costs ; tax = profit * tax rate Spreadsheet packages can, of course, do some of the simpler aspects of such calculations. However, for multi-dimensional problems requiring access to many data sources and more than a simple calculation, the spreadsheet packages are woefully inadequate. Holos, with its multi-dimensional data structure and automatic rule ordering, is ideally suited to complex modelling problems. A natural extension of the models can easily answer simple ‘what if’ questions such as ‘how would profits be affected by cheaper material costs?’.

Upload: others

Post on 02-Nov-2021

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Business modelling using Holos Interactive Services

Page 1

Business modelling using HolosInteractive Services

Introduction

Most users will be familiar with Holos models, which are a collection ofstructures, rules and ruletables. The database structure of Holos allowsaccess to information everywhere. The Holos models are deterministicrules-based and have much in common with accountancy-type models,which consist of a conglomeration of simple self-evident statementssuch as

revenue = price * quantity sold

profit = revenue - costs ; tax = profit * tax rate

Spreadsheet packages can, of course, do some of the simpler aspects ofsuch calculations. However, for multi-dimensional problems requiringaccess to many data sources and more than a simple calculation, thespreadsheet packages are woefully inadequate.

Holos, with its multi-dimensional data structure and automatic ruleordering, is ideally suited to complex modelling problems. A naturalextension of the models can easily answer simple ‘what if’ questionssuch as ‘how would profits be affected by cheaper material costs?’.

Page 2: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 2

Dynamic effects due to lags and leads can be easily incorporated intomodels. Indeed, Holos meets all of E.F. Codd’s OLAP1 criteria.

A fundamental characteristic of the types of business models describedabove is their deterministic setting. The modelling services available viathe Interactive Services are aimed at rather more statistical analysis innon-deterministic situations.

Modelling using Interactive Services

Many business questions cannot be answered by straightforwardaccountancy-type calculations. Often, the relationships between businessvariables are unknown, and we need to analyse available data to comeup with answers.

Data is a strategic resource. Sophisticated quantitative analysis tools arerequired to extract or ‘mine’ the decision making knowledge in the data.More powerful algorithms based on statistical and artificial intelligencetechniques are increasingly being used to exploit all availableinformation.

The quantitative tools are used to construct a model that is amathematical representation of the real world. Some models can beexpressed in equation form that relate the variables of interest – data isthen used to estimate the parameters of the equations. The range of these‘principle’ based models is very wide. At another extreme, we may haveno idea of the form of equations relating the variables of interest. Someform of machine learning technique (e.g. neural net or fuzzy inference)can be used to build a ‘black box’ that models the relationships ofinterest, or perhaps a form a rule induction could be used to give asemi-mechanistic model.

In this document we are concerned with the some elementary aspects of‘principle’ based models where we have some idea of the types ofequations, but are unsure about the parameters.

1 Providing OLAP (On-line Analytical Processing) to User-Analysts: An IT Mandate; E.F. Codd, S.B. Codd andC.T. Salley, 1993.

Page 3: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 3

In particular, we shall be concerned with:

Time series modelsWe assume to know nothing about the causal relationships concerningthe variable we are trying to model for forecasting purposes. Instead, weuse the past history of the time series to infer something about its future.The method used may be a simple linear extrapolation or a complexstochastic Box-Jenkins model.

Time series models have been used to forecast demand for airlinecapacity, electricity demand, movement of interest rates, stock prices,seasonal telephone demand, and many other economic variables. Timeseries models are particularly useful when the underlying process thatone is trying to forecast is poorly understood. However, the limitedstructure of time series models makes them suitable for only short runforecasts.

Regression modelsIn this type of model the variables of interest may be a function ofseveral explanatory variables. The equation may be time-dependent, sothat a time index appears explicitly in the equation. Note we do notcover multi-equation simulation models, in which variables andexplanatory variables are interrelated. Simultaneous equation estimationusing various forms of instrumental variable regression will be coveredin a future document.

Univariate regression service

IntroductionRegression analysis is concerned with cause and effect. For example, wemay want to know how advertising and price affect sales. The techniqueis useful in estimating financial models (such as the Capital AssetPricing Model presented below), supply and demand schedules andmodels of learning and growth.

The univariate regression service can be used interactively to fit curvesto a set of data points. The use of the service, together with relatedservices, will be illustrated with case study examples, the first of whichis the fitting of a standard Capital Asset Pricing Model (CAPM).

Page 4: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 4

Example 1 – Estimating a Capital Asset Pricing Model (CAPM)The CAPM is a formula for the expected return on an asset under theassumption that the market return is known. Investors use the CAPM tohelp predict return on assets, and hence adjust their portfolio of assets. Inthis example we shall use data from the Tandy Corporation.

The CAPM model can be expressed as

i f M f iR - R = + ( R - R ) +

where

αα is the intercept term, referred to as Alpha in finance literature.

ß is the gradient term, referred to as Beta in the finance literature.Physically, it represents the portion of an asset’s return that is dependenton the market’s rate of return, and is the nondiversifiable or systematicrisk.

εε is the error term, or diversifiable risk.

Ri is the return on asset i in time period t, defined as

Ri(t) = P(t) + d(t) - P(t-1) P(t-1)

where P(t) is the value of the asset at time t, d(t) is the dividend in periodt and P(t-1) is the price of the asset at time t-1.

Rf is the return on a risk-free asset (the yield on 30 day US TreasuryBills is typically used).

Ri - Rf is the risk premium of asset i; it is the excess return over the risk-free rate.

RM is the market portfolio return, which is a weighted value of alltransactions (various centres calculate and publish these figures).

RM - Rf is the overall market’s risk premium.

To load the Tandy example, execute the Holos fileholos_examples:tand.hl, e.g.

EXECUTE "holos_examples:tand.hl"

Page 5: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 5

Once the file has executed, this report will be displayed:

Icons for the plottingand regression servicesappear on the buttonbar.

Figure 1

The report shown in Figure 1 is displayed, and tabulates monthly datafrom January 1978 through to December 1987. The column fields areself-explanatory.

A quick visual indication of any relationship between the risk premiumfor Tandy and the risk premium for the market can be assessed by aScatter plot. The relevant selected fields are shown in Figure 2, on thenext page; note that the lead field is on the Risk Tandy field which is theY axis field.

Page 6: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 6

Lead field for selection

Choose Scatter fromthe list of chart types.

Figure 2

Figure 3 shows the Scatter plot of the data produced using the plottingservice:

Figure 3

Page 7: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 7

Note that, in all the examples below, the charts can be customised usingthe plotting service call-back gr$_recmod_fnc; these notes show thedefaults used.

As you can see from the Scatter plot, there is clearly a positiverelationship between the risk premium of the market and the riskpremium of the Tandy Corp, as would be intuitively expected. As themarket return increases, so should that of the majority of stocks.

To fit a linear regression model, the selection of fields from the tableremains as for the Scatter plot. Figure 4 shows the menu displayed whenthe Regression Services button is selected (tooltips are available if youneed help).

Figure 4

+

Page 8: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 8

Selecting the Linear option will fit a linear model to the data, anddisplay the plot shown in Figure 5. This shows the original data and thefitted data:

This line shows riskpremium for Tandy

Figure 5

The statistics associated with the fitting can be viewed by selectingStatistics from the Present menu; they are shown in Figure 6, below:

gradientparameter beta

Figure 6

Page 9: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 9

The output displays the parameter estimates and summary statistics forthe model such as the Durbin-Watson, Sum of Squared Errors, andGoodness of Fit.

The gradient parameter beta is 1.05; this is the rate of change of therisk premiums for Tandy as the risk premiums for the market change. Ifthe risk premiums for the market were to increase by, say, 10%, then therisk premiums for the Tandy stock would increase by 10.5%. Theintercept parameter alpha can be interpreted as the risk premiums forTandy if the risk premiums for the market are 0.

Clearly, if alpha were always greater than zero, the Tandy stock wouldbe returning an amount greater than expected. Investors would then beexpected to buy Tandy stock, causing its price to rise.

An examination of the regression plot shows how closely the model fitsthe data, and is a visual indication of what the various statistics aim toconvey. The Sum of Squares, Mean Square Error, and Goodness of Fitcan be used as measures of the fit. However, the importance of a visualexamination cannot be overemphasised.

Looking again at the statistics, the Mean Square Error is 0.011164; thesmaller this error the better the fit. The Goodness of Fit value is 0.3191,which means that about 32 % of the variation in the risk premium of theTandy corporation can be ‘explained’ by variations in the risk premiumof the market.

The F-Value allows you to determine if there really is a statisticalrelationship between X and Y. This value is a ratio of two mean squares,where the numerator refers to the variance explained by the regressionand the denominator the variance that is unexplained. The larger the F-Value, the more evidence there is that the regression relationshipactually exists. The numbers in brackets following the F-Value are thedegrees freedom of the numerator and denominator, and are necessarywhen looking up F tables. The F-Value of 55.31, with (n,p) degrees offreedom confirms that there is strong statistical evidence of the linearrelationship postulated in our model.

The Durbin-Watson statistic is 1.89; this indicates there is insignificantevidence that autocorrelation exists in the errors. In general, values closeto 0 indicate positive autocorrelation, while values close to 4 point to

Page 10: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 10

negative autocorrelation. Presence of autocorrelation would indicate thatthe postulated model cannot adequately explain the data.

Example 2 – Forecasting by extrapolation the yield on 90 day USTreasury billsThis example illustrates an attempt to use regression and extrapolation toforecast the yield from 90 day US Treasury bills. To load the data andrelated report execute the Holos file holos_examples:treas.hl:

EXECUTE "holos_examples:treas.hl"

The report shown in Figure 7 shows the yield on 90 day Treasury Billsfrom October 1962 to October 1982, 250 samples in total:

Figure 7

Page 11: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 11

The yield and the logarithm of the yield are shown. A line plot of thedata, shown in Figure 8, shows that it will be difficult to forecast usingsimple regression:

Figure 8

A logarithmic transformation ‘straightens’ the data as shown in Figure 9,however there is still considerable variability:

Figure 9

Page 12: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 12

Select Options from the Regression service menu, set the extrapolationat 20 and the ‘Plot Best Curves’ field to 0. Select Linear from theRegression service menu; this gives the plot shown below, in Figure 10:

Figure 10

It would clearly be unwise to use the use the extrapolated values asforecasts. Indeed, if we choose Statistics from the Present menu,

Figure 11

Page 13: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 13

we can see that the Durbin-Watson statistic is 0.09, which in thisexample indicates the strong presence of positive autocorrelation in theerrors and that the simple regression model is inadequate.

We can explore the possibility of using some alternative curve type.Consider, for example, the best three curves that fit this data. Again,choose Options from the Regression Services menu, then choose toextrapolate 20 periods and plot the three best curves:

Figure 12

Clicking OK will plot the three best curves:

Figure 13

Page 14: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 14

Choosing All Curves directly from the menu will do a regression usingall curves, and present the best curve fitted (see below).

Figure 14

The plot shown in Figure 14 shows that the best curve is, in fact, anexponential curve; however, for purposes of forecasting, the results arestill unsatisfactory.

Multivariate regression service

If two or more independent variables are involved in a regression model,then we have a multiple regression model. The general multivariateregression model can be written as

i 0 1 1i 2 2i n ni iY = + X + X +... X +

Often, a multivariate regression model will be used to describe therelative importance of the independent variables. These may bemeasured in different units and may differ in magnitude. To standardisethe coefficients, each variable should be standardised by subtracting itsmean and dividing by its estimated standard deviation.

Page 15: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 15

Alternatively, we can use the raw data as usual, and then convert theregression coefficients to standardised coefficients by

j*

jX

Y

= ss

j

where the s refers to the sample standard deviations.

Example 1 – Modelling sales using multivariate regressionIn this example, we consider how the sales of a certain product areaffected by the sales of a competitor’s product and the advertisingexpenditure. It would, of course, be expected that the effects of time lagsneed to be taken into account. For example, the advertising in aparticular month may have no immediate effect on sales; the firstnoticeable effect might come a few months later.

To load the data and relevant report, execute the Holos fileholos_examples:advert.hl:

EXECUTE "holos_examples:advert.hl"

The report shows sales, competitor sales and advertising expenditure fora 120 month period (see below).

Figure 15

Page 16: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 16

If we select the three variables and choose Line from the Chart stylesmenu, a line plot reveals that there is indeed a relationship betweenthem.

Figure 16

Set the Sales X field as the lead field in the multiple selection, chooseMLR from the list of Multivariate Regression services; the chart shownon the next page is displayed.

Page 17: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 17

Figure 17

The associated statistics are shown in Figure 18

Figure 18

and show, as expected, the negative sensitivity of sales to competitorsales and the positive effect of advertising. The R-Bar-Squared statisticindicates that about 66% of sales variation is explained, whilst the

Page 18: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 18

F-Value demonstrates that there is strong evidence for the existence of astatistical relationship between the dependent and independent variables.

Using recursive multivariate regressionThe recursive option may be useful in situations where the relationshipsbetween the dependent and independent variables are changing/evolvingin time.

In the example above, it is certainly feasible that the businessenvironment has changed over the period of 120 months (10 years).Perhaps, initially, sales were very sensitive to advertising, whereas inlater months, the effect of advertising is marginal and competitor sales isthe dominant factor. Using the recursive option, the model can be madeto remain in ‘tune’ with the latest data and forget (exponentially) thepast.

We shall now consider using the recursive option on the above salesdata. The regression plot (Figure 17) shows that the closeness of fit israther uneven, being the best around the middle of the data at 60 months.

Select Options from the ‘Regression mlr_service’ dialog (see below).

Figure 19

Page 19: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 19

Set the Forgetting Factor to be 0.9 (which means that the last ten monthsdata will be the most significant) and the Method to RECURSIVE.

Figure 20

This gives the fit shown in Figure 21:

Figure 21

Page 20: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 20

Visually, the fit is clearly more even and this is reflected in theR-Bar-Squared statistic:

Figure 22

Note, however, that the various sum of squared errors do not obey theclassical regression identities. This means that for certain data and/orforgetting factors, the actual regression variance is greater than the datavariance, leading to negative values for the R-Bar-Squared statistic; suchvalues are meaningless in such a context. Once again, we stress theimportance of a visual examination of the data and fitted data.

Comparing the two models, we find that the classical regression modelis

'Sales X' = 8638876 -1.92*'Competitor Sales' + 1.8*'Advertising'

whereas the Recursive regression with the better fit gives

'Sales X' =11859830 -3.44*'Competitor Sales' + 9.1*'Advertising'

There is a large discrepancy with the estimated coefficients. Therecursive model indicates that presently, advertising has a large effect onsales and that the competitor sales also are more important thanestimated by the classical model.

Page 21: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 21

Forecasting with Exponential smoothing and Winters method

The forecast service can be used to produce forecasts based onexponential smoothing models and the Winters model for seasonal data.Forecasts for general types of models can be produced using theBox-Jenkins service.

We will consider first the forecasting of series with a deterministic trend(constant, linear, quadratic, etc.) and noise fluctuations. The forecastingmethods in this service require no user judgement and are useful forquick ‘rough’ forecasts. The Box-Jenkins service can be used to findbetter forecasts, but requires some user judgement.

Exponential smoothing methodsThe exponential smoothing methods to forecast are based on the simpleidea that the forecast value is a weighted average of past values of theseries. The weights are exponentially decreasing, with recent valueshaving larger weight than older observations. Simple, double and morecomplex forms of exponential smoothing exist. For single exponentialsmoothing

F(t +1) = Y(t) + (1- )F(t)

where

F(t+1) is the smoothed value, given observation up to time t. It is theforecast of Y(t+1).

is the smoothing constant and must be 0 < α < 1

The meaning of exponential smoothing can be better seen if the aboveequation is recursively expanded

F(t + 1)= Y(t)+ (1 - )Y(t - 1)... (1 - ) X(t - N + 1)+ (1 - ) F(t - N + 1)N -1 N

The weights on past observations clearly decrease exponentially.

Smoothing a smoothed series gives double exponential smoothing, andsmoothing a doubly-smoothed series will give triple exponentialsmoothing. The type of smoothing necessary will depend on the type oftrend in the data. For constant trend data use single smoothing, for lineartrends use double exponential smoothing. Triple exponential smoothingis necessary if there is a quadratic trend in the data.

Page 22: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 22

Plotting a line chart of the data using the plotting service may be usefulin deciding the type of smoothing. Note that the smoothing will produceforecasts that follow the trend in the data. This service actuallytransforms the exponential smoothing problem to an equivalentBox-Jenkins estimation; for some time series this may be problematic.

We will now consider some example data and use exponentialsmoothing to produce forecasts. The data represents the sales figures of atoy; to load the data and report, execute the file holos_examples:toy.hl:

EXECUTE "holos_examples:toy.hl"

The report shown in Figure 23, below, will appear:

Figure 23

Page 23: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 23

The plotted data would look like this:

Figure 24

To produce forecasts based on single exponential smoothing, selectSingle Exponential from the Forecasting services menu. The formshown in Figure 25 will appear, requesting the forecast distance and theback distance (the number of data points to hold back):

Figure 25

With such a small data we set the back steps as zero and the forecastdistance (Lead Steps) as, say, 5 periods. Note that the forecast will be a

Page 24: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 24

constant using this method. The upper and lower confidence intervalswill, however, diverge.

Figure 26 shows the resulting plot:

Figure 26

The double and triple exponential smoothing options are invoked in asimilar fashion, and the resulting plots are shown in Figures 27 and 28,respectively. Note the linear and quadratic trends in the forecasts.

Figure 27

Page 25: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 25

Figure 28

Using the Winters method to forecast seasonal seriesWe will now consider time series that consist of seasonal fluctuations, inaddition to a deterministic trend and noise. The methods can be thoughtof as quick and automatic calculations and plots of forecasts andconfidence intervals. To get better accuracy, the Box-Jenkins service canbe used to fit more general models.

To illustrate the methods, we use data that represent the sales of a softdrink. Sales are expected to be seasonal, peaking in the summer months.To load the data and report, execute the Holos fileholos_examples:cola.hl:

EXECUTE "holos_examples:cola.hl"

Page 26: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 26

The report shown below will be displayed:

Figure 29

and the plotting service can be used to produce the data plot inFigure 30:

Figure 30

Seasonal cycle is 12 months

Page 27: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 27

The seasonality is clear from the clear and regular peaks shown by theplot and appears multiplicative, i.e. the seasonal time series is of theform

Y(t) = (c + lt)s(t) + e(t)

where:

c is the constant trend coefficient

l is the linear trend coefficient

s(t) is the seasonal component at time t

e(t) is the noise or error term.

An additive model would be

Y(t)= c+lt + s(t)+e(t)From the plot it is apparent that the seasonal cycle is 12 months. Formore noisy data, the Fourier service can help identify the seasonal lag.

Selecting Multiplicative Winters from the Forecast service menu

Figure 31

will bring up the form shown in Figure 32, overleaf.

Page 28: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 28

Figure 32

This form allows you to set the forecast distance (Lead Steps), hold backdistance (Back Steps) and seasonal lag. In our example, 24 has been setfor the forecast distance and 12 for the seasonal lag; this report is thengenerated:

Figure 33

For comparison purposes the equivalent plot using the Additive Wintersmethod is shown on the next page.

Upperconfidenceinterval

Lowerconfidenceinterval

Forecast

Page 29: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 29

Figure 34

Using Winters method to forecast international airline passengersThe data set of international airline passengers is a well known examplefrom the classic Box and Jenkins book. We shall use additive andmultiplicative Winters methods to produce forecasts.

To load the data and report, execute the Holos fileholos_examples:air.hl:

EXECUTE "holos_examples:air.hl"

which displays the report shown in Figure 35 (see next page).

Upperconfidenceinterval

Lowerconfidenceinterval

Forecast

Page 30: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 30

Figure 35

Selecting Additive Winters method from the Forecast services menu,then choosing forecast distance as 24, hold back distance as 36 and theseasonal lag as 12, e.g.

Figure 36

Page 31: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 31

results in the forecast plot shown below:

Figure 37

With this data set, we have the luxury of being able to compare theforecasts with actual data. As the forecast values for the held back 36points show, the forecast accuracy is very good. A plot of the sameforecasts using the multiplicative Winters method is shown in Figure 38,below:

Figure 38

Forecast

Actual Data

Page 32: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 32

Spectral analysis

The Fourier service can be used to perform various spectral tasks. Themajor use of the service will be the detection of cyclical patterns in timeseries data. At times, the cyclical pattern is obvious and can be readilypicked out by eye. However, in many cases the presence of noise canobscure the cyclical patterns present. We shall use real time series datato illustrate the use of spectral analysis.

Spectral analysis of airline passenger dataConsider the airline passenger data that can be loaded by executing theHolos file holos_examples:air.hl:

EXECUTE "holos_examples:air.hl"

A plot of the airline data is shown in Figure 39:

Figure 39

Page 33: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 33

Selecting the Fourier service

will result in the plot shown in Figure 40:

Figure 40

Note that by default the series is detrended, otherwise the trend wouldtend to dominate and obscure the analysis. The generated plot is called aperiodogram and shows a decomposition of the time series in terms ofthe strengths of component frequencies present. A normalised frequencyscaling is used in which the highest frequency is 0.5 units.

To view the periodogram in terms of periods, click on the Period buttonat the top of the plot.

Page 34: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 34

A pop-up window will prompt for the maximum period to be displayed.

If no number is entered a default value is used. The period plot for theairline data is shown in Figure 41 and shows that there is a clear peakaround 12 months, as well as a minor peak at six months:

Figure 41

The Component button at the top of the report window allows you toview how the various components sum to build up the data (detrended).

Selecting the ‘Component’ button will display the options shown on thenext page in Figure 42.

Page 35: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 35

Figure 42

The Frequency or Period of interest may be selected; alternatively, anumber of Peaks can be specified. The Resolution is the number ofneighbouring frequency points that are taken into account in determiningthe contribution of the components; by default, the resolution is two. Aplot is then generated with the detrended data superimposed on thecontributions from the selected frequency/period or peaks. SelectingPeaks, and entering 2 as the number of peaks, results in the plot shownin Figure 43:

Figure 43

This corresponds to the detrended data and the contributions of the peaksat 12 and six months.

Page 36: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 36

SunspotsSunspot activity is cyclical, reaching a maximum every eleven years.The Fourier service will be used to confirm this by analysing a numbercalled the ‘Wolfer number’, which is a measure of the number and sizeof sunspots. Astronomers have tabulated the Wolfer number for nearlythree hundred years.

To load the data and report, execute the Holos fileholos_examples:sun.hl:

EXECUTE "holos_examples:sun.hl"

The report is shown in Figure 44:

Figure 44

with the data plotted in Figure 45 from which the periodic behaviour(albeit uneven) is readily apparent.

Page 37: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 37

Figure 45

Selecting the Fourier option (which will detrend the data) gives therather jagged periodogram shown in Figure 46:

Figure 46

Selecting the Period button and using the default setting for themaximum period gives the plot shown in Figure 47, with the spectrumpeaking at about 11.1.

Page 38: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 38

Figure 47

We can conclude, as expected, that there is a very prominent cycle witha length of about 11 years.

Box-Jenkins service

The Box-Jenkins service can be used to model and forecast time seriesusing general models. It is not the purpose here to give an in-depthtutorial on Box-Jenkins; only a brief overview is given. Numeroustextbooks and papers that explain the ideas and related techniques areavailable. The approach taken will be to apply the Box-Jenkins serviceto forecast a number of real-life time series.

General overviewThe Box-Jenkins method of analysing time series is an iterativeprocedure that involves three or four phases.

The initial step, often called the identification step, involves specifying amodel to be estimated. The autocorrelation and partial autocorrelation ofthe data and differenced versions of the data are key tools in theidentification phase.

Once a model has been postulated, its parameters need to be estimated;this is the estimation phase. Once a model has been estimated, theadequacy of the fitted model needs to be diagnosed. If the diagnosisshows an inadequate model, we must go back to the identification phase.

Page 39: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 39

Once a satisfactory model has been estimated, forecasts can begenerated. If these prove to be inadequate, we may need to reconsiderthe model and/or the estimation.

Example 1 – forecasting electricity productionThe first set of data that we shall use is a monthly record of electricityproduction data in thousands of kilowatt hours from 1972-1989, takenfrom the Survey of Current Business.2 It is particularly important to beable to anticipate future electricity demand, since generating stations areexpensive to construct and require long lead times. By accuratelymodelling demand, we can aim to accurately forecast demand. Thedemand will, of course, be influenced by factors such as price, theincome of consumers, availability of alternative energy sources, and soon. Such models are useful in controlling demand, by modifying theprice. We shall, however, take a purely univariate approach to theanalysis of the data. To load the data and report, execute the Holos fileholos_examples:elec.hl:

EXECUTE "holos_examples:elec.hl"

which will display the report shown in Figure 48:

Figure 48

2 US Department of Commerce 1990

Page 40: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 40

A plot of the data is shown in Figure 49:

Figure 49

This the first step of the analysis process and will highlight any obviousanomalies. Indeed, the identification stage will require visual inspectionof several types of plotted functions. In particular, an examination of theautocorrelation and partial autocorrelation plots for recognisable patternsis the first stage of identification. By comparing the sample plots totheoretical patterns for AR, MA and ARMA processes, sensible modelscan be postulated. Details may be found in the references; with theinteractive services provided by Holos, you can try out various forms ofdifferencing and analysis to arrive at an educated conclusion.

Plotting the electricity production data, as shown in Figure 49,immediately reveals seasonal patterns in the data. Electricity productionpeaks in the summer months (air conditioners) and has a second, smallerpeak in the winter months.

Page 41: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 41

Figure 50

A Fourier analysis, shown in Figures 50 and 51 (see next page),confirms the presence of six month and annual cycles. Furthermore, wesee that there is a clear upward slope and that peaks tend to get largerover time. The series is clearly nonstationary at both monthly andseasonal lags.

Figure 51

Page 42: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 42

If you select the Box-Jenkins service, this menu will appear:

Figure 52

Choosing the Identify option brings up the shorthelp shown in Figure53.

Figure 53

Since we are dealing with a seasonal process we should specify a largenumber of lags at which to observe the Autocorrelation and Partialautocorrelation. We shall choose to observe the correlations to 60 lagsby selecting Shift from the list of options and entering 60:

Figure 54

Page 43: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 43

Choosing Autocorrelation from the shorthelp list

Figure 55

will result in the plot shown below in Figure 56.

Note that the colours used in the next four chart representations havebeen lightened for clarity.

Figure 56

The autocorrelation dies off very slowly because of month-monthnonstationarity.

+

Page 44: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 44

If we double-click on the report in Figure 56 to expand the chart, we caneasily note the large autocorrelations of about the same magnitude atlags 1 and 12 (see below).

Spikes

Figure 57

Such large statistically significant autocorrelations are called spikes.There are large spikes at 12, 24, 36, and 48. Smaller spikes exist at otherlags. The seasonal autocorrelations decay slowly, and imply anonstationary seasonal component.

We clearly need to difference the data in order to make it stationary;furthermore, both non-seasonal month-month differences as well asseasonal differences at twelve month intervals are necessary. However,to be cautious, we shall take only simple differences first.

Page 45: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 45

Clicking on the Difference button will bring up the form shown inFigure 58. Enter 1 in the Simple selection and click on OK.

Figure 58

This will cause the autocorrelation plot to be redrawn for the differenceddata, as shown in Figure 59.

Figure 59

The autocorrelation at the seasonal lags is vividly apparent.

Page 46: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 46

Entering both differences as in Figure 60,

Figure 60

results in the autocorrelation plot shown in Figure 61:

Figure 61

There are now spikes at lags 1, 2, 12 and 13. The presence of negativespikes at lags 1 and 12, and the smaller positive spikes at 2 and 13 implyan interaction between the non-seasonal and seasonal factors –multiplicative seasonal model.

Page 47: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 47

We shall initially estimate a Moving Average model (0,1,1)(0,1,1) in the(p,d,q)(P,D,Q) notation. If you select the Estimation option

Figure 62

then complete the relevant entries concerning the model order as inFigure 63:

Figure 63

Page 48: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 48

If we then click OK, this chart is produced:

Figure 64

The results of the fitting can be viewed by selecting the Present menuoption on the chart that is produced once the estimation is done, asshown in Figure 65:

Figure 65

Page 49: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 49

So how adequately does this estimated model fit the data? We candiagnose the adequacy by selecting the Diagnosis option:

Figure 66

which calls the shorthelp shown in Figure 67:

Figure 67

Page 50: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 50

Selecting Autocorrelation will draw a plot of the autocorrelations of theerrors or residuals:

Figure 68

If the model does indeed fit the data then the residuals should be totallyuncorrelated (white noise). However, as the autocorrelation plot, shownin Figure 68, illustrates, there exists significant correlation at severallags.

The partial autocorrelation, shown in Figure 69, paints a similar picture(see next page).

Page 51: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 51

Figure 69

Since there was a significant spike at lag 2 in the autocorrelation of thedifference data, again choose Estimation from the list of Box-Jenkinsservices, but this time estimate a (0,1,2)(0,1,1) model instead:

Figure 70

Page 52: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 52

The results of the estimation are shown in Figure 71:

Figure 71

If we again choose the Diagnosis option from the list of Box-Jenkinsservices, we see that the autocorrelations are insignificant:

Figure 72

We can therefore conclude that model gives a good fit to the data, andshall now proceed to use it to make forecasts. Before we produce

Page 53: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 53

forecasts we can visually ‘assess’ the accuracy of the forecasts, byspecifying a hold-back distance in the Estimation option report form (seebelow).

Figure 73where the last 24 data points will be held back so that forecasts can bevisually compared with actual data. Figure 74 shows the resulting plot ofthe forecasted values (see next page).

Page 54: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 54

Note that confidenceintervals are graduallydiverging

Figure 74

The forecasts follow the seasonality pattern with the confidence intervalsgradually diverging the further the forecast is into the future. If we againchoose Estimation from the list of Box-Jenkins services, and change theForecast Distance to 24, a chart like the one below would be produced,showing a plot of producing 24 forecasts of future values of the data.

Upper confidence interval

Lower confidence interval

Figure 75

Page 55: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 55

Example 2 – iron and steel exports 1937-1980Consider fitting a model to the US iron and exports from 1937-1980. Toload the example data, execute the file holos_examples:iron.hl:

EXECUTE "holos_examples:iron.hl"

The report shown in Figure 76 is displayed:

Figure 76

Choosing Line from the list of plotting services will plot the data asshown in Figure 77 (see next page).

Page 56: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 56

Figure 77

Using the Identify option from the Box-Jenkins list of options, we cancalculate and plot the Autocorrelation and Partial autocorrelationfunctions as shown in Figures 78 and 79, respectively.

Figure 78

Page 57: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 57

Figure 79

From these plots it is apparent that an MA(1) or AR(1) model appears tobe compatible with the data. We shall first fit an MA(1) model andexamine the residuals. Select Estimation from the list of services, thenfit an MA(1) or (0,0,1) (0,0,0), as shown here:

Figure 80

Page 58: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 58

This results in the model and statistics shown in Figures 81 and 82; notethat the FPE is 2.559:

Figure 81

Figure 82

Page 59: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 59

A plot of the Autocorrelation (Figure 83) of the residuals calculated anddisplayed using the Diagnosis option reveals that the residuals areindeed white, so that the MA(1) model is adequate.

Figure 83

Overfitting an MA(3) model will give the model and statistics shown inFigures 84 and 85, where we see that the FPE of 2.83 has actuallyincreased, verifying that the model is overfitted.

Figure 84

Page 60: Business modelling using Holos Interactive Services

Business modelling using Holos Interactive Services

Page 60

Figure 85

Similar types of results are obtained if we fit AR(1) and AR(2) modelsand mixed ARMA models.