MAS 261 - Lecture 21

Introduction to Portfolio Management

Author

Penelope Pooler Eisenbies

Published

November 4, 2024

Housekeeping

  • Today’s plan

    • Comments and Questions from Engagement Questions or about R

    • Upcoming Dates

    • Review Questions

    • Comparing Portfolios of Stocks

      • Profitability of one stock using geometric mean

      • Weighted Mean of two or more stocks

      • Volatility of One Stock using adjusted standard deviation

      • Volatility of weighted combination of two or more stocks

Upcoming Dates

  • HW 7 is due Wed. 11/6 at midnight.

  • Test 2 is on November 12th and will include material up through Lecture 20.

  • Practice Questions are now available and demo videos will be posted by Saturday.

  • Lecture 21 - Intro to Portfolio Management will be on Final Exam, not on Test 2.

R and RStudio

  • In this course we will use R and RStudio to understand statistical concepts.

  • You will access R and RStudio through Posit Cloud.

  • I will post R/RStudio files on Posit Cloud that you can access in provided links.

  • I will also provide demo videos that show how to access files and complete exercises.

  • NOTE: The free Posit Cloud account is limited to 25 hours per month.

    • I demo how to download completed work so that you can use this allotment efficiently.

    • For those who want to go further with R/RStudio:

Lecture 21 In-class Exercises - Q1

Recall that in lecture 20 we discussed \(R_{xy}\), the correlation coefficient.

The matrix shown here shows a correlation matrix for four stocks based on their 2021 - 2022 daily adjusted closing values.

A correlation matrix shows the pairwise correlation between each pair of stocks in the dataset.


Which other stock is most strongly positively correlated with Apple (AAPL)?

AAPL MSFT AMZN NFLX
AAPL 1.00 0.94 0.67 0.75
MSFT 0.94 1.00 0.64 0.77
AMZN 0.67 0.64 1.00 0.50
NFLX 0.75 0.77 0.50 1.00

Lecture 21 In-class Exercises - Q2

Given the non-linear trends in stock prices, does it make sense to calculate the correlation, \(R_{xy}\), between pairs of stocks?

Calculating Average Rate of Return for Each Stock

  • For each of these four companies we have two year of data.

  • We want to know the average rate of return.

  • We could calculate the arithmetic mean of the adjusted close, but the conventional wisdom is that this is not ideal.

  • Instead, we calculate the geometric mean

  • The psych package in R has the geomtric.mean command to do this calculation.

Geomtric Mean and Arithmetic Mean

If the Stocks are relatively stable, these values will be similar.

The geometric mean is more reliable because of the compounded interest.


The table below shows the geometric means of three of the stocks:

Stock Arithmetic_Mean Geo_Mean
AAPL 162.1884 161.2011
MSFT 287.3443 284.4279
AMZN 123.7405 NA
NFLX 337.3382 323.3717

Lecture 21 In-class Exercises - Q3-Q4


Question 3. What is the geometric mean for the Amazon (AMZN) stock data?

  • Use the geometric.mean command from the psych package.
  • Round answer to two decimal places.


Question 4. Which of these four stocks shows the largest disparity between the geometric and arithmetic mean?

Calculating the Mean Rate of Return of a Portfolio

  • A primary concern when investing is “not putting all of your eggs in one basket”.

  • In other words, it is important to diversify your portfolio by investing in multiple stocks so that you have some protection if one stock crashes.

  • We can calculate the rate of return of a portfolio


  • To do this we calculate a weighted average of the individual stock geometric means:

    • \(W_{1}\times Geo.Mean_{1} + W_{2}\times Geo.Mean_{2}\)
    • \(W_{1}\) and \(W_{2}\) are the percentage of the portfolio invested in each stock.


  • In our simple examples, we will look at 2 stock portfolios, but the same principles apply to larger portfolios.

  • This weighted average the stock portfolio is referred to as it’s Expected Value.

Average Rates of Return of Portfolio Options


Example: Calculate the average rate of return of a portfolio where 80% is invested in Apple (AAPL) and 20% is invested in Netflix (NFLX).


Code
```{r echo=T}
w1 <- .8
w2 <- .2

gm_aapl <- geometric.mean(adj_close$AAPL) 
gm_nflx <- geometric.mean(adj_close$NFLX) 

w1*gm_aapl + w2*gm_nflx
```
[1] 193.6352

Lecture 21 In-class Exercises - Q5-Q6

Round answer to both questions below to two decimal places.


Question 5: What is the average rate of return of a portfolio with 60% investment in Amazon (AMZN) and 40% investment in Microsoft (MSFT)?


