Problem 10: Expected Return and Variance

# Given data
rf <- 0.05  # Risk-free rate (T-bill rate)
r_index <- rf + 0.08  # S&P 500 return
dev_index <- 0.20  # S&P 500 standard deviation

weights_bills <- c(0, 0.2, 0.4, 0.6, 0.8, 1.0)
weights_index <- 1 - weights_bills

# Expected return calculation
expected_returns <- weights_bills * rf + weights_index * r_index

# Variance calculation (assuming T-bills have zero variance and no correlation)
variances <- (weights_index^2) * (dev_index^2)

# Combine results in a data frame
portfolio_data <- data.frame(weights_bills, weights_index, expected_returns, variances)
print(portfolio_data)
##   weights_bills weights_index expected_returns variances
## 1           0.0           1.0            0.130    0.0400
## 2           0.2           0.8            0.114    0.0256
## 3           0.4           0.6            0.098    0.0144
## 4           0.6           0.4            0.082    0.0064
## 5           0.8           0.2            0.066    0.0016
## 6           1.0           0.0            0.050    0.0000

Problem 11: Utility Calculation for A = 2

A_2 <- 2
utility_A2 <- expected_returns - 0.5 * A_2 * variances
portfolio_data$utility_A2 <- utility_A2
print(portfolio_data)
##   weights_bills weights_index expected_returns variances utility_A2
## 1           0.0           1.0            0.130    0.0400     0.0900
## 2           0.2           0.8            0.114    0.0256     0.0884
## 3           0.4           0.6            0.098    0.0144     0.0836
## 4           0.6           0.4            0.082    0.0064     0.0756
## 5           0.8           0.2            0.066    0.0016     0.0644
## 6           1.0           0.0            0.050    0.0000     0.0500

Problem 12: Utility Calculation for A = 3

A_3 <- 3
utility_A3 <- expected_returns - 0.5 * A_3 * variances
portfolio_data$utility_A3 <- utility_A3
print(portfolio_data)
##   weights_bills weights_index expected_returns variances utility_A2 utility_A3
## 1           0.0           1.0            0.130    0.0400     0.0900     0.0700
## 2           0.2           0.8            0.114    0.0256     0.0884     0.0756
## 3           0.4           0.6            0.098    0.0144     0.0836     0.0764
## 4           0.6           0.4            0.082    0.0064     0.0756     0.0724
## 5           0.8           0.2            0.066    0.0016     0.0644     0.0636
## 6           1.0           0.0            0.050    0.0000     0.0500     0.0500

CFA Problem 1-3: Utility for Given Investments

# Given CFA data
cfa_data <- data.frame(
  Investment = c(1, 2, 3, 4),
  Expected_Return = c(0.12, 0.15, 0.21, 0.24),
  Std_Dev = c(0.30, 0.50, 0.16, 0.21)
)

# Compute utility with A = 4
A_4 <- 4
cfa_data$Utility_A4 <- cfa_data$Expected_Return - 0.5 * A_4 * (cfa_data$Std_Dev^2)

# Identify best investment for A = 4
best_A4 <- cfa_data$Investment[which.max(cfa_data$Utility_A4)]
print(cfa_data)
##   Investment Expected_Return Std_Dev Utility_A4
## 1          1            0.12    0.30    -0.0600
## 2          2            0.15    0.50    -0.3500
## 3          3            0.21    0.16     0.1588
## 4          4            0.24    0.21     0.1518
paste("Best investment for A=4: Investment", best_A4)
## [1] "Best investment for A=4: Investment 3"
# Compute utility with A = 0 (Risk-neutral)
A_0 <- 0
cfa_data$Utility_A0 <- cfa_data$Expected_Return - 0.5 * A_0 * (cfa_data$Std_Dev^2)

# Identify best investment for A = 0
best_A0 <- cfa_data$Investment[which.max(cfa_data$Utility_A0)]
print(cfa_data)
##   Investment Expected_Return Std_Dev Utility_A4 Utility_A0
## 1          1            0.12    0.30    -0.0600       0.12
## 2          2            0.15    0.50    -0.3500       0.15
## 3          3            0.21    0.16     0.1588       0.21
## 4          4            0.24    0.21     0.1518       0.24
paste("Best investment for A=0: Investment", best_A0)
## [1] "Best investment for A=0: Investment 4"
# Answer for CFA Problem 3: A represents risk aversion
txt <- "The variable (A) in the utility formula represents investor's aversion to risk."
print(txt)
## [1] "The variable (A) in the utility formula represents investor's aversion to risk."