Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This problem is intended to be solved using R. if possible, could you include th

ID: 3065273 • Letter: T

Question

This problem is intended to be solved using R. if possible, could you include the code as well as the output?

TABLE E4.4 Data for Exercise 4 Period Period 195 310 316 325 335 318 355 420 410 485 420 460 395 390 450 458 570 520 400 420 580 475 560 14 15 16 17 4 19 20 21 10 23 24 12 Reconsider the linear trend data in Table E4.4. Take the first differ- ence of this data and plot the time series of first differences. Has differencing removed the trend? Use exponential smoothing on the first 11 differences. Instead of forecasting the original data, fore- cast the first differences for the remaining data using exponent smoothing and use these forecasts of the first differences to ob forecasts for the original data. 4.9

Explanation / Answer

The following is the code applied in R for the given question

Time Series forecast for raw data

Time series forecast of first difference

Forecasting

rm(list=ls(all=TRUE))
Data=read.table("Book1.csv",header=TRUE,sep=',') #Reading data from table
Data
Y_t=Data$Y #Extracting that variable which is of interest
Y1_t=rep() #Algorithm for first difference
for(i in 1:23)
{
Y1_t[i]=Y_t[i+1]-Y_t[i]
}
Y1_t
length(Y1_t)
plot.ts(Y1_t) #time series plot for First difference in data
windows()
plot.ts(Y_t) #Time series plot for raw variable

Y1_t_11=Y1_t[seq(1,11)];Y1_t_11 #Extracting first eleven values of data

#Fit the model and get predictions
Y1_t_mean=HoltWinters(Y1_t_11,alpha=0.2,#beta=FALSE,gamma=FALSE)
#Notes:beta=FALSE and gamma=FALSE gives EWMA
# gamma=FALSE gives double exponential smothing   
Y1_t_mean$fitted
Y1_pred=predict(Y1_t_mean,n.ahead=10,prediction.interval=TRUE)

#Plot the forecasting
plot.ts(Y1_t,xlim=c(1,24)) #forecasting of the remaining differences based on first eleven differences
lines(Y1_t_mean$fitted[,1],col="green")
lines(Y1_pred[,1],col="blue")
lines(Y1_pred[,2],col="red")
lines(Y1_pred[,3],col="red")

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote