New stocks description (2)
Now that you know what the new stocks look like, you want to find out if any of them provide diversification benefits to your existing portfolio. You can do this by looking at the correlation of each stock to our portfolio, visualized through regression lines.
In this exercise, you are provided with four individual series containing the return of the same four stocks:
- Goldman Sachs (
gs
) - Coca-Cola (
ko
) - Walt Disney (
dis
) - Caterpillar (
cat
)
The return of your existing portfolio in portfolio
are also available in your workspace. Now it's your turn to analyze the relationships!
This exercise is part of the course
Visualizing Time Series Data in R
Exercise instructions
- Draw the scatterplot of
gs
against the portfolio - Add a regression line in red and twice as thick as normal
- On a single graphical window, draw the scatterplots and the regression lines of the four stocks against the portfolio in the order given in the assignment text; add a regression line in red and twice as thick as normal to each plot
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Draw the scatterplot of gs against the portfolio
# Add a regression line in red
# Plot scatterplots and regression lines to a 2x2 window