# NOT RUN {
csv <- 0.05 # coefficient of standard deviation
mu <- 90 # mu <- 100
sigma <- mu * csv
x <- seq(mu - 5 * sigma, mu + 5 * sigma, length.out = 10000)
pd <- dnorm(x, mean = mu, sd = sigma)
gamma <- 0.8
# the ratio of risk premium to expected return (i.e. the relative risk premium).
(mu - CRRA(x, gamma, pd)$CE) / mu
####
df <- apply_expand.grid(
function(arg) {
CRRA(arg["x"], arg["gamma"])$u
},
x = seq(0.5, 3, 0.1),
gamma = c(0.5, 1, 2, 3)
)
coplot(result ~ x | as.factor(gamma), data = df)
# }
Run the code above in your browser using DataLab