When constructing a portfolio, it’s important to pick un-correlated assets. This is just a corollary of the “don’t put all your eggs in one basket” principle. If asset B goes up (or down) when asset A goes up (or down) and vice versa, there’s really no reason to own both assets. By and large, assets of different classes are weakly correlated, for example, stocks and bonds, stocks and gold, and etc. In part1, I said I’m interested in a vanguard energy fund (VGENX) because oil price has been hammered. However, because I already own the Total Stock Market Index Fund (VTSMX), I want to find out how correlated VGENX is with VTSMX.
Step 1. Load libraries and helper functions
Step 2. Download the monthly adjusted closing price data on VGENX and VTSMX since Sept 2005 from Yahoo.
Step 3. Change the class of the time index to yearmon.
Step 4. Merge both price series into one data frame and Calculate continuously compounded returns.
Step 5. Plot cumulative returns.
Step 6. Display pair-wise scatter plots.
Both plots show the returns of VGENX and VTSMX are pretty correlated.
Step 7. Compute correlation matrices.
We see their correlation is 0.78, which is pretty high.