Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

QBUS6840

Predictive Analytics

Semester 1, 2022

Practice Question Banks

Question 1

The file beer .txt contains two named columns ’Time’(month) and ’Sales’(numerical). Read the following Python program:

[ 1 ]   import  pandas  as  pd

[ 2 ]   import  m a t p l o t l i b . p y p l o t  as   p l t

[ 3 ]   import  numpy  as          np

[ 4 ]   b e e r  = pd . r e a d  c s v ( ’b e e r . txt ’)

[ 5 ]   s a l e s  =  b e e r [ ’S a l e s ’]

[ 6 ]   s a l e s  v  =  s a l e s . v a l u e s

[ 7 ]     p l t . f i g u r e ( )

[ 7 ]     p l t . p l o t ( s a l e s )

[ 8 ]     p l t . t i t l e ( ’Beer  S a l e s ’)

[ 9 ]     p l t . x l a b e l ( ’Month ’)

[ 1 0 ]   p l t . y l a b e l ( ’S a l e s ’)

[ 1 1 ]  myT =  s a l e s  v . r o l l i n g ( 1 2 , c e n t e r=True ) . mean ( )

[ 1 2 ]  T =  s a l e s . r o l l i n g ( 2 ,   c e n t e r=True ) . mean ( )

[ 1 3 ]  T1 = T . r o l l i n g ( 1 2 ,   c e n t e r  =  True ) . mean ( ) ;

[ 1 4 ]   W h a t  i s  t h i s  =  b e e r [ ’S a l e s ’] . ewm( alpha =0 . 05 , a dj u s t=True ) . mean ( )

[ 1 5 ]   p l t . f i g u r e ( )

[ 1 6 ]   p l t . p l o t ( s a l e s )

[ 1 7 ]   p l t . p l o t (T1)

[ 1 8 ]   p l t . p l o t ( W h a t  i s  t h i s )

[ 1 9 ]   p l t . t i t l e ( ’Beer  S a l e s ’)

[ 2 0 ]   p l t . x l a b e l ( ’Month ’)

[ 2 1 ]   p l t . y l a b e l ( ’S a l e s ’)

Please answer the following questions:

(a) Explain the meaning of statement [4] in the program. What is the data type for variable beer?

(b) What is the data type of the variable sales in statement [5]?  What is the difference between sales and sales v from statement [6]

(c) Do you have any concerns about this program? At which line would you expect an error message when running this program or not? Why?

(d) How to handle the issue you identified in (c)?

(e) Write out the mathematical formula to replicate T from sales in statement [12].         (f) Explain the meaning of T1 in statement [13]. How many number of values/data have we

lost on the both ends of T1. Explain the reason for this.

(g) Explain the meaning of statement [14].

(h) Roughly sketch the figure given by statements [15]- [21]?  You may assume a monthly seasonal plot for the beer sales

Question 2

The simple exponential smoothing model is being applied to forecast sales figures (in 1000s of computers) for Dell computers.  Recall the simple exponential smoothing model:  given 0 ≤ α ≤ 1 and an initial l0 ,

lt     =   αyt + (1 α)lt1,  t = 1, 2, ...

yt+1     =   lt + ϵt+1,  t = 0, 1, ...,  with  ϵt+1  ∼ N(0, σ2 )

The last period’s sales figure was 125, while it was forecast to be 134.3.   The weighting parameter is α = 0.25.

(a) What is the point forecast of sales in the next time period?

(b) What is the 95% forecast interval for the next period’s sales figure?  Use z = 1.96 and assume the variance of the time series Yt  is σ 2  = 1.2

Show all your working, not just the final numerical answers.

Question 3

Which forecasting method forms a forecast by weighting the most recent data (in time) more highly than less recent data and how?

Question 4

Describe/List the main differences between qualitative and quantitative forecasting methods.

Question 5

Which measure of forecast accuracy should be used in the following situations?  Give their definition in formulas.

(a) A small number of large forecast errors may be allowed

(b) Errors need to be measured in percentage terms.

(c) Whether a model’s forecasts are biased or not is more important than the magnitude of

errors.

Question 6

Consider the following time series plot showing annual labour force data in Australia.

 

(a) Describe the main features or components apparent in the data

(b) List three quantitative forecast models that might be tried for this data, with brief motivation for each choice.

Question 7

Describe the multiplicative decomposition method by showing each major step.

Question 8

Showing all working

(a) Find the weights for the smoother Centred MA-6

(b) Indicate how many missing observations there will be at the start and end of the smoothed series in (a).

(c) Identify the smoothing method in (a) as a Weighted MA-k . What are k and the weights?

Question 9

The trend corrected exponential smoothing model is given by the equations:

