Time series analysis
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.
Collepals.com Plagiarism Free Papers
Are you looking for custom essay writing service or even dissertation writing services? Just request for our write my paper service, and we'll match you with the best essay writer in your subject! With an exceptional team of professional academic experts in a wide range of subjects, we can guarantee you an unrivaled quality of custom-written papers.
Get ZERO PLAGIARISM, HUMAN WRITTEN ESSAYS
Why Hire Collepals.com writers to do your paper?
Quality- We are experienced and have access to ample research materials.
We write plagiarism Free Content
Confidential- We never share or sell your personal information to third parties.
Support-Chat with us today! We are always waiting to answer all your questions.