Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Exercise 4: time series analysis. Consider the following time series plot of daily morning gold prices, based on the gold data from the forecast package:

Exercise 4: 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:

  1. Add the text "Incorrect value" next to the circle.
  2. Create a second plot where the incorrect value has been removed.
  3. Read the documentation for the geom geom_hline. Use it to add a red reference line to the plot, at y=400.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

A First Course in Differential Equations with Modeling Applications

Authors: Dennis G. Zill

11th edition

1305965728, 978-1305965720

More Books

Students also viewed these Mathematics questions

Question

Explain how to transform sin tan + cos into sec.

Answered: 1 week ago