lt     =   αyt + (1 α)(lt1 + bt1),      0 α 1

bt     =   γ(lt lt1) + (1 γ)bt1       0 γ 1

yt+1     =   lt + bt + ϵt+1 ,   with  ϵt+1  ∼ N(0, σ2 )

Showing all working, complete the following:

Put this model in the error correction form.

(b) Derive the 1, 2 and 3 step-ahead forecasts from this model.

Question 10

Note: this can be considered as a difficult question for some students.

Given cross-sectional data D = {(yi , xi ), i = 1, ..., N} and assume that the dependent variable Y and the single predictor variable X are related by the simple linear model:

yi  = β0 + β1 xi + ϵi ,     i = 1, ..., N                                           (1)

where ϵi   ∼ N(0, σ2 ), i = 1, ..., N are random noise.  Denote θ = (β0 , β1 , σ 2 ) the unknown model parameters, the likelihood function p(D|θ) associated with the linear model in (1) and the data D is defined as:

N

p(D|θ)   =       p(yi |xi , θ)

i=1

=   N         1    e [yi i )]2

l(θ)   :=   logp(D|θ)

 

i=1 2πσ2

Now, given a time series y1:T  = {y1 , ..., yT }, the Simple Exponential Smoothing model for this data is:


yt+1     =   lt + ϵt+1,  t = 0, 1,  , T 1,  with  ϵt+1  N(0, σ2 )                      (4)

The model parameters are θ = (l0 , α, σ 2 ).

(a) Derive the log-likelihood associated with the data y1:T  and the model defined in (3)-(4) (b) Based on (a), derive the estimator for σ 2 .

Question 11

Consider the damped Holt’ s linear model:

yt+1  = lt + ϕbt + ϵt+1

lt  = αyt + (1 α) (lt1 + ϕbt1)

bt  = γ (lt lt1) + (1 γ)ϕbt1

 

Figure 1

(a) Explain the meaning of lt  and bt .

(b) How do you choose the optimal α and γ?

(c) How would we modify the model to get the estimations on the blue line?

(d) Write down the expression for the h-step-ahead forecast.   What is the h-step-ahead forecasting value when h becomes large enough? explain the reason.

Question 12

The trend corrected exponential smoothing (TCES) model is given by the equations:


bt      =   γ(lt  lt1) + (1 γ)bt1         0 γ 1                                    (9)

yt+1     =   lt + bt + ϵt+1 ,   with  ϵt+1  ∼ N(0, σ2 )                                  (10)

Put this model in the error correction form.

(b) Derive the one-step-ahead and two-step-ahead forecasts together with their variance.

(c) The TCES model is applied to forecast the sales of a camping item (in the unit of 100s) in Australia. The current sales at time t is 131 with its one-step-ahead forecast error was 4.5. The last level value was lt1  = 125. The weight parameters α = 0.2 and γ = 0.25. What is the forecast for next period’s sales yˆt+1|1:t?

(d) Based on part (c), what is the 95% forecast interval for next period’s sales? Given that σ 2  = 1.5.

Question 13

The Autoregressive model AR(1) is

Yt+1  = c + ϕYt + ϵt+1,  t = 0, 1, ...,  0 < ϕ < 1,                               (11)

and ϵ 1 , ϵ2 , ... are independent normal random variables with mean 0 and variance σ 2 .


(a) Describe the behaviour of the Autocorrelation function (ACF) and Partial ACF of the

AR(1) model in equation (11).

(b) Suppose that the unconditional mean and unconditional variance of the time series are E(Yt ) = µ and V(Yt ) = τ 2 . Represent c in terms of µ and ϕ, and represent σ 2  in terms of τ 2  and ϕ .

(c) Derive the one-step-ahead forecast t+1|t  and two-step-ahead forecast t+2|t together with

Question 14

Let y1 , y2 , ..., y100  be a time series.  The last three observations are y98   = 2, y99   = 1 and y100  = 2.

(a) You are using a feedforward neural network with the structure given in Figure 2. The bi value next to each hidden unit denotes the bias term for that unit. The numbers on the edges are the estimated weights.

Suppose you are using the sigmoid activation function on all the hidden units and the

identity activation function is applied on the output unit. What is the forecast 101|100?

 

Figure 2: Neural network.

(b) You now use a simple recurrent neural network for forecasting

ht     =   σ(0.1yt + 0.1ht1  0.5),

yt+1     =   1 + 2ht + ϵt+1 .

where the ϵt are random error with mean 0, and σ(x)=1/(1+ex) is the sigmoid function.

The forecast for the last time period is 100|99 =1.5. Compute the point forecast for y101 .