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

Anyone knows how to R to solve this problem? 3. The data set fancy (you need to

ID: 3751592 • Letter: A

Question

Anyone knows how to R to solve this problem?

3. The data set fancy (you need to library the fpp package to get the dataset) concerns the monthly sales figures of a shop which opened in January 1987 and sells gifts, souvenirs, and novelties. The sales volume varies with the seasonal population of tourists. (a) Produce a time plot of the data and describe the patterns in the graph. Identify (b) Use R function tslm to fit a regression model to the logarithms of these sales data c)Use multiple regression with trend variable and seasonal dummy variables to redo any unusual or unexpected fluctuations in the time series. with a linear trend and seasonal component the regression as shown in the lecture example. Check to see that you obtain the same results as tslm

Explanation / Answer

a)A time plot of the data is explained as follows:

plot(fancy)

#We can see a clear seasonal pattern in the data.In that season,During march,there is a spike in sales in peak in christmas season and also there is other small bump in sale during march.The unusual and unexpected fluctuations will get increase with the level of time series.

b)Multiple regression with trend variable and seasonal dummy variables to redo the regression is explained as follows:

plot(residuals(fit),type='p')

plot(as.numeric(fitted(fitt)), residuals(fit),type='p')

c)The increasing seasonal fluctuation in the data means that tt is necessary to take logarithm in oreder to get an additive model.For multiple regressionl,following code should be used:

log_fancy <- log(fancy)

dummy_fest = rep(0, length(fancy))

dummy_fest[seq_along(dummy_fest)%12 == 3] <-1

dummy_fest[3] <- 0

dummy_fest <- ts(dummy_fest, freq = 12,start=c(1987,1)

my_data <- data.frame(

log_fancy,

dummy_fest

)

fit <- tslm(log_fancy ~ trend + season + dummy_fest,data=my_data)

future_data <- data.frame(

dummy_fest = rep(0,12)

)

future_data[3,] <- 1

forecast(fit, newdata=future_data)

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