Time series analysis
Need help with this assignment?Get an original answer from a qualified tutor — from $10/page.
Get it written →Consider the following time series plot of daily morning gold prices, based on the gold data from the forecast package:
library(forecast)
autoplot(gold)
We’d like to add a note about the spike due to incorrect value to the plot. First, we wish to find out on which day the spike appears:
spike_date <- which.max(gold)
To add a circle around that point, we add a call to annotate to the plot:
autoplot(gold) +
annotate(geom = “point”, x = spike_date, y = gold[spike_date],
size = 5, shape = 21, colour = “red”, fill = “transparent”)
Using the figure created above and the documentation for annotate, do the following:
- Add the text “Incorrect value” next to the circle.
- Create a second plot where the incorrect value has been removed.
- Read the documentation for the geom geom_hline. Use it to add a red reference line to the plot, at y=400.
Get a plagiarism-free answer to this question
Send us your instructions and we’ll match you with the best writer in your subject.
- 100% human-written, zero AI
- Turnitin report included
- Confidential — we never share your data
- Free revisions & refunds