1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Portfolio Analysis in R

Exercise

The weights of a market capitalization-weighted portfolio

In a market capitalization-weighted portfolio, the weights are given by the individual assets' market capitalization (or market value), divided by the sum of the market capitalizations of all assets. A typical example is the S&P 500 portfolio invested in the 500 largest companies listed on the US stock exchanges (NYSE, Nasdaq). Note that by dividing by the sum of asset values across all portfolio assets, the portfolio weights sum to unity (one).

As an exercise, inspect the distribution of market capitalization based weights when the portfolio is invested in 10 stocks. For this exercise, you can use market capitalizations of 5, 8, 9, 20, 25, 100, 100, 500, 700, and 2000 million USD.

Instructions

100 XP
  • Define the vector marketcaps holding the market capitalizations.
  • Calculate the weights of marketcaps and assign them to weights.
  • Print a summary of weights.
  • Create a bar plot of weights.