setwd("D:/School Folder/HW/Investment")
data <- read.csv("6_Portfolios_2x3.csv", skip = 13, header = TRUE)
library(readxl)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(tidyr)
library(moments)
# Filter data for the required period
data <- data %>%
filter(as.numeric(substr(data$X, 1, 4)) >= 1930 & as.numeric(substr(data$X, 1, 4)) <= 2018, na.rm = TRUE)
## Warning: There were 2 warnings in `filter()`.
## The first warning was:
## ℹ In argument: `as.numeric(substr(data$X, 1, 4)) >= 1930 & ...`.
## Caused by warning:
## ! NAs introduced by coercion
## ℹ Run ]8;;ide:run:dplyr::last_dplyr_warnings()dplyr::last_dplyr_warnings()]8;; to see the 1 remaining warning.
# Separate the data into two halves
half1 <- data %>%
filter(as.numeric(substr(data$X, 1, 4)) <= 1974)
half2 <- data %>%
filter(as.numeric(substr(data$X, 1, 4)) > 1974)
# Define function to compute statistics
compute_stats <- function(df) {
stats <- data.frame(
mean = apply(df, 2, mean),
sd = apply(df, 2, sd),
skew = apply(df, 2, skewness),
kurt = apply(df, 2, kurtosis)
)
return(stats)
}
# Convert all columns to numeric
half1 <- mutate_all(half1, as.numeric)
# Compute statistics for each portfolio for the first half
stats_half1 <- compute_stats(half1)
# Convert all columns to numeric
half2 <- mutate_all(half2, as.numeric)
# Compute statistics for each portfolio for the second half
stats_half2 <- compute_stats(half2)
# Print statistics for each half
print("Statistics for the first half:")
## [1] "Statistics for the first half:"
print(stats_half1)
## mean sd skew kurt
## X 190511.30616 30200.58814 -6.072206 37.94885
## X.1 24.63887 78.60514 5.784690 43.21384
## X.2 39.10053 103.97212 4.368064 28.19300
## X.3 42.45082 112.55806 4.558937 31.12404
## X.4 102.54768 235.93800 3.300449 14.22945
## X.5 73.58033 152.49596 2.887320 11.98555
## X.6 46.57398 123.81697 4.898090 31.54145
print("Statistics for the second half:")
## [1] "Statistics for the second half:"
print(stats_half2)
## mean sd skew kurt
## X 195622.6224 27979.0139 -6.762465 46.831481
## X.1 163.6422 375.8300 2.420004 7.882026
## X.2 166.5585 368.9623 2.154928 6.286457
## X.3 173.7671 427.7117 2.646747 9.227591
## X.4 1362.2248 4722.0513 4.199987 21.494171
## X.5 973.4484 3468.8561 4.592635 24.877920
## X.6 854.9657 3302.0110 5.071937 30.346009
Chapter 5 CFA 1 Expected Risk Premium = (Expected Return from Equities - Risk Free Rate) x Probability of Equities + (Expected Return from Risk-Free T-Bill) x (1 - Probability of Equities)
Expected Risk Premium = (0.6 x $50000 + 0.4 x (-30000)) -5000
Expected Risk Premium = $20000
Chapter 6
Problem 10
Expected Return Calculation:
The average annual rate of return for the S&P 500 portfolio is 8% higher than the Treasury bill return, which is 5%. So, the expected return for the S&P 500 portfolio is 5%+8%=13%5%+8%=13%.
The expected return for the Treasury bills is simply 5%.
Variance Calculation:
The standard deviation (or volatility) of the S&P 500 portfolio is given as 20%.
The variance of the S&P 500 portfolio is the square of the standard deviation, which is 0.22=0.040.22=0.04.
The variance of the Treasury bills is assumed to be negligible.
So Given the weight we got these return result
| Portfolio | Weight of T-bills (Wbills) | Weight of S&P 500 (Windex) | Expected Return | Variance |
|---|---|---|---|---|
| Portfolio 1 | 0 | 1 | 13% | 0.04 |
| Portfolio 2 | 0.2 | 0.8 | 12.6% | 0.04 |
| Portfolio 3 | 0.4 | 0.6 | 12.2% | 0.04 |
| Portfolio 4 | 0.6 | 0.4 | 11.8% | 0.04 |
| Portfolio 5 | 0.8 | 0.2 | 11.4% | 0.04 |
| Portfolio 6 | 1 | 0 | 11% | 0.04 |
Problem 11
With risk aversion parameter A = 2
we can use the following utility function:
U(W) = E(R) -1/2 x A x σ^2
U(W) is the utility level
E(R) is the expected return
A is the risk aversion parameter
σ^2 is the variance
| Portfolio | Expected Return (%) | Variance | Utility Level |
|---|---|---|---|
| Portfolio 1 | 13 | 0.04 | 13−12×2×0.04=12.9213−21×2×0.04=12.92 |
| Portfolio 2 | 12.6 | 0.04 | 12.6−12×2×0.04=12.5212.6−21×2×0.04=12.52 |
| Portfolio 3 | 12.2 | 0.04 | 12.2−12×2×0.04=12.1212.2−21×2×0.04=12.12 |
| Portfolio 4 | 11.8 | 0.04 | 11.8−12×2×0.04=11.7211.8−21×2×0.04=11.72 |
| Portfolio 5 | 11.4 | 0.04 | 11.4−12×2×0.04=11.3211.4−21×2×0.04=11.32 |
| Portfolio 6 | 11 | 0.04 | 11−12×2×0.04=10.9211−21×2×0.04=10.92 |
Problem 12
| Portfolio | Expected Return (%) | Variance | Utility Level |
|---|---|---|---|
| Portfolio 1 | 13 | 0.04 | 13−12×3×0.04=12.8813−21×3×0.04=12.88 |
| Portfolio 2 | 12.6 | 0.04 | 12.6−12×3×0.04=12.4812.6−21×3×0.04=12.48 |
| Portfolio 3 | 12.2 | 0.04 | 12.2−12×3×0.04=12.0812.2−21×3×0.04=12.08 |
| Portfolio 4 | 11.8 | 0.04 | 11.8−12×3×0.04=11.6811.8−21×3×0.04=11.68 |
| Portfolio 5 | 11.4 | 0.04 | 11.4−12×3×0.04=11.2811.4−21×3×0.04=11.28 |
| Portfolio 6 | 11 | 0.04 | 11−12×3×0.04=10.8811−21×3×0.04=10.88 |
compared to the results for A =2, the utility levels are slightly lower for A = 3. This indicates that the investor with a higher risk aversion parameter A = 3 is more sensitive to variance and prefers portoflios with lower variance, even if it means sacrificing some expected return. Therefore, for investors with A=3, portfolios with higher weights in Treasury bills are preferred.
CFA 1
an investor who is risk averse with a coefficient of A = 4 would choose investment number 3. Because the utility formula subtracts the variance multiplied by the risk aversion coefficient from expected return. So, a risk-averse investor would prefer an investment with a lower standard deviation (variance) all else being equal.
Of the four investments provided, investment 3 has the lowest standard deviation (0.16) which would result in the highest utility according to the formula.
CFA 2
If you were risk neutral, then the value of A in the formula would be 0. Based solely on expected return, you would select Investment 4, which has the highest expected return (0.24) among the four options.
CFA 3
b. Investor’s aversion to risk.