Question

In: Computer Science

Please assist with how I can solve this in R For the usgdp series: if necessary,...

Please assist with how I can solve this in R

For the usgdp series:

  1. if necessary, find a suitable Box-Cox transformation for the data;
  2. fit a suitable ARIMA model to the transformed data using auto.arima();
  3. try some other plausible models by experimenting with the orders chosen;
  4. choose what you think is the best model and check the residual diagnostics;
  5. produce forecasts of your fitted model. Do the forecasts look reasonable?
  6. compare the results with what you would obtain using ets() (with no transformation).

Solutions

Expert Solution

`Hey,

Note: Brother if you have any queries related the answer please do comment. I would be very happy to resolve all your queries.

# a. if necessary, find a suitable Box-Cox transformation for the data;


autoplot(usgdp)
autoplot(BoxCox(usgdp, BoxCox.lambda(usgdp)))
# When I transformed the original data, I could get more linearly increasing line. Therefore I'm going to do Box-Cox transformation.
lambda_usgdp <- BoxCox.lambda(usgdp)


# b.fit a suitable ARIMA model to the transformed data using auto.arima();


usgdp_autoarima <- auto.arima(usgdp,
lambda = lambda_usgdp)
autoplot(usgdp, series = "Data") +
autolayer(usgdp_autoarima$fitted, series = "Fitted")
# It looked like the model fits well to the data.
usgdp_autoarima
#ARIMA(2, 1, 0) with drift model after Box-Cox transformation.


# c. try some other plausible models by experimenting with the orders chosen;


ndiffs(BoxCox(usgdp, lambda_usgdp))
# the data need 1 first differencing to be stationary.
ggtsdisplay(diff(BoxCox(usgdp, lambda_usgdp)))
# ACF plot shows sinusoidal decrease while PACF plot shows significant spikes at lag 1 and 12. I think that I can ignore the spike at lag 12 because the data are aggregated quarterly, not monthly. Therefore, I'll experiment with ARIMA(1, 1, 0) model.
usgdp_arima.1.1.0 <- Arima(
usgdp, lambda = lambda_usgdp, order = c(1, 1, 0)
)
usgdp_arima.1.1.0
autoplot(usgdp, series = "Data") +
autolayer(usgdp_arima.1.1.0$fitted, series = "Fitted")
# I'll also try ARIMA(1, 1, 0) with drift model.
usgdp_arima.1.1.0.drift <- Arima(
usgdp, lambda = lambda_usgdp, order = c(1, 1, 0),
include.drift = TRUE
)
usgdp_arima.1.1.0.drift
autoplot(usgdp, series = "Data") +
autolayer(usgdp_arima.1.1.0.drift$fitted, series = "Fitted")
# It looked like that these models also fit well to the data.


# d. choose what you think is the best model and check the residual diagnostics;


accuracy(usgdp_autoarima)
accuracy(usgdp_arima.1.1.0)
accuracy(usgdp_arima.1.1.0.drift)
# Some errors show that ARIMA(2, 1, 0) with drift is the best model while others show that ARIMA(1, 1, 0) with drift is the best. Check the residuals of both cases.
checkresiduals(usgdp_autoarima)
checkresiduals(usgdp_arima.1.1.0.drift)
# In either case, the residuals are like white noise series and are not normally distributed.
# I'll choose the best model as ARIMA(2, 1, 0) with drift model. With the model, RMSE and MASE values were lower. And there wasn't significant spike at lag 2 in ACF plot of ARIMA(2, 1, 0) with drift model, even if it exists in ARIMA(1, 1, 0) with drift model.


# e. produce forecasts of your fitted model. Do the forecasts look reasonable?


fc_usgdp_autoarima <- forecast(
usgdp_autoarima
)
autoplot(fc_usgdp_autoarima)
# It looked like the forecasts are reasonable.


# f. compare the results with what you would obtain using ets() (with no transformation).


fc_usgdp_ets <- forecast(
ets(usgdp)
)
autoplot(fc_usgdp_ets)
# It looked like these forecasts are more likely than the ones with ARIMA model. When trend is obvious, is ETS better than ARIMA model? I wonder about it.
```

Kindly revert for any queries

Thanks.


Related Solutions

How can I solve this in Excel? Please show how to solve it in excel step...
How can I solve this in Excel? Please show how to solve it in excel step by step. 1) Speedy Wheels is a wholesale distributor of bicycles for the western United States. Its Inventory Manager, Ricky Sapolo, is currently reviewing the inventory policy for one popular model — a small, one-speed girl's bicycle that is selling at the rate of 250 per month. The administrative cost for placing an order for this model from the manufacturer is $200 and the...
How can I solve this problem? Can you please show step by step how to solve...
How can I solve this problem? Can you please show step by step how to solve this? Qd = 2,000 − 10P MC = 0.1Q
How do I check something is analytic. C-R is necessary but not sufficient. i was told...
How do I check something is analytic. C-R is necessary but not sufficient. i was told that I must also check if the partial derivatives are continuous. How would I do that?
Hello, I have been struggling with the problem for a while now. Can someone please assist?...
Hello, I have been struggling with the problem for a while now. Can someone please assist? I cannot find the data online much less calculate the standard deviation. 1. Go to finance.yahoo.com and find them monthly rates of return over a 2 year period for five companies of your choice. Now assume you form each month an equally weighted portfolio of five firms (a portfolio with equal investments in each firm). What is the rate of return each month on...
please, I need it with 30 minutes . can someone solve this ASAP and post ,...
please, I need it with 30 minutes . can someone solve this ASAP and post , I really appreciate. 4. "Machine A has an immediate cost of $15,000, and it will earn a net income of $4300 per year for a total of 7 years. Machine B has an immediate cost of $17,000, and it will earn a net income of $4400 per year for a total of 35 years. Assume that Machine A can continually be replaced at the...
Please explain how the Balanced Scorecard can be used to assist a company in executing its...
Please explain how the Balanced Scorecard can be used to assist a company in executing its strategy.
Please explain how the Balanced Scorecard can be used to assist a company in executing its...
Please explain how the Balanced Scorecard can be used to assist a company in executing its strategy.
How can interactive reporting assist organizations in decision making? please provide reference
How can interactive reporting assist organizations in decision making? please provide reference
Please! I want the instructions of how to solve it, not the answer. Write a program...
Please! I want the instructions of how to solve it, not the answer. Write a program that does the following in order: 1. Asks the user to enter a name 2. Asks the user to enter a number “x” 3. Asks the user to enter a number “y” 4. Calculates the sum of “x” and “y” 5. Prints out the number for “x”, “y” and “sum” An example of the program input and output is shown below: Enter your name:...
CAN YOU PLEASE POST THE R-SCRIPT ONLY The built-in data set LakeHuron is a time series...
CAN YOU PLEASE POST THE R-SCRIPT ONLY The built-in data set LakeHuron is a time series which provides records of annual measurements of the level, in feet, of Lake Huron 1875 to 1972. Using R we can convert this data into the vector x by the assignment x<-as.vector(LakeHuron). Assume that the n measurements x=( x1, x2,...,xn) are a random sample from a population with true unknown mean μ and true unknown variance σ2. Remember, let x be defined by x<-as.vector(LakeHuron)...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT