Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / PMBA 6331 Problem Set 2 The questions asked in this week’s homework move in step with questions reviewed in our exponential smoothing part 1 notes packet

PMBA 6331 Problem Set 2 The questions asked in this week’s homework move in step with questions reviewed in our exponential smoothing part 1 notes packet

Management

PMBA 6331 Problem Set 2

The questions asked in this week’s homework move in step with questions reviewed in our exponential smoothing part 1 notes packet.

Simple Exponential Smoothing Q1: Please use the “cod catch” data attached to answer the following questions:

  1. The main variable is “cod” measured as a firm’s monthly cod catch in tons.  What is the average monthly cod catch?  What is the standard deviation?
  2. Use Stata or MS Excel to graph the cod catch over time and copy and paste your graph into MS Word.  What pattern do you see?
  3. Use simple exponential smoothing to provide a forecast for each time period in the data set.  Please start with a smoothing parameter α = 0.1. 
  4. How accurate is your forecast as measured by the sum of squared residuals and the mean squared error?  How are these values measured?
  5. Finally, what value of α minimizes the forecast error (that is, what value of α minimizes the sum of squared residuals and the mean squared error)?

Holt’s Trend Corrected Exponential Smoothing Q2: Please use the “themostat” data to answer the following questions:

  1. The main variable under analysis is “sales” measured as weekly thermostat sales measured in thousands of dollars.  What are average weekly thermostat sales?  What is the standard deviation?
  2. Use Stata or MS Excel to graph thermostat sales over time and copy and paste your graph into MS Word.  What pattern do you see?
  3. Use Holt’s trend-corrected exponential smoothing to provide a forecast for each week in the data set.  Please start with smoothing parameters α equal to 0.2 and γ equal to 0.1.
  4. How accurate is your forecast as measured by the sum of squared residuals and the mean squared error?
  5. Finally, what are the values of α and γ that minimize the forecast error (that is, what are the values of α and γ that minimize the sum of squared residuals and the mean squared error)?

EXPONENTIAL SMOOTHING

Exponential smoothing provides a forecasting method that is most effective when the components of the time series may be changing over time.

It is a method that weights the observed time series values unequally – more recent observations are weighted more heavily.

SIMPLE EXPONENTIAL SMOOTHING

If the mean of a time series remains constant, the no trend model

yt=β0+εt (or equivalently, yt=μ+εt)

may be used to describe the data.  A least squares estimate of the mean β0 is

b0=y=1nt=1nyt=t=1n1nyt

When we compute b0 we are giving equal weight to each of the observed values of the times series.

When the mean (or level) of the time series is changing over time, the equal weighting scheme may not be appropriate.

A simple exponential smoothing model provides estimates for the mean that may change from one-time period to the next, and instead of giving equal weights, it gives the most recent observation the most weight.

Example 1: A plot of the following cod catch data suggests that there is no trend or seasonal pattern.  It is also possible that the level (or mean) may be changing slowly over time.

. cd c:\projects\pmba6331\expsmooth

. use codcatch, clear

. rename y cod

. generate time = _n

. scatter cod time, connect(l)

The simple exponential smoothing method begins by calculating an initial estimate l0 of the level (mean) at time period t = 0.  This can be obtained by averaging the first twelve values of data.

l0=t=112yt12=360.6667

The estimate of the level of the times series for time period T, denoted as lT, is equal to a portion of the value of the time series at time T, yT, less a portion of the estimate of the level of the time series at T-1, lT-1.

lT=αyT+1-αlT-1

This formula is referred to as the smoothing equation, which provides the new estimate of the level. 

The estimate of the level at time period T provides a forecast for time period T+1.

Note: Thus, the value of our initial estimate l0 provides a forecast for time period 1.  The value of l1 provides a forecast for time period 2.  This is solved for as

l1=αy1+1-αl0
=.1362+.9360.6667
=360.8

Again, this is our forecast for time period 2.

Forecasts in Stata can be obtained using the following command (remember, we must tsset our data before we can run time series commands).

. tsset time

. tssmooth exponential  ecod1 = cod, parms(.1) samp0(12)

In the smoothing equation α is referred to as the smoothing constant.

The more the level of the time series is changing, the more a newly observed value should influence our estimate.  Thus, a larger value of α should be set.

The sum of the squared errors of our forecast can be computed in Stata.

