{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

11.portfolio_trace_out

11.portfolio_trace_out - #TRACE OUT THE EFFICIENT FRONTIER...

This preview shows pages 1–2. Sign up to view the full content.

#TRACE OUT THE EFFICIENT FRONTIER - NO RISKLESS LENDING AND BORROWING: #Read many combinations of the three stocks: data <- read.table("abc.txt", header=TRUE) #Or from here: data <- read.table("http://www.stat.ucla.edu/~nchristo/datac183c283/statc183c283_abc.txt", header=TRUE) #Compute the standard deviation of each portfolio: sigma_p <- ((data\$a)^2*0.0036+(data\$b)^2*0.0064+ (data\$c)^2*0.04+2*data\$a*data\$b*0.5*0.06*0.08+2*data\$a*data\$c*0.2*0.06*0.2+2*data\$b *data\$c*0.4*0.08*0.2)^.5 #Compute the expected return of each portfolio: rp_bar <- data\$a*0.14+data\$b*0.08+data\$c*0.2 #Create a matrix with a, b, c, sigma_p, rp_bar: qq <- cbind(data\$a, data\$b, data\$c, sigma_p, rp_bar) #Create a matrix with all the points not allowing short sales: #Create a matrix with all the points allowing short sales: qq1 <- qq[which(qq[,1]<0 | qq[,2]<0 | qq[,3]<0),] #Plot the points: plot(qq[,4], qq[,5], type="n" ,xlim=c(0,0.2), ylim=c(0,0.35), xlab="Portfolio standard deviation", ylab="Expected return", xaxt="no", yaxt="no")

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 3

11.portfolio_trace_out - #TRACE OUT THE EFFICIENT FRONTIER...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online