#CFA 1.) Define the variables
investment_amount <- 100000
# Equities
equities_expected_return <- (0.6 * 50000) + (0.4 * -30000)
# T-bills
tbills_expected_return <- 1.0 * 5000
# Calculate the expected risk premium
expected_risk_premium <- equities_expected_return - tbills_expected_return
# Print the result
print(paste("Expected risk premium in dollars of investing in equities versus T-bills:", expected_risk_premium))
## [1] "Expected risk premium in dollars of investing in equities versus T-bills: 13000"
#10-12.) Given data
tbill_rate <- 0.05 # T-bill rate
sp_return_difference <- 0.08 # S&P 500 return difference
sp_standard_deviation <- 0.20 # S&P 500 standard deviation
# Weight combinations
weights <- seq(0, 1, by = 0.2)
# Function to calculate expected return of a portfolio
calc_expected_return <- function(weight) {
weight_tbill <- max(0, 1 - weight)
return (weight * sp_return_difference + weight_tbill * tbill_rate)
}
# Function to calculate variance of a portfolio
calc_variance <- function(weight) {
return ((weight^2) * (sp_standard_deviation^2))
}
# Calculate expected returns and variances for each weight combination
expected_returns <- sapply(weights, calc_expected_return)
variances <- sapply(weights, calc_variance)
# Print results for Problem 10
print("Problem 10 - Expected Returns and Variances:")
## [1] "Problem 10 - Expected Returns and Variances:"
print(data.frame(Weight_Tbill = weights, Weight_SP500 = 1 - weights, Expected_Return = expected_returns, Variance = variances))
## Weight_Tbill Weight_SP500 Expected_Return Variance
## 1 0.0 1.0 0.050 0.0000
## 2 0.2 0.8 0.056 0.0016
## 3 0.4 0.6 0.062 0.0064
## 4 0.6 0.4 0.068 0.0144
## 5 0.8 0.2 0.074 0.0256
## 6 1.0 0.0 0.080 0.0400
# Function to calculate utility level for given A
calc_utility <- function(expected_return, variance, A) {
return (expected_return - 0.5 * A * variance)
}
# Investor's A values
A_values <- c(2, 3)
# Calculate utility levels for each portfolio for each A value
for (A in A_values) {
utility_levels <- calc_utility(expected_returns, variances, A)
# Print results for Problem 11 and 12
cat("Problem", 11 + which(A_values == A), "- Utility levels for A =", A, ":\n")
print(utility_levels)
}
## Problem 12 - Utility levels for A = 2 :
## [1] 0.0500 0.0544 0.0556 0.0536 0.0484 0.0400
## Problem 13 - Utility levels for A = 3 :
## [1] 0.0500 0.0536 0.0524 0.0464 0.0356 0.0200
#CFA 1-3.) Given data
expected_returns <- c(0.12, 0.15, 0.21, 0.24)
standard_deviations <- c(0.30, 0.50, 0.16, 0.21)
A <- 4 # Aversion to risk parameter
# Function to calculate utility
calc_utility <- function(expected_return, standard_deviation, A) {
return (expected_return - 0.5 * A * standard_deviation^2)
}
# Calculate utilities for each investment
utilities <- calc_utility(expected_returns, standard_deviations, A)
# Problem 1: Select investment for risk averse investor
selected_investment_1 <- which.max(utilities)
cat("Problem 1 - Selected investment for risk averse investor (A = 4): Investment", selected_investment_1, "\n")
## Problem 1 - Selected investment for risk averse investor (A = 4): Investment 3
# Problem 2: Select investment for risk neutral investor
selected_investment_2 <- which.max(expected_returns)
cat("Problem 2 - Selected investment for risk neutral investor: Investment", selected_investment_2, "\n")
## Problem 2 - Selected investment for risk neutral investor: Investment 4
# Problem 3: Determine the variable (A) in the utility formula
variable_A <- "b. Investor’s aversion to risk."
cat("Problem 3 - The variable (A) in the utility formula represents:", variable_A, "\n")
## Problem 3 - The variable (A) in the utility formula represents: b. Investor’s aversion to risk.
You can also embed plots, for example:
Note that the echo = FALSE parameter was added to the
code chunk to prevent printing of the R code that generated the
plot.