เริ่มต้นใช้งานเริ่มต้นใช้งานได้ฟรี

Current portfolio description

Your savings are invested in a portfolio made of 3 stocks: Yahoo, Apple and Microsoft. Each stocks has the same weight in the portfolio at 33%. You have some extra cash to invest, but before going any further, you want to gather some information on your existing portfolio.

In this exercise, you are provided with a dataset data containing the value and the return of the portfolio over time, in value and return, respectively.

แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร

Visualizing Time Series Data in R

ดูคอร์ส

คำแนะนำการฝึกหัด

  • Plot the portfolio value with the title "Portfolio Value"
  • Plot the portfolio return with the title "Portfolio Return"
  • Plot a histogram of the portfolio return
  • Add a density line in red and twice as thick as normal

แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ

ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์

# Plot the portfolio value


# Plot the portfolio return


# Plot a histogram of portfolio return 


# Add a density line
แก้ไขและรันโค้ด