预定/报价
时间序列代写|Time Series ST422 Assessed Coursework
时间序列代写|Time Series ST422 Assessed Coursework
yet2024-06-21 10:04:47

本次英国代写是一个R时间序列的coursework

The file Fuel price.csv on the project link on Moodle contains the weekly
time series of fuel prices for ultra-low sulphur unleaded petrol (USLP) and
ultra-low sulphur diesel (USLD). The project is on finding good forecasts for
both time series.

Read the weekly data into a dataframe, say fuel. Then read the fuel prices
series using

library(forecast)
library(lubridate)

ulsp = msts(fuel[,2], seasonal=365.25/7,
start = decimal_date(as.Date(“2003-06-09”)))

ulsd = msts(fuel[,3], seasonal=365.25/7,
start = decimal_date(as.Date(“2003-06-09”)))

(In your future endeavour with weekly data, you may want to remember that
frequency=52 is not exactly right, but should be exactly 365/7 for non-leap
years, and 366/7 for leap years, making it on average 365.25/7 as there is a
leap year every 4 years)

1. Present time series plots to display the data, and other proper plots
that you think is helpful to reveal the structure of the data. Describe
what you found.

2. Using the knowledge you gained from part 1, find time series models to
separately model the 2 different series. Write down the fitted models
for the 2 time series, and produce predicted values until the last week
of December 2021 using forecast. Remember to briefly justify your
final models chosen. If the no models are satisfactory, state so, and
use the one that you think is the most satisfactory among the ones you
tried.

3. Do the following for each series:

Split the data into 60% (the first 60% of data points) training data and
40% validation data. Use a rolling window with length D to predict
the next weekly measurement for the training data, each time moving
the window forward A weeks. You may use A = D=3 or A = D=2 to
reduce computational burden in practice.

Write an R function to compute the weekly squared prediction error,
and aggregate them to form a final prediction error for each window
length. Find a window length to minimise this prediction error. The
models you use within each window can start from auto.arima or just
use those fitted from the function if they are satisfactory.

Repeat the above for the validation data. Does the window length
found for the training data match the one found for the validation
data?

Determine a window length (with reasons), and predict the measure
ments until the last week of December 2021 using forecast. Are they
close to the answers in part 2?

4. Use the function mstl to decompose each series into trend, seasonal,
and residual components, and plot them. Then use forecast to predict
and plot predicted values until the last week of December 2021. Are
they close to the answers in part 2 or 3?

(If you are interested, check out the paper on mstl here ).