stock.prices Import Dow Jones Industrial Average and NASDAQ indexes since 1999.economic.data Import real U.S. GDP growth since 2000.stock.prices
economic.data
Merge
Plot
stock.prices Import Dow Jones Industrial Average and NASDAQ indexes since 1999.Hint: Google tidyquant::tq_get() to find example codes.
Hint: Calculate yearly returns; create a new variable, year; and drop date.
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.
Hint: Create a new variable, year; convert price to decimal number; and drop date.
Hint: Google dplyr::left_join() to find example codes.
Hint: See the code in 4.2.1 Scatterplot in the textbook.
The Dow Jones index is more strongly correlated to GDP, which means it has a greater effect on the economy
Hint: Use message, echo and results in the chunk options. Refer to the RMarkdown Reference Guide.