stock.prices

economic.data

Merge

Plot

Q1. stock.prices Import Dow Jones Industrial Average and NASDAQ indexes since 1999.

Hint: Google tidyquant::tq_get() to find example codes.

Q2. Prepare the imported stock prices for merge.

Hint: Calculate yearly returns; create a new variable, year; and drop date.

Q3 economic.data Import real U.S. GDP growth since 2000.

Hint: Find the symbol in FRED. Select in the list of related variables, Percent Change from Preceding Period, Annual, Not Seasonally Adjusted.

Q4. Prepare the imported economic data for merge.

Hint: Create a new variable, year; convert price to decimal number; and drop date.

Q5. Merge the two data sets.

Hint: Google dplyr::left_join() to find example codes.

Q6. Plot the relaionship between stock returns (of both indexes) and GDP growth?

Hint: See the code in 4.2.1 Scatterplot in the textbook.

Q7. Describe the relationship between the two stock markets and economic growth. Which of the two indexes seems to have greater inflence on the economy?

Because of the steeper slope, Dow Jones has a stronger correlation to the economy than NASDAQ. NASDAQ doesn’t have a bad correlation either, and Dow Jones’ yearly returns stops at 25 percent while NASDAQ exceeds 75 percent.

Q8 Hide the messages, the code and its results on the webpage.

Hint: Use message, echo and results in the chunk options. Refer to the RMarkdown Reference Guide.

Q9 Display the title and your name correctly at the top of the webpage.

Q10 Use the correct slug.