LoslegenKostenlos loslegen

Compare old and new portfolios

Great work. You decide to buy stocks in Coca-Cola, and now your portfolio is made of equal proportions of four stocks: Yahoo, Microsoft, Apple and Coca-Cola.

In this exercise, you are given a dataset old.vs.new.portfolio with the following self-explanatory columns:

  • old.portfolio.value
  • new.portfolio.value
  • old.portfolio.rtn
  • new.portfolio.rtn

Diese Übung ist Teil des Kurses

Visualizing Time Series Data in R

Kurs anzeigen

Anleitung zur Übung

  • Plot the old portfolio value, then add the new portfolio value onto the same chart; make the old portfolio black and the new one red
  • Plot the density of the old portfolio returns, then add the density of the new portfolio returns on the same chart; make the old portfolio black and the new one red

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

# Plot new and old portfolio values on same chart



# Plot density of the new and old portfolio returns on same chart

Code bearbeiten und ausführen