. generate error = cod - ecod1

. generate sqerror = error*error

. generate sse = sum(sqerror)

. di sse[24]

28735.111

In this case the smoothing constant was arbitrarily chosen at .1; however, it is possible to choose α so that the sum of squared errors is minimized using Stata’s default tssmooth command.

. tssmooth exponential  ecod2 = cod, samp0(12)

In summary, a point forecast made in time period T for yT+τ is

yT+τT=lT

If τ=1, then a 95% prediction interval computed in time period T for yT+1 is

lT±z.025s

In general, a 95% prediction interval computed in time period T for yT+τ is

lT±z.025s1+τ-1α2

where the standard error s at time T is

s=SSET-1=t=1Tyt-lt-12T-1

In our example, the estimate of the standard error can be obtained in Stata as follows.

. tssmooth exponential  ecod1 = cod, samp0(12)

. gen err = cod-ecod1

. gen sqerr=err*err

. gen ssqerr = sum(sqerr)

. di (ssqerr[24]/23)^.5

34.946629

We can use this and the formulas above to obtain prediction intervals.  For example, a 95% prediction interval for y27 is

354.5438±z.025s1+22=354.5438±1.9634.951+2.0342
=285.96,423.12

Note: The level of time period 24 is obtained as

l24=.034365+.966354.1701=354.54

In general, the smoothing equation

lTyT+1-αlT-1

implies

lT-1yT-1+1-αlT-2

Substitution gives us

lTyT+1-ααyT-1+1-αlT-2
yT+1-ααyT-1+1-α2lT-2

Substituting recursively for lT-2, lT-3, … , l1 and l0, we obtain

lTyT+1-ααyT-1+1-α2yT-2+?+1-αT-1αy1+1-αTl0

The coefficients measuring the contribution of the observations yT, yT-1, yT-2, … , y1 are α, 1-αα, … , 1-αT-1α are decreasing exponentially with age.[1]

For this reason, we refer to this procedure as simple exponential smoothing.

HOLT’S TREND CORRECTED EXPONENTIAL SMOOTHING

If a time series displays a linear trend and is increasing or decreasing at a fixed rate, then the time series may be described by the linear trend model.

yt=β0+β1t+εt

The level at time T is β0+β1T, and the level (or mean) at time T – 1 is β0+β1T-1.  Thus, the increase or decrease in the level of the time series from time period T – 1 to time period T is

β0+β1T-β0+β1T-1=β1

The fixed rate of increase β1 is called the growth rate.

Holt’s trend corrected exponential smoothing is appropriate when both the level and the growth rate are changing.

A model different from the linear trend model is needed to describe the changing level and growth rate.

To implement Holt’s trend corrected exponential smoothing, we let lT-1 denote the estimate of the level of the times series in time period T – 1, and we let bT-1 denote the estimate of the growth rate of the time series in time period T – 1.

Then, if we observe a new time series value yT in time period T, we use two smoothing equations to update the estimates lT-1 and bT-1.

The estimate of the level in time period T uses the smoothing constant α and is

lTyT+1-αlT-1+bT-1

This equation says that lT equals a fraction α of the newly observed time series value yt plus a fraction (1 – α) of lT-1+bT-1.[2]

The estimate of the growth rate of the times series in time period T uses the smoothing constant γ and is

bTlT-lT-1+1-γbT-1

This equation says that bT equals a fraction of lT-lT-1, which is an estimate of the difference between the levels in periods T and T – 1, plus a fraction 1-γ of bT-1, the estimate of the growth rate made in time period T – 1.

A point forecast made in time period T for yT+τ is

yT+τT=lTbT

In this equation, τ is the number of time periods ahead. 

If τ = 1, then a 95% prediction interval computed in time period T for yT+1 is

lT+bT±z.025s

If τ = 2, then a 95% prediction interval computed in time period T for yT+2 is

lT+2bT±z.025s1+α21+γ2

In general for τ > 2, a 95% prediction interval computed in time period T for yT+τ is

lTbT±z.025s1+j=1τ-1α21+jγ2

where the standard error s computed in time period T is

s=SSET-1=t=1Tyt-lT-1-bT-12T-2

Example 2: Use Holt’s trend corrected exponential smoothing to forecast weekly thermostat sales using  

"themostat.dta”. 

