library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ readr     2.1.5
## ✔ forcats   1.0.0     ✔ stringr   1.5.1
## ✔ ggplot2   3.5.1     ✔ tibble    3.2.1
## ✔ lubridate 1.9.4     ✔ tidyr     1.3.1
## ✔ purrr     1.0.4     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(lubridate)
library(readr)
library(readxl)
library(dplyr)
library(moments)
library(ggplot2)
W_b_i <- data.frame(
  w_b = seq(0, 1, by = 0.2),
  w_i = rev(seq(0, 1, by = 0.2)))
print(W_b_i)
##   w_b w_i
## 1 0.0 1.0
## 2 0.2 0.8
## 3 0.4 0.6
## 4 0.6 0.4
## 5 0.8 0.2
## 6 1.0 0.0
tbill_r = 0.05
index_r = tbill_r+0.08
index_sd = 0.2
W_b_i$Expected_r_p <- W_b_i$w_b*tbill_r+W_b_i$w_i*index_r
W_b_i
##   w_b w_i Expected_r_p
## 1 0.0 1.0        0.130
## 2 0.2 0.8        0.114
## 3 0.4 0.6        0.098
## 4 0.6 0.4        0.082
## 5 0.8 0.2        0.066
## 6 1.0 0.0        0.050
W_b_i$Variance_p <- W_b_i$w_i^2*index_sd^2
W_b_i
##   w_b w_i Expected_r_p Variance_p
## 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
W_b_i$Utility_A_2 <- W_b_i$Expected_r_p-0.5*2*W_b_i$Variance_p
W_b_i
##   w_b w_i Expected_r_p Variance_p Utility_A_2
## 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

The column labelled U(A = 2) implies that investors with A = 2 prefer a portfolio that is invested 100% in the market index to any of the other portfolios in the table.

W_b_i$Utility_A_3 <- W_b_i$Expected_r_p-0.5*3*W_b_i$Variance_p
W_b_i
##   w_b w_i Expected_r_p Variance_p Utility_A_2 Utility_A_3
## 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

The more risk averse investors prefer the portfolio that is invested 60% in the market, rather than the 100% market weight preferred by investors with A=2