stock.prices

economic.data

Merge

Plot

Q1. stock.prices Import S&P500 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 and GDP growth?

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

Q7. Describe the relationship between the stock markets and economic growth.

There is a relatively strong, positive correlation between stock markets and economic growth. While stock prices can indicate economic growth a year prior, it is not always accurate. However, it is a very reliable indicator.