T1-无代写
时间:2024-03-14
第 1 页 共 7 页
Tutor: Kelsa Duan
Date: 2024 T1
UNSW ECON2209
Business Forecasting
第 2 页 共 7 页
ECON2209 Business Forecasting
Problem Set 2
Marking criteria:
(a) Suitability of methods. 3 Marks 步骤 4
(b) Interpretation of the results, arguments used and conclusions drawn. 5 Marks
5 marks: Insightful discussion beyond what might reasonably be expected, possibly drawing on
external references and other research. 可以使用 reference的地方:features解释原因、概念描
述、方法的优劣势等
(c) Presentation: Appropriate style of graphs, tables, reporting and clarity of writing. 2 Marks
考虑图像的细节,比如说 label, x轴、y轴的名称、图片透明度等等。writing部分写成段落,注意
逻辑关系
Data: rthe number of females attending a tertiary education institution full-time while also
engaged in some kind of employment, i.e. the total of those engaged in part-time and full-time
employment. 在高等教育机构全日制就读并从事某种工作的女性人数,即从事兼职和全职工作的
女性人数的总和
Steps:
步骤 1: 直接运行 assignment instruction上的代码获取数据。
步骤 2: a. Make a time plot of your data and describe the main features of the series using this
one plot.
writing参考:
(1)介绍整个 time series
(2)描述 time series的特征:trend, season, cycle, unusual tears
相关知识点:Trend, Seasonal, Cyclic
整体趋势,上升/下降/不变
一年以内的pattern
通常来说是两年及以上的 pattern
第 3 页 共 7 页
步骤 3: b. Create a training data set using the data series up to and including February of 2020.
Visually check that the data were split appropriately by plotting the training and test data sets
in the same figure.
writing参考:
简单描述 training and test set, e.g.时间区间是多少,每个 set有多少个数据
相关知识点:Training & Testing set
我们只用 training data来建模型,test data是用来验证模型的准确性
why?
A model which fits the training data well will not necessarily forecast well.
如果用全部数据来建模,可能造成 over-fitting(模型只对建模的数据有用,再有新的数据来就不适
用了)
--> split training and test set
training - 用来建立模型
test - 验证模型的准确性,不能用在建模里!
步骤 4: c. Forecast the test data set using each of the following methods:
Holt’s linear trend method
Holt-Winters’ multiplicative method applied to the log transformed data
an STL decomposition applied to the data with a seasonal window of five years, followed by
an ETS model applied to the seasonally adjusted data.
4.1. build models
4.2. forecast
writing参考:
(1)描述每个model,model的概念、参数等,可以用把model改写为数学公式
(2)用 table列出 forecast的值
第 4 页 共 7 页
相关知识点:ETS Model
Recall: Time Series Decomposition 拆解
每一个 time series data point(Yt)是通过一个函数计算而来,X 包括 St, Tt, Rt
-> 所以 Yt可以拆解成对应的三部分:St, Tt, Rt
--> 我们分别通过对 St, Tt, Rt的预测,来形成 Yt的预测
Exponential Smoothing 指数平滑模型
平滑 - 滑动平均(Moving Average)
Exponential Smoothing = Exponential Moving Average
Moving Average
+ Exponential: 考虑了数据的时间远近对现在的影响:
时间久远的数据影响小,在计算moving average时就赋予一个小的权重
时间近的数据影响大,在计算moving average时就赋予一个大的权重
ETS model:分别考虑 level, trend, seasonal的 ES,
以及组合方式(Additive和Multiplicative)。
数据的时间远近对现在的影响 和 Moving Average
error的计算方式不同
原本的数据平滑后形成一个该数据的拟合值,所
有的拟合值组成了模型,然后基于模型进行预测
第 5 页 共 7 页
使用 ETS函数建模:
1. “半自动”:声明 E,T,S,自动估计各个参数。根据数据的特征,挑选备选模型。根据波幅确定
error, 是否有 trend,是否有 season
2. “全自动”:它能够根据时间序列的状况,选择最佳的模型(自动选择 E, T, S以及估计最佳参数)。
Damp Trend
在 trend的拟合/预测中引入了另外一个参数
ϕ用来削弱趋势性,ϕ越大则对趋势削弱的效
果越小,等于 1的时候则完全没有削弱的效
果。
Damped trend methods假设一个序列在短
期内是具有一定趋势的,但是在长期中却是
围绕着一个均值在波动。
当趋势和季节性变化独立作
用时,plot是 linear的,波幅
保持不变 -> additive
季节性效应的大小取决于趋
势的大小,波幅是变化的 ->
multiplicative
第 6 页 共 7 页
步骤 5: c. Plot the point forecasts and prediction intervals for all three models on one figure
along with the actual data, starting from 2015 (to make it easier to see the forecasts). Based on
the figure, discuss the relative performance of the different methods.
5.1. 截取原始数据(2015以后)
5.2. plot
writing参考:
(1)每个method的预测线/prediction intervals是怎样的,和原始数据相比有什么区别
(2)几个methods的预测线/prediction interval相比较有什么区别
(3)conclude和原始数据相比谁的 performance相对较好
步骤 6: d. Compare the accuracy of your forecasts against the actual values in the test set of
data by comparing the RMSE of the methods (using accuracy()). Based on the RMSE, which
method is best? Explain.
writing参考:
(1)RMSE是什么/概念
(2)怎么用 RMSE去比较model(RMSE越小,model的 accuracy越好)
(3)每个模型的 RMSE是多少
(4)根据(2),conclude 哪个方法是最好的
相关知识点:Forecast accuracy
Forecast accuracy is based only on the test set. (评判模型好坏的指标只基于 Test Data
Benchmarks Calculation Notes
MAE
mean( eT+h )
越小越好
MSE
mean( eT+h
2 )
越小越好
MAPE
100mean( eT+h
yT+h
)
越小越好
RMSE
mean( eT+h
2 )
越小越好
MASE 푚푒
eT+h
�
越小越好
test set的实际值/真实观测到的值
test set通过模型预测出来的值
test set每个点的实际值-观测值
第 7 页 共 7 页
步骤 7: e. Considering the RMSE values and the figure of forecasts, is there a justification for
using one of the other methods instead?
writing参考:
(1)RMSE给出的最佳模型是什么
(2)figure给出的最佳模型是什么
(3)两个的结论是否一致
(4)两个方法的优势与弊端是什么,是否足够下结论
(5)是否有其他的评判标准可以使用,理由?
步骤 8: f. Using plots, check and comment on the residuals of the method chosen by the
RMSE.
writing参考:
(1)根据每一个图像,residual是否具有以下特点:uncorrelated, mean zero, constant variance,
normally distributed, white noise
(2)conclude RMSE所选择的最优模型下的 residual是不是 white noise → 模型是否合理
相关知识点:Residual Diagnostic
时间序列通常被分解成 trend, seasonal和 residual三个部分。
我们通常对 trend和 seasonal进行建模,residual则是无法用模型解释的变化。
residual(无法解释的变化)是纯随机的,应该有以下的特点:uncorrelated, mean zero, constant
variance, (normally distributed)。这些特点刚好和 white noise的特点相符。
--> residual diagnostic
需要诊断 residual是不是 white noise从而来判断建立的模型合不合理(时间序列信息被
充分提取)
If they aren’t, then there is information left in the residuals that should be used in
computing forecasts.
步骤 9: g. Conduct a Ljung-Box test with 24 lags. What do you conclude?
writing参考:
(1)两个 lag下的 p-value是多少,根据 p-value residual之间是存在相关性还是独立的
(2)conclude residuals 是不是 white noise → 模型是否合理
相关知识点:Ljung-Box test
作用:诊断 residuals 是不是 white noise --> 我们建立的模型合不合理
如果 p<0.05,说明原始序列存在相关性。
如果 p>=0.05,说明原始序列独立,纯随机。 residuals are white noise