knitr::opts_chunk$set(echo = TRUE)
library(knitr)
# 1. Define base parameters
rf <- 0.05
er_m <- 0.05 + 0.08
sd_m <- 0.20
# 2. Define the given portfolio weights
w_bills <- c(0, 0.2, 0.4, 0.6, 0.8, 1.0)
w_index <- c(1.0, 0.8, 0.6, 0.4, 0.2, 0)
# Problem 10: Calculate Expected Return and Standard Deviation
expected_return <- w_bills * rf + w_index * er_m
std_dev <- w_index * sd_m
# Problem 11 & 12: Calculate Utility for A=2 and A=3
utility_A2 <- expected_return - 0.5 * 2 * (std_dev^2)
utility_A3 <- expected_return - 0.5 * 3 * (std_dev^2)
# Create a clean data frame
portfolio_data <- data.frame(
W_Bills = w_bills,
W_Index = w_index,
Expected_Return = expected_return,
Standard_Dev = std_dev,
Utility_A2 = utility_A2,
Utility_A3 = utility_A3
)
# Output the table
kable(portfolio_data, digits = 4, caption = "Portfolio Expected Returns, Risk, and Utility")
Portfolio Expected Returns, Risk, and Utility
| 0.0 |
1.0 |
0.130 |
0.20 |
0.0900 |
0.0700 |
| 0.2 |
0.8 |
0.114 |
0.16 |
0.0884 |
0.0756 |
| 0.4 |
0.6 |
0.098 |
0.12 |
0.0836 |
0.0764 |
| 0.6 |
0.4 |
0.082 |
0.08 |
0.0756 |
0.0724 |
| 0.8 |
0.2 |
0.066 |
0.04 |
0.0644 |
0.0636 |
| 1.0 |
0.0 |
0.050 |
0.00 |
0.0500 |
0.0500 |
# CFA Data input
cfa_data <- data.frame(
Investment = 1:4,
E_r = c(0.12, 0.15, 0.21, 0.24),
Std_Dev = c(0.30, 0.50, 0.16, 0.21)
)
# Question 1: Calculate Utility for risk-averse investor (A = 4)
cfa_data$Utility_A4 <- cfa_data$E_r - 0.5 * 4 * (cfa_data$Std_Dev^2)
kable(cfa_data, digits = 4, caption = "CFA Investments and Utility Scores")
CFA Investments and Utility Scores
| 1 |
0.12 |
0.30 |
-0.0600 |
| 2 |
0.15 |
0.50 |
-0.3500 |
| 3 |
0.21 |
0.16 |
0.1588 |
| 4 |
0.24 |
0.21 |
0.1518 |