Question 6: What is average rate of return of a portfolio with 70% investment in Amazon (AMZN) and 30% investment in Apple (AAPL)?

Volatility of a single Stock Rate of Return

Volatility is a measure of variability and risk associated with a stocks rate of return over time.

Volatlity for a single stock: \(Volatility = SD \times \sqrt{T} = \sqrt{VAR \times T}\)

  • T = number of time periods.

  • In these two years, there were 501 trading days, T = 501.

    • Examine imported data to verify T.

Variances, standard deviations, and volatilities for each of these stocks:

Stock Variance Std_Dev Volatility
AAPL 318.3906 17.84350 399.3917
MSFT 1713.2753 NA NA
AMZN 469.2115 21.66129 484.8453
NFLX 8762.2757 93.60703 2095.2089

Lecture 21 In-class Exercises - Q7


Question 7: What is the volatility of the Microsoft (MSFT) stock?

Round answer to two decimal places.


Volatlity for a single stock:

\[ Volatility = SD \times \sqrt{T} = \sqrt{VAR \times T} \]

Stock Variance Std_Dev Volatility
AAPL 318.3906 17.84350 399.3917
MSFT 1713.2753 NA NA
AMZN 469.2115 21.66129 484.8453
NFLX 8762.2757 93.60703 2095.2089

Variance of a Two Stock Portfolio

Recall our portfolio where 80% is invested in Apple and 20% is invested in Netflix

Calculating the volatility of a portfolio little more complex, but it is easier if we break it down into steps.

Step 1: Calculate variance of portfolio of stocks 1 and 2, which is the sum of three parts:

Part 1: \(W_{1}^2 \times Variance_{1}\)
Part 2: \(W_{2}^2 \times Variance_{2}\)
Part 3: \(2 \times W_{1} \times W_{2} \times COV_{1,2}\)

Portfolio Variance = Part 1 + Part 2 + Part 3

Code
```{r echo=T}
w1 <- .8
w2 <- .2
var1 <-  var(adj_close$AAPL)                                  # Var 1
var2 <- var(adj_close$NFLX)                                   # Var 2
cov12 <- cov(adj_close$AAPL, adj_close$NFLX)                     # Cov 1 & 2
(portfolio_var <- w1^2*var1 + w2^2*var2 + 2*w1*w2*cov12)   # Part 1 + Part 2 + Part 3
```
[1] 955.3743

Volatility of Two Stock Portfolio

Step 1: Calculate variance of portfolio of stocks 1 and 2, which is the sum of three parts:

Part 1: \(W_{1}^2 \times Variance_{1}\)
Part 2: \(W_{2}^2 \times Variance_{2}\)
Part 3: \(2 \times W_{1} \times W_{2} \times COV_{1,2}\)

Portfolio Variance = Part 1 + Part 2 + Part 3

Code
```{r echo=T}
w1 <- .8
w2 <- .2
var1 <-  var(adj_close$AAPL)                                  # Var 1
var2 <- var(adj_close$NFLX)                                   # Var 2
cov12 <- cov(adj_close$AAPL, adj_close$NFLX)                     # Cov 1 & 2
(portfolio_var <- w1^2*var1 + w2^2*var2 + 2*w1*w2*cov12)   # Part 1 + Part 2 + Part 3
```
[1] 955.3743

Step 2: Calculate Volatility from Variance

\[ Volatlity = SD \times \sqrt{T} = \sqrt{VAR \times T}\]

Code
```{r echo=T}
(portfolio_volatility <- sqrt(portfolio_var*501)) 
```
[1] 691.84

Lecture 21 In-class Exercises - Q8-Q9

Round answer to both questions below to two decimal places.


Question 8: What is the volatility of a portfolio with 60% investment in Amazon and 40% investment in Microsoft?


Question 9: What is the volatility of a portfolio with 70% investment in Amazon and 30% investment in Apple?

Understanding These Results Visually

Key Points from Today

  • Stock portfolios are linear combinations of stocks

  • The geometric mean is average rate of return of a single stock

    • Also referred to as the expected value of the stock.
  • The average rate of return of a portfolio is the weighted average of the individual stock means.

    • Also referred to as the expected value of the stock.
  • Volatility of a stock or a portfolio is \(SD \times \sqrt{T}\)

  • To find volatility of a portfolio, first find the variance

    • Portfolio \(Volatility = \sqrt{VAR \times T}\)
  • We will review these concepts and calculations after Quiz 2

To submit an Engagement Question or Comment about material from Lecture 21: Submit it by midnight today (day of lecture).