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.
This is a part of the course
“Introduction to Portfolio Analysis in R”
Exercise instructions
- Define the vector
marketcaps
holding the market capitalizations. - Calculate the weights of
marketcaps
and assign them toweights
. - Print a summary of
weights
. - Create a bar plot of
weights
.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Define marketcaps
# Compute the weights
# Inspect summary statistics
# Create a bar plot of weights