. use themostat.dta, clear

. rename y sales

. generate time = _n

. scatter sales time, connect(l)

. tsset time

. tssmooth hwinters hwsales=sales, parms(.2 .1)

As outlined in Stata’s manual, “tssmooth hwinters” is used in forecasting a time series that can be modeled as a linear trend in which the intercept and the coefficient on time vary over time.

The option “parms(#a #b)” specifies the values of the parameters α (equal to .2) and γ (equal to .1).

Variable hwsales contains one-period ahead forecasts for sales.  Again, the forecast for period T is based on the estimates of the level and growth rate in period T – 1.[3]

By default, initial values of the level l0 and growth rate b0 are estimated by using the first half of the data to fit a linear regression with a time trend.

Thus, we calculate a point forecast of y1 from time origin 0 to be

y10=l0+b0=202.6246+-.3682=202.2564

As you can see, this is the value for hwsales[1] in Stata.  This is the one-period ahead forecast at time period 0.

Note: The notation y10 means the forecast for time period 1 based on information in time period 0.

This can be confirmed using Stata’s regress command.

. regress sales time if _n <= 26

Using y1 = 206 and the equation for lT, the estimate of the level of the time series in time period 1 is

l1y1+1-αl0+b0
=.2206+.8202.6246+-.3682
=203.0051


Using the equation for bT, the estimate for the growth rate of the time series in time period 1 is

b1l1-l0+1-γb0
=.1203.0051-202.6246+.9-.3682
=-.2933

Thus, a forecast made for y2 in time period 1 (using information in time period 1) is

y21=l1+b1=203.0051+-.2933=202.7118

Again, this can be confirmed by looking at the value for hwsales[2] in Stata.

. di hwsales[2]

202.71179

In order to find the values of α and γ that minimize SSE, use the following command.

. tssmooth hwinters hwsales1=sales

Forecast errors, squared forecast errors, and prediction intervals can be calculated using the formulas on the pervious page.

 

[1] Explain the notation with a 3 or 4 period dataset.

[2] Which is the estimate of the level of the times series in period T (or T – 1? b/c lT is the estimate of the level of the time series in period T), as calculated using estimates lT-1 and bT-1 computed in time period T – 1.

[3] That is, a point forecast made in time period T for yT+τ is yT+τT=lTbT (e.g., if τ = 1).

 

HOLT-WINTERS METHODS

The additive Holt-Winters method is used for time series with constant (additive) seasonal variation.

Multiplicative Holt-Winters method is used for time series with increasing (multiplicative) seasonal variation.

Additive Holt-Winters Method

If a time series has a linear trend with a fixed growth rate, β1, and a fixed seasonal pattern, SNt, with constant (additive) variation, then the time series may be described by the model

yt=β0+β1t+SNt+εt

In regression, we use dummy variables to model SNt.  For this model, the level of the time series at time T – 1 is β0+β1T-1 and at time T is β0+β1T.

Hence, the growth rate from one-time period to the next is β1.

The additive Holt-Winters method is appropriate when a time series has a linear trend with an additive seasonal pattern for which the level, the growth rate, and the seasonal pattern may be changing.

To implement the additive Holt-Winters method, we let lT-1 denote the estimate of the level of time T – 1, and bT-1 will denote the growth rate in time T – 1. 

Suppose we observe a new time series value yt in time period T, and let snT-L denote the “most recent” estimate of the seasonal factor for the season corresponding to time period T.

Here L denotes the number of seasons in a year, and thus T – L denotes the time period occurring one year prior to time period T.

The subscript T – L of snT-Ldenotes the fact that the time series value in time period T – L is the most recent time series value observed in the season being analyzed.

Thus, it is the most recent time series value used to help find snT-L.

The estimate of the level of the time series in time period T uses the smoothing constant α and is

lTyT-snT-L+1-αlT-1+bT-1

where yT-snT-L is the deseasonalized observation in time period T. 

The estimate of the growth rate in time period T uses the smoothing constant γ and is

bTlT-lT-1+1-γbT-1

The new estimate for the seasonal factor SNT in time period T uses the smoothing constant δ and is

snTyT-lT+1-δsnT-L

where yT-lT is an estimate of the newly observed seasonal variation.

A point forecast made in time period T for yT+τ is

yT+τT=lTbT+snT+τ-L

where snT+τ-L is the most recent estimate of the seasonal factor for the season corresponding to T+τ.

A 95% prediction interval computed in time period T for yT+τ is

yT+τT±z.025scτ

If τ=1 then c1=1

If 2≤τ≤L then cτ=1+j=1τ-1α21+jγ2

If L≤τ then cτ=1+j=1τ-1α1+jγ+dj,L1-αδ2

The three smoothing equations of the additive Holt-Winters method can be put in the error correction form are as follows:

lT=lT-1+bT-1yT-lT-1+bT-1+snT-L
bT=bT-1+αγyT-lT-1+bT-1+snT-L
snT=snT-L+1-αδyT-lT-1+bT-1+snT-L

Note: The error correction form states that the estimate of the level in time period T is the sum of the estimate of the level in the previous time period T – 1 plus a fraction of the one-period ahead forecast error denoted by yT-lT-1+bT-1+snT-L.

Example 1: Four years of quarterly mountain bike sales are contained in “bike.dta".  A quick review of the time series suggests that mountain bike sales display a linear demand and constant (additive) seasonal variation

Thus, we can apply the additive Hold-Winter’s method to the bike sales data to find forecasts of future mountain bike sales as follows: 

. use bike.dta, clear

. rename y sales

. generate time = _n

. tsset time

. scatter sales time, connect(l)

Note: Stata obtains the initial values differently than the process outlined in most text books.

To reproduce findings you’d see in most books, start by finding estimates for the initial level, trend, and four seasonal factors. 

First, fit a least squares regression line to all four years of the data.

. regress sales time

As in Holt’s trend corrected exponential smoothing, we let the y-intercept be l0 and the slope of the regression line be b0.

The seasonal factors are found by the following three-step procedure:

  1. Use the least squares regression to compute yt for each time period.
  2. Detrend the data by computing yt-yt for each time period. 
  3. Finally, the initial seasonal factor in each of the L seasons is found by computing the average of the detrended values for the corresponding season.

This can be done in Stata as follows.

. predict psales

. generate detrend = sales-psales

. egen qtr = seq(), to(4)

. egen sn1 = mean(detrend) if qtr == 1

. egen sn2 = mean(detrend) if qtr == 2

. egen sn3 = mean(detrend) if qtr == 3

. egen sn4 = mean(detrend) if qtr == 4

This can be written as a looping statement, too.

. forvalues i = 1(1)4 {

            egen sn`i’ = mean(detrend) if qtr == `i’

}

. generate seas = .

. forvalues i = 1(1)4 {

            replace seas = sn`i’[`i’] if _n==`i’

}

Use the results above in the following command.

. tssmooth shwinters shwsales = sales, additive period(4) replace s0(20.85 .980882) sn0_0(seas) parms(.2 .1 .1)

The initial values of the level, growth rate, and seasonal factors estimated by Stata give slightly different results.  For example

. tssmooth shwinters shwsales = sales, replace parms(.2 .1 .1) samp0(4) period(4) additive altstarts

Note: If the altstarts option is specified, the starting values are computed based on a regression with seasonal indicator variables.  Specifically, the time series is regressed on a constant, a time variable equal to one in the first period, and seasonal dummy variables.[1]  This was done since it was not possible to estimate this model not including the parms() option unless altstarts is specified (Stata does not converge).[2]

Back to our first tssmooth command.  As you can see, shwsales[1] = 7.6147.  We can solve for this using the smoothing equations (we will use the error correction form).

Starting with the initial values, we calculate a point forecast of y1 from time origin 0 to be

y10=l0+b0+sn1-4=l0+b0+sn-3
=20.85+.9089+-14.2162
=7.6147

As stated before, one-period ahead forecasts are obtained using α = .2, γ = .1, and δ = .1.  Using y1 = 10 and the error correction equation for lT, the estimate of the level of the time series in time period 1 is

l1=l0+b0y1-l0+b0+sn1-4
=l0+b0y1-y10
=20.85+.9809+.210-7.6147
=22.3079


Using the error correction form for bT, the estimate for the growth rate in time period 1 is

b1=b0+αγy1-l0+b0+sn1-4
b0+αγy1-y10
.9809+.2.110-7.6147
=1.0286


Using the error correction form for snT, the estimate for the seasonal factor in time period 1 is

sn1=sn1-4+1-αδy1-l0+b0+sn1-4
=sn-3+.8.1y1-y10
=-14.2162+.0810-7.36147
=-14.0254


It follows that a point forecast of y2 in time period 1 (a forecast of y2 using data in period 1, or y21) is

y21=l1+b1+sn2-4=l1+b1+sn-2
=22.3079+1.0286+6.5529
=29.8895

This process is continued for all 16 periods.

In order to find values for α, γ, and δ that minimize the sum of squared forecast errors, use the from() option. 

. tssmooth shwinters shwsales = sales, additive period(4) replace s0(20.85 .980882) sn0_0(seas) from(.5 .1 .1)


 

Point forecasts and prediction intervals can be computed using the formulas above.

Multiplicative Holt-Winters Method

If a time series has a linear trend with a fixed growth rate and a fixed seasonal pattern with increasing (multiplicative) seasonal variation, the time series may be described by the multiplicative model

yt=β0+β1t*SNt*IRt

Here, IRt is an irregular component.

The multiplicative Holt-Winters method is appropriate when a time series has a linear trend with a multiplicative seasonal pattern for which the level, growth rate, and the seasonal pattern may be changing.

The notation for the estimate of the level, growth rate, and seasonal pattern in the multiplicative version of Holt-Winters is the same as in the additive version.

Thus, the estimate of the level of the time series in time period T uses the smoothing constant α and is

lTyT/snT-L+1-αlT-1+bT-1

where yT/snT-L is the deseasonalized observation in time period T.  The estimate of the growth rate in time period T uses the smoothing constant γ and is

bTlT+lT-1+1-γbT-1

The new estimate for the seasonal factor SNT in time period T uses the smoothing constant δ and is

snTyT/lT+1-δsnT-L

where yT/lT is an estimate of the newly observed seasonal variation.

A point forecast made in time period T for yT+τ is

yT+τT=lTbTsnT+τ-L

where snT+τ-L is the “most recent” estimate of the seasonal factor for the season corresponding to time period T+τ.

An approximate 95% prediction interval computed in time period T for yT+τ is

yT+τT±z.025srcτsnT+τ-1

if τ=1 then c1=lT+bT2

if τ=2 then c2=α21+γ2lT+bT2+lT+2bT2

if τ=3 then c3=α21+2γ2lT+bT2+α21+γ2+lT+2bT2+lT+3bT2

if 2≤τ≤L then

cτ=j=1τ-1α21+τ-jγ2lT+jbT2+lT+τbT2

The relative standard error sr computed in time period T is

sr=t=1Tyt-ytt-1ytt-12T-3=t=1Tyt-lt-1+bt-1snt-Llt-1+bt-1snt-L2T-3

For a better approximation and an exact formula, see Hyndman et al., 2001.

Example 2: An examination of the scatter diagram of sales of a popular sports drink over time reveal a linear increase with a seasonal pattern that is increasing as the level of the time series increases.  This pattern suggests that multiplicative Holt-Winters might be employed to forecast future sales.

. use sportsdrink.dta, clear

. rename y sales

. generate time = _n

. tsset time

. scatter sales time, connect(l)

. tssmooth shwinters shwsales = sales, replace parms(.2 .1 .1) samp0(4) period(4)

. tssmooth shwinters shwsales = sales, replace samp0(4) period(4)

Finally, we can these methods to easily generate forecasts.  Forecast 8 periods ahead using the following command:

. tssmooth shwinters shwsales = sales, replace samp0(4) period(4) forecast(8)

 

Again, Stata uses a different approach to get starting values for the level, growth rate, and seasonal factors.

 

 

[1]  The initial growth rate is set to the coefficient on the time variable, the initial level is set to the constant, and seasonal factors are computed by tweaking the coefficients on the seasonal dummy variables.  The default and the alternative methods are described in Methods and formulas in [TS] tssmooth shwinters.

[2] For example, try estimating the following two commands:

. tssmooth shwinters shwsales = sales, replace parms(.2 .1 .1) samp0(4) period(4) additive

. tssmooth shwinters shwsales = sales, replace samp0(4) period(4) additive

Option 1

Low Cost Option
Download this past answer in few clicks

12.98 USD

PURCHASE SOLUTION

Already member?


Option 2

Custom new solution created by our subject matter experts

GET A QUOTE

Related Questions