Question
Year Esprit HSBC SHKP HW CLP 2000 8.4 108 83.75 105.91 32.5 2001 6.65 115.5 77.75 97.25 29.75 2002 8.8 91.25 63 75.25 31.4 2003
Year | Esprit | HSBC | SHKP | HW | CLP |
2000 | 8.4 | 108 | 83.75 | 105.91 | 32.5 |
2001 | 6.65 | 115.5 | 77.75 | 97.25 | 29.75 |
2002 | 8.8 | 91.25 | 63 | 75.25 | 31.4 |
2003 | 13.15 | 85.25 | 46.2 | 48.8 | 36.9 |
2004 | 25.85 | 122.5 | 64.25 | 57.25 | 44.6 |
2005 | 55.1 | 124.4 | 75.75 | 73.9 | 44.95 |
2006 | 87.05 | 142.5 | 89.4 | 79 | 57.6 |
(a) Using the data, calculate the annual covariance matrix and the annual expected rates of returns of these stocks.
(b) Using the annual expected rates of returns of SHKP and HSBC, calculate and plot the efficient frontier.
(c) Assume, for simplicity, the listed stocks below form the market portfolio. Based on the Example 6.11 in the textbook (Investment Science), calculate the efficient market weights 1, 2 of the two efficient portfolios with short-selling. Using the two-fund theorem, determine the efficient market portfolio volatility and the market portfolio expected rate of return r when = 0.5, where the new efficient portfolio weight is 1 + (1 )2
(d) Using the two-fund theorem, plot the efficient frontier of the market portfolio (in part (c)) with short-selling. Suppose the risk-free interest rate rf = 5%. Determine the efficient frontier when lending and borrowing of the risk-free asset is allowed. Locate on the diagram also the point of unique risky fund on this frontier.
Comment: I don't want answer. I can find the answer easily in the internet. What I care most is how to solve the problem.(Better to show R-script)
Note that R studio is used in this question. Furthermore, the suggested code is as below, but I don't understand the meaning of it.
Code sample:
s.3333 <- read.csv("3333.HK.csv") s.0005 <- read.csv("0005.HK.csv") s.TSLA <- read.csv("TSLA.csv") str(s.3333) s.3333$Date <- as.Date(s.3333$Date, format = "%Y-%m-%d") s.0005$Date <- as.Date(s.0005$Date, format = "%Y-%m-%d") s.TSLA$Date <- as.Date(s.TSLA$Date, format = "%Y-%m-%d") str(s.3333)
s.1 = s.3333[,c(1,6)]; colnames(s.1) = c("Date","3333.HK") s.2 = s.0005[,c(1,6)]; colnames(s.2) = c("Date","0005.HK") s.3 = s.TSLA[,c(1,6)]; colnames(s.3) = c("Date","TSLA")
# # Merge in to one # df = merge(merge(s.1, s.2, by = "Date"), s.3, by = "Date") rownames(df) = df$Date df$Date <- NULL
# # Mean vector, and Variance and covariance matrix # ret = apply(log(df), 2, diff) mu = apply(ret, 2, mean) Sigma = cov(ret) ts.plot(ret, col = 1:3, main = "Return") legend("bottomleft", legend = colnames(df), lty = 1, col = 1:3)
E = cbind(mu, c(1,1,1)) A = cbind(Sigma, E) A = rbind(A, cbind(t(E), matrix(c(0,0,0,0),nrow = 2))) n_sim = 101 w = array(NA, dim = c(n_sim, 3)) target.mu = seq(-0.05, 0.05, length.out = n_sim) for(i in 1:n_sim){ w[i,] = (solve(A)%*%c(0,0,0,target.mu[i],1))[1:3] } port.mu = w%*%mu # y-axis port.sd = sqrt(apply((w%*%Sigma)*w, 1, sum)) # x-axis plot(port.sd, port.mu, type = "l", xlim =c(0, 0.3), xaxs = "i", main = expression(paste(mu,"-",sigma, " diagram")) ) lines(port.sd[port.mu>0], port.mu[port.mu>0], col = "blue") legend("topleft", legend = "Efficient frontier without riskfree asset", col = "blue", lty = 1, cex =0.6) Case 2: #Inclusion of risk-free asset rf = 0.02/252 b = mu - rf v = solve(Sigma)%*%b w3 = v/sum(v) tan.mean = mu%*%w3 tan.sd = sqrt(t(w3)%*%Sigma%*%w3) ## Plot plot(port.sd, port.mu, type = "l", xlim =c(0, 0.3), xaxs = "i", main = expression(paste(mu,"-",sigma, " diagram"))) lines(port.sd[port.mu>0], port.mu[port.mu>0], col = "blue") # Original EF points(tan.sd, tan.mean, col = "red", pch = 21, bg = "red") # Tangency portfolio points(0, rf, col = "red", pch = 21, bg = "red") # Risk-free asset y.points = c(tan.mean, rf) x.points = c(tan.sd, 0) model = lm(y.points ~x.points) abline(model$coefficients, col = "black") # sttraight line abline(h = 0, col = "green", lty = 2) abline(a = model$coefficients[1], b = -model$coefficients[2], col = "red") #Short market portfolio and buy risk-free asset legend("topleft", legend = c("EF without riskfree asset", "EF with riskfree asset"), col = c("blue","red"), lty = 1, cex =0.6)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started